Search in sources :

Example 1 with BrickletAccelerometer

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

the class MBrickletAccelerometerImpl method setTinkerforgeDevice.

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

Example 2 with BrickletAccelerometer

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

the class MBrickletAccelerometerImpl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void enable() {
    if (tfConfig != null) {
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("dataRate"))) {
            Short dataRate = tfConfig.getDataRate();
            logger.debug("dataRate {}", dataRate);
            setDataRate(dataRate);
        }
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("fullScale"))) {
            Short fullScale = tfConfig.getFullScale();
            logger.debug("fullScale {}", fullScale);
            setFullScale(fullScale);
        }
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("filterBandwidth"))) {
            Short filterBandwidth = tfConfig.getFilterBandwidth();
            logger.debug("filterBandwidth {}", filterBandwidth);
            setFilterBandwidth(filterBandwidth);
        }
    }
    try {
        tinkerforgeDevice = new BrickletAccelerometer(getUid(), getIpConnection());
        tinkerforgeDevice.setConfiguration(getDataRate(), getFullScale(), getFilterBandwidth());
    } 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) MBrickletAccelerometer(org.openhab.binding.tinkerforge.internal.model.MBrickletAccelerometer) BrickletAccelerometer(com.tinkerforge.BrickletAccelerometer) TimeoutException(com.tinkerforge.TimeoutException)

Aggregations

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