Search in sources :

Example 1 with BrickletDistanceIR

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

the class MBrickletDistanceIRImpl method setTinkerforgeDevice.

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

Example 2 with BrickletDistanceIR

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

the class MBrickletDistanceIRImpl 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());
        }
    }
    tinkerforgeDevice = new BrickletDistanceIR(uid, ipConnection);
    tinkerforgeDevice.setResponseExpected(BrickletDistanceIR.FUNCTION_SET_DISTANCE_CALLBACK_PERIOD, false);
    try {
        tinkerforgeDevice.setDistanceCallbackPeriod(callbackPeriod);
        listener = new DistanceListener();
        tinkerforgeDevice.addDistanceListener(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 : NotConnectedException(com.tinkerforge.NotConnectedException) MBrickletDistanceIR(org.openhab.binding.tinkerforge.internal.model.MBrickletDistanceIR) BrickletDistanceIR(com.tinkerforge.BrickletDistanceIR) TimeoutException(com.tinkerforge.TimeoutException)

Aggregations

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