Search in sources :

Example 1 with RotaryEncoder

use of org.openhab.binding.tinkerforge.internal.model.RotaryEncoder in project openhab1-addons by openhab.

the class MBrickletRotaryEncoderImpl method initSubDevices.

/**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void initSubDevices() {
    RotaryEncoder rotaryEncoder = ModelFactory.eINSTANCE.createRotaryEncoder();
    rotaryEncoder.setUid(getUid());
    String subIdEncoder = "encoder";
    rotaryEncoder.setSubId(subIdEncoder);
    logger.debug("addSubDevice {}", subIdEncoder);
    rotaryEncoder.init();
    rotaryEncoder.setMbrick(this);
    RotaryEncoderButton button = ModelFactory.eINSTANCE.createRotaryEncoderButton();
    button.setUid(getUid());
    String subIdButton = "button";
    button.setSubId(subIdButton);
    logger.debug("addSubDevice {}", subIdButton);
    button.init();
    button.setMbrick(this);
}
Also used : RotaryEncoderButton(org.openhab.binding.tinkerforge.internal.model.RotaryEncoderButton) MBrickletRotaryEncoder(org.openhab.binding.tinkerforge.internal.model.MBrickletRotaryEncoder) BrickletRotaryEncoder(com.tinkerforge.BrickletRotaryEncoder) RotaryEncoder(org.openhab.binding.tinkerforge.internal.model.RotaryEncoder)

Example 2 with RotaryEncoder

use of org.openhab.binding.tinkerforge.internal.model.RotaryEncoder in project openhab1-addons by openhab.

the class TinkerforgeContextImpl method tfRotaryEncoderClear.

@Override
public boolean tfRotaryEncoderClear(String uid) {
    if (ecosystem == null) {
        logger.error("tfRotaryEncoderClear action failed ecosystem is null");
        return false;
    }
    MBaseDevice mDevice = ecosystem.getDevice(uid, "encoder");
    if (mDevice instanceof RotaryEncoder) {
        logger.trace("rotary encoder clear action");
        ((RotaryEncoder) mDevice).clear();
        return true;
    } else {
        logger.error("no Rotary Ecoder found for uid {}", uid);
        return false;
    }
}
Also used : MBaseDevice(org.openhab.binding.tinkerforge.internal.model.MBaseDevice) RotaryEncoder(org.openhab.binding.tinkerforge.internal.model.RotaryEncoder)

Aggregations

RotaryEncoder (org.openhab.binding.tinkerforge.internal.model.RotaryEncoder)2 BrickletRotaryEncoder (com.tinkerforge.BrickletRotaryEncoder)1 MBaseDevice (org.openhab.binding.tinkerforge.internal.model.MBaseDevice)1 MBrickletRotaryEncoder (org.openhab.binding.tinkerforge.internal.model.MBrickletRotaryEncoder)1 RotaryEncoderButton (org.openhab.binding.tinkerforge.internal.model.RotaryEncoderButton)1