Search in sources :

Example 76 with NotConnectedException

use of com.tinkerforge.NotConnectedException in project openhab1-addons by openhab.

the class MBrickletTemperatureImpl method fetchSensorValue.

/**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void fetchSensorValue() {
    try {
        short temperature = tinkerforgeDevice.getTemperature();
        DecimalValue value = Tools.calculate100(temperature);
        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);
    }
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) NotConnectedException(com.tinkerforge.NotConnectedException) TimeoutException(com.tinkerforge.TimeoutException)

Example 77 with NotConnectedException

use of com.tinkerforge.NotConnectedException in project openhab1-addons by openhab.

the class VCDeviceCurrentImpl method fetchSensorValue.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void fetchSensorValue() {
    try {
        int current = tinkerforgeDevice.getCurrent();
        DecimalValue value = Tools.calculate(current);
        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);
    }
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) NotConnectedException(com.tinkerforge.NotConnectedException) TimeoutException(com.tinkerforge.TimeoutException)

Example 78 with NotConnectedException

use of com.tinkerforge.NotConnectedException in project openhab1-addons by openhab.

the class VCDevicePowerImpl method fetchSensorValue.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void fetchSensorValue() {
    try {
        int power = tinkerforgeDevice.getPower();
        DecimalValue value = Tools.calculate(power);
        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);
    }
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) NotConnectedException(com.tinkerforge.NotConnectedException) TimeoutException(com.tinkerforge.TimeoutException)

Example 79 with NotConnectedException

use of com.tinkerforge.NotConnectedException in project openhab1-addons by openhab.

the class AmbientTemperatureImpl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void enable() {
    if (tfConfig != null) {
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("threshold"))) {
            setThreshold(tfConfig.getThreshold());
        }
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
            setCallbackPeriod(tfConfig.getCallbackPeriod());
        }
    }
    thresholdBigDecimal = new BigDecimal(String.valueOf(getThreshold()));
    BrickletTemperatureIR tinkerforgeDevice = getMbrick().getTinkerforgeDevice();
    tinkerforgeDevice.setResponseExpected(BrickletTemperatureIR.FUNCTION_SET_AMBIENT_TEMPERATURE_CALLBACK_PERIOD, false);
    try {
        tinkerforgeDevice.setAmbientTemperatureCallbackPeriod(getCallbackPeriod());
    } catch (TimeoutException e) {
        TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
    } catch (NotConnectedException e) {
        TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
    }
    temperatureListener = new AmbientTemperatureListener();
    tinkerforgeDevice.addAmbientTemperatureListener(temperatureListener);
    fetchSensorValue();
}
Also used : BrickletTemperatureIR(com.tinkerforge.BrickletTemperatureIR) MBrickletTemperatureIR(org.openhab.binding.tinkerforge.internal.model.MBrickletTemperatureIR) NotConnectedException(com.tinkerforge.NotConnectedException) BigDecimal(java.math.BigDecimal) TimeoutException(com.tinkerforge.TimeoutException)

Example 80 with NotConnectedException

use of com.tinkerforge.NotConnectedException in project openhab1-addons by openhab.

the class ColorColorImpl method fetchSensorValue.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void fetchSensorValue() {
    try {
        com.tinkerforge.BrickletColor.Color color = tinkerforgeDevice.getColor();
        setSensorValue(new HSBValue(new HSBType(new Color(getRGBValue(color.r), getRGBValue(color.g), getRGBValue(color.b)))));
    } catch (TimeoutException e) {
        TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_TIMEOUT_EXCEPTION, e);
    } catch (NotConnectedException e) {
        TinkerforgeErrorHandler.handleError(this, TinkerforgeErrorHandler.TF_NOT_CONNECTION_EXCEPTION, e);
    }
}
Also used : NotConnectedException(com.tinkerforge.NotConnectedException) MBrickletColor(org.openhab.binding.tinkerforge.internal.model.MBrickletColor) BrickletColor(com.tinkerforge.BrickletColor) Color(java.awt.Color) ColorColor(org.openhab.binding.tinkerforge.internal.model.ColorColor) MBrickletColor(org.openhab.binding.tinkerforge.internal.model.MBrickletColor) BrickletColor(com.tinkerforge.BrickletColor) HSBValue(org.openhab.binding.tinkerforge.internal.types.HSBValue) HSBType(org.openhab.core.library.types.HSBType) TimeoutException(com.tinkerforge.TimeoutException)

Aggregations

NotConnectedException (com.tinkerforge.NotConnectedException)107 TimeoutException (com.tinkerforge.TimeoutException)107 DecimalValue (org.openhab.binding.tinkerforge.internal.types.DecimalValue)36 HighLowValue (org.openhab.binding.tinkerforge.internal.types.HighLowValue)14 OnOffValue (org.openhab.binding.tinkerforge.internal.types.OnOffValue)8 BigDecimal (java.math.BigDecimal)4 Color (java.awt.Color)3 BrickServo (com.tinkerforge.BrickServo)2 BrickletColor (com.tinkerforge.BrickletColor)2 LEDState (com.tinkerforge.BrickletDualButton.LEDState)2 BrickletIO16 (com.tinkerforge.BrickletIO16)2 BrickletIO4 (com.tinkerforge.BrickletIO4)2 Position (com.tinkerforge.BrickletJoystick.Position)2 BrickletMultiTouch (com.tinkerforge.BrickletMultiTouch)2 BrickletTemperatureIR (com.tinkerforge.BrickletTemperatureIR)2 HashMap (java.util.HashMap)2 ConfigurationException (org.openhab.binding.tinkerforge.internal.config.ConfigurationException)2 MBrickletIO16 (org.openhab.binding.tinkerforge.internal.model.MBrickletIO16)2 MBrickletIO4 (org.openhab.binding.tinkerforge.internal.model.MBrickletIO4)2 LinePositionText (org.openhab.binding.tinkerforge.internal.tools.LinePositionText)2