use of com.tinkerforge.BrickletCO2 in project openhab1-addons by openhab.
the class MBrickletCO2Impl method setTinkerforgeDevice.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setTinkerforgeDevice(BrickletCO2 newTinkerforgeDevice) {
BrickletCO2 oldTinkerforgeDevice = tinkerforgeDevice;
tinkerforgeDevice = newTinkerforgeDevice;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBRICKLET_CO2__TINKERFORGE_DEVICE, oldTinkerforgeDevice, tinkerforgeDevice));
}
use of com.tinkerforge.BrickletCO2 in project openhab1-addons by openhab.
the class MBrickletCO2Impl 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 BrickletCO2(getUid(), getIpConnection());
tinkerforgeDevice.setCO2ConcentrationCallbackPeriod(getCallbackPeriod());
listener = new CO2ConcentrationListener();
tinkerforgeDevice.addCO2ConcentrationListener(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);
}
}
Aggregations