]> git.basschouten.com Git - openhab-addons.git/blob
c572e5a43cdfee5c29dc6e571e33436820451b57
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.hue.internal.handler;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.hue.internal.api.dto.clip1.FullSensor;
17
18 /**
19  * The {@link SensorStatusListener} is notified when a sensor status has changed or a sensor has been removed or added.
20  *
21  * @author Samuel Leisering - Initial contribution
22  * @author Christoph Weitkamp - Initial contribution
23  */
24 @NonNullByDefault
25 public interface SensorStatusListener {
26
27     /**
28      * This method returns the sensor Id
29      * 
30      * @return sensor id of thing or DISCOVERY for discovery service
31      */
32     String getSensorId();
33
34     /**
35      * This method is called whenever the state of the given sensor has changed. The new state can be obtained by
36      * {@link FullSensor#getState()}.
37      *
38      * @param sensor The sensor which received the state update.
39      * @return The sensor handler returns true if it accepts the new state.
40      */
41     boolean onSensorStateChanged(FullSensor sensor);
42
43     /**
44      * This method is called whenever a sensor is removed.
45      */
46     void onSensorRemoved();
47
48     /**
49      * This method is called whenever a sensor is reported as gone.
50      */
51     void onSensorGone();
52
53     /**
54      * This method is called whenever a sensor is added.
55      *
56      * @param sensor The added sensor
57      */
58     void onSensorAdded(FullSensor sensor);
59 }