use of com.tinkerforge.TimeoutException in project openhab1-addons by openhab.
the class IndustrialDualAnalogInChannelImpl method fetchSensorValue.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void fetchSensorValue() {
try {
int voltage = tinkerforgeDevice.getVoltage(getChannelNum());
DecimalValue value = Tools.calculate(voltage);
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 JoystickButtonImpl method fetchSensorValue.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void fetchSensorValue() {
if (tactile || this.sensorValue == null || this.sensorValue == OnOffValue.UNDEF) {
try {
OnOffValue value = tinkerforgeDevice.isPressed() ? OnOffValue.ON : OnOffValue.OFF;
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);
}
} else {
// send current state to update the eventbus
setSensorValue(getSensorValue());
}
}
use of com.tinkerforge.TimeoutException in project openhab1-addons by openhab.
the class MBrickletIO4Impl method enable.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void enable() {
if (tfConfig != null) {
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("debouncePeriod"))) {
setDebouncePeriod(tfConfig.getDebouncePeriod());
}
}
try {
tinkerforgeDevice = new BrickletIO4(getUid(), getIpConnection());
logger.debug("{} BrickletIO4 setting debouncePeriod to {}", LoggerConstants.TFINIT, getDebouncePeriod());
tinkerforgeDevice.setDebouncePeriod(getDebouncePeriod());
tinkerforgeDevice.setInterrupt((short) 15);
} 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 MBrickletIndustrialDigitalIn4Impl method enable.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void enable() {
logger.debug("{} enable called on MBrickletIndustrialDigitalIn4", LoggerConstants.TFINIT);
tinkerforgeDevice = new BrickletIndustrialDigitalIn4(getUid(), getIpConnection());
if (tfConfig != null) {
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("debouncePeriod"))) {
setDebouncePeriod(tfConfig.getDebouncePeriod());
}
}
try {
tinkerforgeDevice.setResponseExpectedAll(true);
logger.debug("{} BrickletIndustrialDigital4In setting debouncePeriod to {}", LoggerConstants.TFINIT, getDebouncePeriod());
tinkerforgeDevice.setDebouncePeriod(getDebouncePeriod());
tinkerforgeDevice.setInterrupt(15);
} 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 MBrickletHumidityImpl method enable.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void enable() {
tinkerforgeDevice = new BrickletHumidity(uid, ipConnection);
if (tfConfig != null) {
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("threshold"))) {
setThreshold(tfConfig.getThreshold());
}
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
setCallbackPeriod(tfConfig.getCallbackPeriod());
}
}
try {
tinkerforgeDevice.setResponseExpected(BrickletHumidity.FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD, false);
tinkerforgeDevice.setHumidityCallbackPeriod(callbackPeriod);
listener = new HumidityListener();
tinkerforgeDevice.addHumidityListener(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