Search in sources :

Example 1 with DetectionCycleEndedListener

use of com.tinkerforge.BrickletMotionDetector.DetectionCycleEndedListener 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)

Aggregations

BrickletMotionDetector (com.tinkerforge.BrickletMotionDetector)1 DetectionCycleEndedListener (com.tinkerforge.BrickletMotionDetector.DetectionCycleEndedListener)1 MotionDetectedListener (com.tinkerforge.BrickletMotionDetector.MotionDetectedListener)1 MBrickletMotionDetector (org.openhab.binding.tinkerforge.internal.model.MBrickletMotionDetector)1