Search in sources :

Example 46 with DecimalValue

use of org.openhab.binding.tinkerforge.internal.types.DecimalValue in project openhab1-addons by openhab.

the class IndustrialDualAnalogInChannelImpl method setSensorValue.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated
     */
@Override
public void setSensorValue(DecimalValue newSensorValue) {
    DecimalValue oldSensorValue = sensorValue;
    sensorValue = newSensorValue;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.INDUSTRIAL_DUAL_ANALOG_IN_CHANNEL__SENSOR_VALUE, oldSensorValue, sensorValue));
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 47 with DecimalValue

use of org.openhab.binding.tinkerforge.internal.types.DecimalValue in project openhab1-addons by openhab.

the class MBarometerTemperatureImpl method setSensorValue.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated
     */
@Override
public void setSensorValue(DecimalValue newSensorValue) {
    DecimalValue oldSensorValue = sensorValue;
    sensorValue = newSensorValue;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBAROMETER_TEMPERATURE__SENSOR_VALUE, oldSensorValue, sensorValue));
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 48 with DecimalValue

use of org.openhab.binding.tinkerforge.internal.types.DecimalValue in project openhab1-addons by openhab.

the class MBrickDCImpl method handleVelocity.

/**
     * 
     * @generated NOT
     */
private void handleVelocity(short velocity, boolean usethreshold) {
    DecimalValue newValue = Tools.calculate(velocity);
    logger.trace("{} got new value {}", LoggerConstants.TFMODELUPDATE, newValue);
    if (usethreshold) {
        if (newValue.compareTo(getSensorValue(), getThreshold()) != 0) {
            logger.trace("{} setting new value {}", LoggerConstants.TFMODELUPDATE, newValue);
            setSensorValue(newValue);
        } else {
            logger.trace("{} omitting new value {}", LoggerConstants.TFMODELUPDATE, newValue);
        }
    } else {
        logger.trace("{} setting new value {}", LoggerConstants.TFMODELUPDATE, newValue);
        setSensorValue(newValue);
    }
    OnOffValue newSwitchState = newValue.onOffValue(0);
    logger.trace("new switchstate {} new value {}", newSwitchState, newValue);
    if (newSwitchState != switchState) {
        setSwitchState(newSwitchState);
    }
}
Also used : OnOffValue(org.openhab.binding.tinkerforge.internal.types.OnOffValue) DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue)

Example 49 with DecimalValue

use of org.openhab.binding.tinkerforge.internal.types.DecimalValue in project openhab1-addons by openhab.

the class JoystickXPositionImpl method setSensorValue.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated
     */
@Override
public void setSensorValue(DecimalValue newSensorValue) {
    DecimalValue oldSensorValue = sensorValue;
    sensorValue = newSensorValue;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.JOYSTICK_XPOSITION__SENSOR_VALUE, oldSensorValue, sensorValue));
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 50 with DecimalValue

use of org.openhab.binding.tinkerforge.internal.types.DecimalValue in project openhab1-addons by openhab.

the class JoystickXPositionImpl method fetchSensorValue.

/**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void fetchSensorValue() {
    try {
        Position position = tinkerforgeDevice.getPosition();
        DecimalValue value = Tools.calculate(position.x);
        setSensorValue(value);
    } catch (TimeoutException e) {
        TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
    } catch (NotConnectedException e) {
        TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
    }
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) NotConnectedException(com.tinkerforge.NotConnectedException) Position(com.tinkerforge.BrickletJoystick.Position) JoystickXPosition(org.openhab.binding.tinkerforge.internal.model.JoystickXPosition) TimeoutException(com.tinkerforge.TimeoutException)

Aggregations

DecimalValue (org.openhab.binding.tinkerforge.internal.types.DecimalValue)92 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)51 NotConnectedException (com.tinkerforge.NotConnectedException)36 TimeoutException (com.tinkerforge.TimeoutException)36 OnOffValue (org.openhab.binding.tinkerforge.internal.types.OnOffValue)3 Position (com.tinkerforge.BrickletJoystick.Position)2 BigDecimal (java.math.BigDecimal)2 Acceleration (com.tinkerforge.BrickletAccelerometer.Acceleration)1 TinkerforgeBindingProvider (org.openhab.binding.tinkerforge.TinkerforgeBindingProvider)1 JoystickXPosition (org.openhab.binding.tinkerforge.internal.model.JoystickXPosition)1 JoystickYPosition (org.openhab.binding.tinkerforge.internal.model.JoystickYPosition)1 DirectionValue (org.openhab.binding.tinkerforge.internal.types.DirectionValue)1 HSBValue (org.openhab.binding.tinkerforge.internal.types.HSBValue)1 HighLowValue (org.openhab.binding.tinkerforge.internal.types.HighLowValue)1 PercentValue (org.openhab.binding.tinkerforge.internal.types.PercentValue)1 ColorItem (org.openhab.core.library.items.ColorItem)1 ContactItem (org.openhab.core.library.items.ContactItem)1 DimmerItem (org.openhab.core.library.items.DimmerItem)1 NumberItem (org.openhab.core.library.items.NumberItem)1 RollershutterItem (org.openhab.core.library.items.RollershutterItem)1