use of com.tinkerforge.NotConnectedException in project openhab1-addons by openhab.
the class MBrickletAccelerometerImpl method enable.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void enable() {
if (tfConfig != null) {
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("dataRate"))) {
Short dataRate = tfConfig.getDataRate();
logger.debug("dataRate {}", dataRate);
setDataRate(dataRate);
}
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("fullScale"))) {
Short fullScale = tfConfig.getFullScale();
logger.debug("fullScale {}", fullScale);
setFullScale(fullScale);
}
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("filterBandwidth"))) {
Short filterBandwidth = tfConfig.getFilterBandwidth();
logger.debug("filterBandwidth {}", filterBandwidth);
setFilterBandwidth(filterBandwidth);
}
}
try {
tinkerforgeDevice = new BrickletAccelerometer(getUid(), getIpConnection());
tinkerforgeDevice.setConfiguration(getDataRate(), getFullScale(), getFilterBandwidth());
} 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.NotConnectedException in project openhab1-addons by openhab.
the class MBrickletAnalogInImpl method fetchSensorValue.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void fetchSensorValue() {
try {
int voltage = tinkerforgeDevice.getVoltage();
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.NotConnectedException in project openhab1-addons by openhab.
the class MBrickletAnalogInV2Impl method fetchSensorValue.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void fetchSensorValue() {
try {
int voltage = tinkerforgeDevice.getVoltage();
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.NotConnectedException in project openhab1-addons by openhab.
the class MBrickletOLED128x64Impl method write.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void write(String linePositionText) {
try {
LinePositionText linePostion = Tools.parseLinePostion(linePositionText, positionPrefix, positionSuffix, 1, 2, maxLine, maxColumn);
tinkerforgeDevice.writeLine(linePostion.getLine(), linePostion.getPosition(), linePostion.getText());
} catch (LinePositionParseException e) {
logger.error("faulty input text", e);
} 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.NotConnectedException in project openhab1-addons by openhab.
the class MBrickletOLED128x64Impl method enable.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated NOT
*/
@Override
public void enable() {
if (tfConfig != null) {
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("contrast"))) {
Short contrast = tfConfig.getContrast();
logger.debug("contrast {}", contrast);
setContrast(contrast);
}
if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("invert"))) {
boolean invert = tfConfig.isInvert();
logger.debug("invert {}", invert);
setInvert(invert);
}
}
try {
tinkerforgeDevice = new BrickletOLED128x64(getUid(), getIpConnection());
tinkerforgeDevice.setDisplayConfiguration(getContrast(), isInvert());
} catch (TimeoutException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
} catch (NotConnectedException e) {
TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
}
}
Aggregations