Search in sources :

Example 1 with DecimalValue

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

the class AccelerometerTemperatureImpl method fetchSensorValue.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void fetchSensorValue() {
    try {
        short temperature = tinkerforgeDevice.getTemperature();
        DecimalValue value = Tools.calculate(temperature);
        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) TimeoutException(com.tinkerforge.TimeoutException)

Example 2 with DecimalValue

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

the class AccelerometerTemperatureImpl 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.ACCELEROMETER_TEMPERATURE__SENSOR_VALUE, oldSensorValue, sensorValue));
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 3 with DecimalValue

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

the class AmbientTemperatureImpl method calculateTemperature.

/**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * 
     * @generated NOT
     */
private DecimalValue calculateTemperature(short temperature) {
    BigDecimal bigdecimal_temperature = new BigDecimal(String.valueOf(temperature)).divide(BigDecimal.TEN);
    DecimalValue value = new DecimalValue(bigdecimal_temperature);
    return value;
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) BigDecimal(java.math.BigDecimal)

Example 4 with DecimalValue

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

the class AmbientTemperatureImpl method fetchSensorValue.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void fetchSensorValue() {
    try {
        short temperature = getMbrick().getTinkerforgeDevice().getAmbientTemperature();
        DecimalValue value = calculateTemperature(temperature);
        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) TimeoutException(com.tinkerforge.TimeoutException)

Example 5 with DecimalValue

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

the class VCDevicePowerImpl 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.VC_DEVICE_POWER__SENSOR_VALUE, oldSensorValue, sensorValue));
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

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