use of org.openhab.binding.tinkerforge.internal.model.MBrickletMultiTouch in project openhab1-addons by openhab.
the class MultiTouchDeviceImpl method enable.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void enable() {
if (tfConfig != null) {
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("disableElectrode"))) {
if (tfConfig.getDisableElectrode()) {
logger.debug("{} MultiTouchDevice uid {} subid {} disable electrode {}", LoggerConstants.TFINIT, getUid(), getSubId(), getPin());
setDisableElectrode(true);
}
}
}
MBrickletMultiTouch bricklet = getMbrick();
if (bricklet == null) {
logger.error("{} No bricklet found for MultiTouchDevice: {}:{} ", LoggerConstants.TFINIT, getUid(), subId);
} else {
try {
BrickletMultiTouch brickletMultiTouch = bricklet.getTinkerforgeDevice();
if (getDisableElectrode() != null && getDisableElectrode()) {
logger.debug("{} MultiTouchDevice uid {} subid {} disabling electrode {}", LoggerConstants.TFINIT, getUid(), getSubId(), getPin());
getEnabledA().set(false);
int electrodeConfig = brickletMultiTouch.getElectrodeConfig();
electrodeConfig &= ~mask;
brickletMultiTouch.setElectrodeConfig(electrodeConfig);
return;
}
setSensorValue(HighLowValue.UNDEF);
touchListener = new TouchListener();
brickletMultiTouch.addTouchStateListener(touchListener);
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