Search in sources :

Example 1 with BrickletLinearPoti

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

the class MBrickletLinearPotiImpl method setTinkerforgeDevice.

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

Example 2 with BrickletLinearPoti

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

the class MBrickletLinearPotiImpl method enable.

/**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void enable() {
    setCallbackPeriod(10);
    if (tfConfig != null) {
        logger.trace("got configuration");
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
            logger.trace("found callbackPeriod");
            setCallbackPeriod(tfConfig.getCallbackPeriod());
        }
    }
    logger.trace("callbackPeriod is {}", getCallbackPeriod());
    tinkerforgeDevice = new BrickletLinearPoti(getUid(), getIpConnection());
    listener = new PositionListener();
    tinkerforgeDevice.addPositionListener(listener);
    fetchSensorValue();
    try {
        tinkerforgeDevice.setPositionCallbackPeriod(getCallbackPeriod());
    } 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) BrickletLinearPoti(com.tinkerforge.BrickletLinearPoti) MBrickletLinearPoti(org.openhab.binding.tinkerforge.internal.model.MBrickletLinearPoti) TimeoutException(com.tinkerforge.TimeoutException)

Aggregations

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