Search in sources :

Example 1 with OnOffValue

use of org.openhab.binding.tinkerforge.internal.types.OnOffValue in project openhab1-addons by openhab.

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

Example 2 with OnOffValue

use of org.openhab.binding.tinkerforge.internal.types.OnOffValue in project openhab1-addons by openhab.

the class DualButtonButtonImpl method setSensorValue.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated
     */
@Override
public void setSensorValue(OnOffValue newSensorValue) {
    OnOffValue oldSensorValue = sensorValue;
    sensorValue = newSensorValue;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.DUAL_BUTTON_BUTTON__SENSOR_VALUE, oldSensorValue, sensorValue));
}
Also used : OnOffValue(org.openhab.binding.tinkerforge.internal.types.OnOffValue) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 3 with OnOffValue

use of org.openhab.binding.tinkerforge.internal.types.OnOffValue in project openhab1-addons by openhab.

the class DualButtonButtonImpl method fetchSensorValue.

/**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void fetchSensorValue() {
    if (tactile || this.sensorValue == null || this.sensorValue == OnOffValue.UNDEF) {
        try {
            ButtonState buttonState = tinkerforgeDevice.getButtonState();
            OnOffValue newValue;
            if (position == DualButtonDevicePosition.LEFT) {
                newValue = getValue4State(buttonState.buttonL);
            } else {
                newValue = getValue4State(buttonState.buttonR);
            }
            setSensorValue(newValue);
            logger.trace("{} fetch value: {}", position, newValue);
        } 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());
    }
}
Also used : OnOffValue(org.openhab.binding.tinkerforge.internal.types.OnOffValue) NotConnectedException(com.tinkerforge.NotConnectedException) ButtonState(com.tinkerforge.BrickletDualButton.ButtonState) TimeoutException(com.tinkerforge.TimeoutException)

Example 4 with OnOffValue

use of org.openhab.binding.tinkerforge.internal.types.OnOffValue in project openhab1-addons by openhab.

the class LEDGroupImpl method setSwitchState.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated
     */
@Override
public void setSwitchState(OnOffValue newSwitchState) {
    OnOffValue oldSwitchState = switchState;
    switchState = newSwitchState;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.LED_GROUP__SWITCH_STATE, oldSwitchState, switchState));
}
Also used : OnOffValue(org.openhab.binding.tinkerforge.internal.types.OnOffValue) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 5 with OnOffValue

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

Aggregations

OnOffValue (org.openhab.binding.tinkerforge.internal.types.OnOffValue)26 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)15 NotConnectedException (com.tinkerforge.NotConnectedException)8 TimeoutException (com.tinkerforge.TimeoutException)8 DecimalValue (org.openhab.binding.tinkerforge.internal.types.DecimalValue)3 TinkerforgeBindingProvider (org.openhab.binding.tinkerforge.TinkerforgeBindingProvider)2 HighLowValue (org.openhab.binding.tinkerforge.internal.types.HighLowValue)2 PercentType (org.openhab.core.library.types.PercentType)2 ButtonState (com.tinkerforge.BrickletDualButton.ButtonState)1 State (com.tinkerforge.BrickletDualRelay.State)1 DigitalActor (org.openhab.binding.tinkerforge.internal.model.DigitalActor)1 DimmableActor (org.openhab.binding.tinkerforge.internal.model.DimmableActor)1 MBaseDevice (org.openhab.binding.tinkerforge.internal.model.MBaseDevice)1 MSwitchActor (org.openhab.binding.tinkerforge.internal.model.MSwitchActor)1 MTextActor (org.openhab.binding.tinkerforge.internal.model.MTextActor)1 MoveActor (org.openhab.binding.tinkerforge.internal.model.MoveActor)1 NumberActor (org.openhab.binding.tinkerforge.internal.model.NumberActor)1 PercentTypeActor (org.openhab.binding.tinkerforge.internal.model.PercentTypeActor)1 ProgrammableColorActor (org.openhab.binding.tinkerforge.internal.model.ProgrammableColorActor)1 ProgrammableSwitchActor (org.openhab.binding.tinkerforge.internal.model.ProgrammableSwitchActor)1