Search in sources :

Example 1 with BrickletAmbientLight

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

the class MBrickletAmbientLightImpl 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 BrickletAmbientLight(uid, ipConnection);
    // false);
    try {
        tinkerforgeDevice.setIlluminanceCallbackPeriod(callbackPeriod);
        listener = new IlluminanceListener();
        tinkerforgeDevice.addIlluminanceListener(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) BrickletAmbientLight(com.tinkerforge.BrickletAmbientLight) MBrickletAmbientLight(org.openhab.binding.tinkerforge.internal.model.MBrickletAmbientLight) TimeoutException(com.tinkerforge.TimeoutException)

Example 2 with BrickletAmbientLight

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

the class MBrickletAmbientLightImpl method setTinkerforgeDevice.

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

Aggregations

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