Search in sources :

Example 1 with BrickletIndustrialDigitalIn4

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

the class MBrickletIndustrialDigitalIn4Impl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void enable() {
    logger.debug("{} enable called on MBrickletIndustrialDigitalIn4", LoggerConstants.TFINIT);
    tinkerforgeDevice = new BrickletIndustrialDigitalIn4(getUid(), getIpConnection());
    if (tfConfig != null) {
        if (tfConfig.eIsSet(tfConfig.eClass().getEStructuralFeature("debouncePeriod"))) {
            setDebouncePeriod(tfConfig.getDebouncePeriod());
        }
    }
    try {
        tinkerforgeDevice.setResponseExpectedAll(true);
        logger.debug("{} BrickletIndustrialDigital4In setting debouncePeriod to {}", LoggerConstants.TFINIT, getDebouncePeriod());
        tinkerforgeDevice.setDebouncePeriod(getDebouncePeriod());
        tinkerforgeDevice.setInterrupt(15);
    } 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) BrickletIndustrialDigitalIn4(com.tinkerforge.BrickletIndustrialDigitalIn4) MBrickletIndustrialDigitalIn4(org.openhab.binding.tinkerforge.internal.model.MBrickletIndustrialDigitalIn4) TimeoutException(com.tinkerforge.TimeoutException)

Example 2 with BrickletIndustrialDigitalIn4

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

the class MIndustrialDigitalInImpl method enable.

/**
     * <!-- begin-user-doc --> <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void enable() {
    setSensorValue(HighLowValue.UNDEF);
    MBrickletIndustrialDigitalIn4 bricklet = getMbrick();
    if (bricklet == null) {
        logger.error("{} No brick found for Digital4In: {} ", LoggerConstants.TFINIT, subId);
    } else {
        BrickletIndustrialDigitalIn4 brickletIndustrialDigitalIn4 = bricklet.getTinkerforgeDevice();
        interruptListener = new InterruptListener();
        brickletIndustrialDigitalIn4.addInterruptListener(interruptListener);
        fetchSensorValue();
    }
}
Also used : BrickletIndustrialDigitalIn4(com.tinkerforge.BrickletIndustrialDigitalIn4) MBrickletIndustrialDigitalIn4(org.openhab.binding.tinkerforge.internal.model.MBrickletIndustrialDigitalIn4) MBrickletIndustrialDigitalIn4(org.openhab.binding.tinkerforge.internal.model.MBrickletIndustrialDigitalIn4)

Example 3 with BrickletIndustrialDigitalIn4

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

the class MBrickletIndustrialDigitalIn4Impl method setTinkerforgeDevice.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated
     */
@Override
public void setTinkerforgeDevice(BrickletIndustrialDigitalIn4 newTinkerforgeDevice) {
    BrickletIndustrialDigitalIn4 oldTinkerforgeDevice = tinkerforgeDevice;
    tinkerforgeDevice = newTinkerforgeDevice;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.MBRICKLET_INDUSTRIAL_DIGITAL_IN4__TINKERFORGE_DEVICE, oldTinkerforgeDevice, tinkerforgeDevice));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) BrickletIndustrialDigitalIn4(com.tinkerforge.BrickletIndustrialDigitalIn4) MBrickletIndustrialDigitalIn4(org.openhab.binding.tinkerforge.internal.model.MBrickletIndustrialDigitalIn4)

Aggregations

BrickletIndustrialDigitalIn4 (com.tinkerforge.BrickletIndustrialDigitalIn4)3 MBrickletIndustrialDigitalIn4 (org.openhab.binding.tinkerforge.internal.model.MBrickletIndustrialDigitalIn4)3 NotConnectedException (com.tinkerforge.NotConnectedException)1 TimeoutException (com.tinkerforge.TimeoutException)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1