Search in sources :

Example 31 with TimeoutException

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

the class MBrickletUVLightImpl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     *
     * @generated NOT
     */
@Override
public void enable() {
    if (tfConfig != null) {
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("threshold"))) {
            logger.debug("threshold {}", tfConfig.getThreshold());
            setThreshold(tfConfig.getThreshold());
        }
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("callbackPeriod"))) {
            logger.debug("callbackPeriod {}", tfConfig.getCallbackPeriod());
            setCallbackPeriod(tfConfig.getCallbackPeriod());
        }
    }
    try {
        tinkerforgeDevice = new BrickletUVLight(getUid(), getIpConnection());
        tinkerforgeDevice.setUVLightCallbackPeriod(getCallbackPeriod());
        listener = new UVLightListener();
        tinkerforgeDevice.addUVLightListener(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);
    }
}
Also used : NotConnectedException(com.tinkerforge.NotConnectedException) MBrickletUVLight(org.openhab.binding.tinkerforge.internal.model.MBrickletUVLight) BrickletUVLight(com.tinkerforge.BrickletUVLight) TimeoutException(com.tinkerforge.TimeoutException)

Example 32 with TimeoutException

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

the class MBrickletUVLightImpl method fetchSensorValue.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     *
     * @generated NOT
     */
@Override
public void fetchSensorValue() {
    try {
        long uvLight = tinkerforgeDevice.getUVLight();
        DecimalValue value = Tools.calculate(uvLight);
        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 33 with TimeoutException

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

the class DigitalActorIO4Impl method fetchDigitalValue.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     *
     * @generated NOT
     */
@Override
public void fetchDigitalValue() {
    HighLowValue pinValue = HighLowValue.UNDEF;
    try {
        pinValue = extractValue(getMbrick().getTinkerforgeDevice().getValue());
        setDigitalState(pinValue);
    } 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) HighLowValue(org.openhab.binding.tinkerforge.internal.types.HighLowValue) TimeoutException(com.tinkerforge.TimeoutException)

Example 34 with TimeoutException

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

the class DigitalSensorIO4Impl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     *
     * @generated NOT
     */
@Override
public void enable() {
    logger.debug("{} enable called on DigitalSensorIO4 {}", LoggerConstants.TFINIT, getSubId());
    setSensorValue(HighLowValue.UNDEF);
    if (tfConfig != null) {
        logger.debug("{} found config for DigitalSensor {}", LoggerConstants.TFINIT, getSubId());
        setPullUpResistorEnabled(tfConfig.isPullUpResistorEnabled());
        logger.debug("{} pull-up resistor state is {} for {}", LoggerConstants.TFINIT, isPullUpResistorEnabled(), getSubId());
    }
    MBrickletIO4 bricklet = getMbrick();
    if (bricklet == null) {
        logger.error("{} No bricklet found for DigitalSensor: {} ", LoggerConstants.TFINIT, subId);
    } else {
        BrickletIO4 brickletIO4 = bricklet.getTinkerforgeDevice();
        try {
            logger.debug("{} setting InterruptListener for DigitalSensorIO4: {} ", LoggerConstants.TFINIT, subId);
            listener = new InterruptListener();
            brickletIO4.addInterruptListener(listener);
            brickletIO4.setConfiguration((short) mask, BrickletIO4.DIRECTION_IN, isPullUpResistorEnabled());
            fetchSensorValue();
        } 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) MBrickletIO4(org.openhab.binding.tinkerforge.internal.model.MBrickletIO4) BrickletIO4(com.tinkerforge.BrickletIO4) MBrickletIO4(org.openhab.binding.tinkerforge.internal.model.MBrickletIO4) TimeoutException(com.tinkerforge.TimeoutException)

Example 35 with TimeoutException

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

the class DigitalSensorImpl method fetchSensorValue.

/**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void fetchSensorValue() {
    HighLowValue value = HighLowValue.UNDEF;
    try {
        value = extractValue(getMbrick().getTinkerforgeDevice().getPort(getPort()));
        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 : NotConnectedException(com.tinkerforge.NotConnectedException) HighLowValue(org.openhab.binding.tinkerforge.internal.types.HighLowValue) 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