Search in sources :

Example 1 with BrickletHumidity

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

the class MBrickletHumidityImpl method setTinkerforgeDevice.

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

Example 2 with BrickletHumidity

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

the class MBrickletHumidityImpl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void enable() {
    tinkerforgeDevice = new BrickletHumidity(uid, ipConnection);
    if (tfConfig != null) {
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("threshold"))) {
            setThreshold(tfConfig.getThreshold());
        }
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
            setCallbackPeriod(tfConfig.getCallbackPeriod());
        }
    }
    try {
        tinkerforgeDevice.setResponseExpected(BrickletHumidity.FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD, false);
        tinkerforgeDevice.setHumidityCallbackPeriod(callbackPeriod);
        listener = new HumidityListener();
        tinkerforgeDevice.addHumidityListener(listener);
        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 : MBrickletHumidity(org.openhab.binding.tinkerforge.internal.model.MBrickletHumidity) BrickletHumidity(com.tinkerforge.BrickletHumidity) NotConnectedException(com.tinkerforge.NotConnectedException) TimeoutException(com.tinkerforge.TimeoutException)

Aggregations

BrickletHumidity (com.tinkerforge.BrickletHumidity)2 MBrickletHumidity (org.openhab.binding.tinkerforge.internal.model.MBrickletHumidity)2 NotConnectedException (com.tinkerforge.NotConnectedException)1 TimeoutException (com.tinkerforge.TimeoutException)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1