Search in sources :

Example 1 with BrickletUVLight

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

the class MBrickletUVLightImpl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     *
     * @generated NOT
     */
@Override
public void enable() {
    if (tfConfig != null) {
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("threshold"))) {
            logger.debug("threshold {}", tfConfig.getThreshold());
            setThreshold(tfConfig.getThreshold());
        }
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
            logger.debug("callbackPeriod {}", tfConfig.getCallbackPeriod());
            setCallbackPeriod(tfConfig.getCallbackPeriod());
        }
    }
    try {
        tinkerforgeDevice = new BrickletUVLight(getUid(), getIpConnection());
        tinkerforgeDevice.setUVLightCallbackPeriod(getCallbackPeriod());
        listener = new UVLightListener();
        tinkerforgeDevice.addUVLightListener(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) MBrickletUVLight(org.openhab.binding.tinkerforge.internal.model.MBrickletUVLight) BrickletUVLight(com.tinkerforge.BrickletUVLight) TimeoutException(com.tinkerforge.TimeoutException)

Example 2 with BrickletUVLight

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

the class MBrickletUVLightImpl method setTinkerforgeDevice.

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

Aggregations

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