Search in sources :

Example 1 with BrickletMotionDetector

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

the class MBrickletMotionDetectorImpl method enable.

/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * 
     * @generated NOT
     */
@Override
public void enable() {
    tinkerforgeDevice = new BrickletMotionDetector(getUid(), getIpConnection());
    motionDetectedListener = new BrickletMotionDetector.MotionDetectedListener() {

        @Override
        public void motionDetected() {
            logger.debug("{} motion detected: {}", LoggerConstants.TFMODELUPDATE, getUid());
            setSensorValue(HighLowValue.HIGH);
        }
    };
    tinkerforgeDevice.addMotionDetectedListener(motionDetectedListener);
    detectionCycleEndedListener = new BrickletMotionDetector.DetectionCycleEndedListener() {

        @Override
        public void detectionCycleEnded() {
            logger.debug("{} motion end: {}", LoggerConstants.TFMODELUPDATE, getUid());
            setSensorValue(HighLowValue.LOW);
        }
    };
    tinkerforgeDevice.addDetectionCycleEndedListener(detectionCycleEndedListener);
    fetchSensorValue();
}
Also used : DetectionCycleEndedListener(com.tinkerforge.BrickletMotionDetector.DetectionCycleEndedListener) MotionDetectedListener(com.tinkerforge.BrickletMotionDetector.MotionDetectedListener) BrickletMotionDetector(com.tinkerforge.BrickletMotionDetector) MBrickletMotionDetector(org.openhab.binding.tinkerforge.internal.model.MBrickletMotionDetector)

Example 2 with BrickletMotionDetector

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

the class MBrickletMotionDetectorImpl method setTinkerforgeDevice.

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

Aggregations

BrickletMotionDetector (com.tinkerforge.BrickletMotionDetector)2 MBrickletMotionDetector (org.openhab.binding.tinkerforge.internal.model.MBrickletMotionDetector)2 DetectionCycleEndedListener (com.tinkerforge.BrickletMotionDetector.DetectionCycleEndedListener)1 MotionDetectedListener (com.tinkerforge.BrickletMotionDetector.MotionDetectedListener)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1