Search in sources :

Example 1 with BrickletHallEffect

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

the class MBrickletHallEffectImpl method setTinkerforgeDevice.

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

Example 2 with BrickletHallEffect

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

the class MBrickletHallEffectImpl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void enable() {
    logger.trace("enabling");
    setCallbackPeriod(1);
    if (tfConfig != null) {
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
            logger.trace("got callback period {}", tfConfig.getCallbackPeriod());
            setCallbackPeriod(tfConfig.getCallbackPeriod());
        }
    }
    try {
        tinkerforgeDevice = new BrickletHallEffect(getUid(), getIpConnection());
        tinkerforgeDevice.setEdgeCountCallbackPeriod(getCallbackPeriod());
        listener = new EdgeCountListener();
        logger.trace("adding listener");
        tinkerforgeDevice.addEdgeCountListener(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) BrickletHallEffect(com.tinkerforge.BrickletHallEffect) MBrickletHallEffect(org.openhab.binding.tinkerforge.internal.model.MBrickletHallEffect) TimeoutException(com.tinkerforge.TimeoutException)

Aggregations

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