Search in sources :

Example 1 with BrickletVoltageCurrent

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

the class MBrickletVoltageCurrentImpl method setTinkerforgeDevice.

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

Example 2 with BrickletVoltageCurrent

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

the class MBrickletVoltageCurrentImpl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void enable() {
    if (tfConfig != null) {
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("averaging"))) {
            setAveraging(tfConfig.getAveraging());
            logger.debug("{} VoltageCurrent uid {} averaging {}", LoggerConstants.TFINIT, getUid(), getAveraging());
        }
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("voltageConversionTime"))) {
            setVoltageConversionTime(tfConfig.getVoltageConversionTime());
            logger.debug("{} VoltageCurrent uid {} voltageConversionTime {}", LoggerConstants.TFINIT, getUid(), getVoltageConversionTime());
        }
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("currentConversionTime"))) {
            setVoltageConversionTime(tfConfig.getCurrentConversionTime());
            logger.debug("{} VoltageCurrent uid {} currentConversionTime {}", LoggerConstants.TFINIT, getUid(), getCurrentConversionTime());
        }
    }
    tinkerforgeDevice = new BrickletVoltageCurrent(getUid(), getIpConnection());
    try {
        tinkerforgeDevice.setConfiguration(getAveraging(), getVoltageConversionTime(), getCurrentConversionTime());
    } 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) BrickletVoltageCurrent(com.tinkerforge.BrickletVoltageCurrent) MBrickletVoltageCurrent(org.openhab.binding.tinkerforge.internal.model.MBrickletVoltageCurrent) TimeoutException(com.tinkerforge.TimeoutException)

Aggregations

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