Search in sources :

Example 1 with BrickletTemperatureIR

use of com.tinkerforge.BrickletTemperatureIR in project openhab1-addons by openhab.

the class ObjectTemperatureImpl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void enable() {
    if (tfConfig != null) {
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("threshold"))) {
            setThreshold(tfConfig.getThreshold());
        }
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
            setCallbackPeriod(tfConfig.getCallbackPeriod());
        }
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("emissivity"))) {
            setEmissivity(tfConfig.getEmissivity());
        }
    }
    thresholdBigDecimal = new BigDecimal(String.valueOf(getThreshold()));
    BrickletTemperatureIR tinkerforgeDevice = getMbrick().getTinkerforgeDevice();
    tinkerforgeDevice.setResponseExpected(BrickletTemperatureIR.FUNCTION_SET_OBJECT_TEMPERATURE_CALLBACK_PERIOD, false);
    try {
        tinkerforgeDevice.setObjectTemperatureCallbackPeriod(getCallbackPeriod());
        tinkerforgeDevice.setEmissivity(getEmissivity());
        temperatureListener = new ObjectTemperatureListener();
        tinkerforgeDevice.addObjectTemperatureListener(temperatureListener);
        fetchSensorValue();
    } 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 : BrickletTemperatureIR(com.tinkerforge.BrickletTemperatureIR) MBrickletTemperatureIR(org.openhab.binding.tinkerforge.internal.model.MBrickletTemperatureIR) NotConnectedException(com.tinkerforge.NotConnectedException) BigDecimal(java.math.BigDecimal) TimeoutException(com.tinkerforge.TimeoutException)

Example 2 with BrickletTemperatureIR

use of com.tinkerforge.BrickletTemperatureIR in project openhab1-addons by openhab.

the class AmbientTemperatureImpl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void enable() {
    if (tfConfig != null) {
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("threshold"))) {
            setThreshold(tfConfig.getThreshold());
        }
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
            setCallbackPeriod(tfConfig.getCallbackPeriod());
        }
    }
    thresholdBigDecimal = new BigDecimal(String.valueOf(getThreshold()));
    BrickletTemperatureIR tinkerforgeDevice = getMbrick().getTinkerforgeDevice();
    tinkerforgeDevice.setResponseExpected(BrickletTemperatureIR.FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_PERIOD, false);
    try {
        tinkerforgeDevice.setAmbientTemperatureCallbackPeriod(getCallbackPeriod());
    } catch (TimeoutException e) {
        TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
    } catch (NotConnectedException e) {
        TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
    }
    temperatureListener = new AmbientTemperatureListener();
    tinkerforgeDevice.addAmbientTemperatureListener(temperatureListener);
    fetchSensorValue();
}
Also used : BrickletTemperatureIR(com.tinkerforge.BrickletTemperatureIR) MBrickletTemperatureIR(org.openhab.binding.tinkerforge.internal.model.MBrickletTemperatureIR) NotConnectedException(com.tinkerforge.NotConnectedException) BigDecimal(java.math.BigDecimal) TimeoutException(com.tinkerforge.TimeoutException)

Example 3 with BrickletTemperatureIR

use of com.tinkerforge.BrickletTemperatureIR in project openhab1-addons by openhab.

the class MBrickletTemperatureIRImpl method setTinkerforgeDevice.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated
     */
@Override
public void setTinkerforgeDevice(BrickletTemperatureIR newTinkerforgeDevice) {
    BrickletTemperatureIR oldTinkerforgeDevice = tinkerforgeDevice;
    tinkerforgeDevice = newTinkerforgeDevice;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBRICKLET_TEMPERATURE_IR__TINKERFORGE_DEVICE, oldTinkerforgeDevice, tinkerforgeDevice));
}
Also used : BrickletTemperatureIR(com.tinkerforge.BrickletTemperatureIR) MBrickletTemperatureIR(org.openhab.binding.tinkerforge.internal.model.MBrickletTemperatureIR) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Aggregations

BrickletTemperatureIR (com.tinkerforge.BrickletTemperatureIR)3 MBrickletTemperatureIR (org.openhab.binding.tinkerforge.internal.model.MBrickletTemperatureIR)3 NotConnectedException (com.tinkerforge.NotConnectedException)2 TimeoutException (com.tinkerforge.TimeoutException)2 BigDecimal (java.math.BigDecimal)2 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1