Search in sources :

Example 91 with NotConnectedException

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);
    }
}
Also used : NotConnectedException(com.tinkerforge.NotConnectedException) MBrickletAccelerometer(org.openhab.binding.tinkerforge.internal.model.MBrickletAccelerometer) BrickletAccelerometer(com.tinkerforge.BrickletAccelerometer) TimeoutException(com.tinkerforge.TimeoutException)

Example 92 with NotConnectedException

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);
    }
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) NotConnectedException(com.tinkerforge.NotConnectedException) TimeoutException(com.tinkerforge.TimeoutException)

Example 93 with NotConnectedException

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);
    }
}
Also used : DecimalValue(org.openhab.binding.tinkerforge.internal.types.DecimalValue) NotConnectedException(com.tinkerforge.NotConnectedException) TimeoutException(com.tinkerforge.TimeoutException)

Example 94 with NotConnectedException

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);
    }
}
Also used : LinePositionParseException(org.openhab.binding.tinkerforge.internal.tools.Tools.LinePositionParseException) NotConnectedException(com.tinkerforge.NotConnectedException) LinePositionText(org.openhab.binding.tinkerforge.internal.tools.LinePositionText) TimeoutException(com.tinkerforge.TimeoutException)

Example 95 with NotConnectedException

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);
    }
}
Also used : NotConnectedException(com.tinkerforge.NotConnectedException) BrickletOLED128x64(com.tinkerforge.BrickletOLED128x64) MBrickletOLED128x64(org.openhab.binding.tinkerforge.internal.model.MBrickletOLED128x64) 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