use of com.tinkerforge.TimeoutException in project openhab1-addons by openhab.
the class MBrickletMotionDetectorImpl method fetchSensorValue.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void fetchSensorValue() {
HighLowValue value = HighLowValue.UNDEF;
try {
short motionDetected = tinkerforgeDevice.getMotionDetected();
if (motionDetected == 1) {
value = HighLowValue.HIGH;
} else {
value = HighLowValue.LOW;
}
setSensorValue(value);
} catch (TimeoutException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
} catch (NotConnectedException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
}
}
use of com.tinkerforge.TimeoutException in project openhab1-addons by openhab.
the class MBrickletLaserRangeFinderImpl method enable.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void enable() {
if (tfConfig != null) {
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("distanceAverageLength"))) {
Short distanceAverageLength = tfConfig.getDistanceAverageLength();
logger.debug("distanceAverageLength {}", distanceAverageLength);
setDistanceAverageLength(distanceAverageLength);
}
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("velocityAverageLength"))) {
Short velocityAverageLength = tfConfig.getVelocityAverageLength();
logger.debug("velocityAverageLength {}", velocityAverageLength);
setVelocityAverageLength(velocityAverageLength);
}
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("mode"))) {
Short mode = tfConfig.getMode();
logger.debug("mode {}", mode);
setMode(mode);
}
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("enableLaserOnStartup"))) {
boolean enableLaser = tfConfig.getEnableLaserOnStartup();
logger.debug("enable laser on startup {}", enableLaser);
setEnableLaserOnStartup(enableLaser);
} else {
boolean enableLaser = tfConfig.getEnableLaserOnStartup();
logger.debug("enable laser on startup {}", enableLaser);
}
}
try {
tinkerforgeDevice = new BrickletLaserRangeFinder(getUid(), getIpConnection());
tinkerforgeDevice.setMode(getMode());
tinkerforgeDevice.setMovingAverage(getDistanceAverageLength(), getVelocityAverageLength());
if (getEnableLaserOnStartup()) {
logger.debug("enabling laser");
tinkerforgeDevice.enableLaser();
}
} catch (TimeoutException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
} catch (NotConnectedException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
}
}
use of com.tinkerforge.TimeoutException 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);
}
}
use of com.tinkerforge.TimeoutException in project openhab1-addons by openhab.
the class MBrickletLinearPotiImpl method fetchSensorValue.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void fetchSensorValue() {
try {
int position = tinkerforgeDevice.getPosition();
DecimalValue value = Tools.calculate(position);
setSensorValue(value);
} catch (TimeoutException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
} catch (NotConnectedException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
}
}
use of com.tinkerforge.TimeoutException in project openhab1-addons by openhab.
the class MBrickletMoistureImpl method fetchSensorValue.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void fetchSensorValue() {
try {
int moisture = tinkerforgeDevice.getMoistureValue();
DecimalValue value = Tools.calculate(moisture);
setSensorValue(value);
} catch (TimeoutException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
} catch (NotConnectedException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
}
}
Aggregations