Search in sources :

Example 1 with MBrickletIndustrialDigitalIn4

use of org.openhab.binding.tinkerforge.internal.model.MBrickletIndustrialDigitalIn4 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 MBrickletIndustrialDigitalIn4

use of org.openhab.binding.tinkerforge.internal.model.MBrickletIndustrialDigitalIn4 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)

Aggregations

BrickletIndustrialDigitalIn4 (com.tinkerforge.BrickletIndustrialDigitalIn4)2 MBrickletIndustrialDigitalIn4 (org.openhab.binding.tinkerforge.internal.model.MBrickletIndustrialDigitalIn4)2 NotConnectedException (com.tinkerforge.NotConnectedException)1 TimeoutException (com.tinkerforge.TimeoutException)1