]> git.basschouten.com Git - openhab-addons.git/blob
a6d88174ee4b3a0c2404091c1f553df56e362de7
[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.digitalstrom.internal.lib.listener;
14
15 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.GeneralDeviceInformation;
16 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.DeviceStateUpdate;
17 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.ChangeableDeviceConfigEnum;
18
19 /**
20  * The {@link DeviceStatusListener} is notified, if a
21  * {@link org.openhab.binding.digitalstrom.internal.lib.structure.devices.Device} status or configuration has changed,
22  * if a scene configuration is added to a {@link org.openhab.binding.digitalstrom.internal.lib.structure.devices.Device}
23  * or if a device has been added or removed. The {@link DeviceStatusListener}
24  * can be also registered by a {@link org.openhab.binding.digitalstrom.internal.lib.structure.devices.Circuit}
25  * to get informed by configuration or status changes.
26  * <p>
27  * By implementation with the id {@link #DEVICE_DISCOVERY} this listener can be used as a device discovery to get
28  * informed, if a new {@link org.openhab.binding.digitalstrom.internal.lib.structure.devices.Device} or
29  * {@link org.openhab.binding.digitalstrom.internal.lib.structure.devices.Circuit} is added or removed from the
30  * digitalSTROM-System.<br>
31  * For that the {@link DeviceStatusListener} has to be registered on the
32  * {@link org.openhab.binding.digitalstrom.internal.lib.manager.DeviceStatusManager#registerDeviceListener(DeviceStatusListener)}.
33  * Then the {@link DeviceStatusListener} gets informed by the methods {@link #onDeviceAdded(GeneralDeviceInformation)}
34  * and {@link #onDeviceRemoved(GeneralDeviceInformation)}.
35  * </p>
36  *
37  * @author Michael Ochel - Initial contribution
38  * @author Matthias Siegele - Initial contribution
39  *
40  */
41 public interface DeviceStatusListener {
42
43     /**
44      * ID of the device discovery listener.
45      */
46     static final String DEVICE_DISCOVERY = "DeviceDiscovery";
47
48     /**
49      * This method is called whenever the state of the
50      * {@link org.openhab.binding.digitalstrom.internal.lib.structure.devices.Device} has changed and passes the new
51      * device state as an {@link DeviceStateUpdate} object.
52      *
53      * @param deviceStateUpdate new device status
54      */
55     void onDeviceStateChanged(DeviceStateUpdate deviceStateUpdate);
56
57     /**
58      * This method is called whenever a device is removed.
59      *
60      * @param device which is removed
61      */
62     void onDeviceRemoved(GeneralDeviceInformation device);
63
64     /**
65      * This method is called whenever a device is added.
66      *
67      * @param device which is added
68      */
69     void onDeviceAdded(GeneralDeviceInformation device);
70
71     /**
72      * This method is called whenever a configuration of a device has changed. What configuration has changed
73      * can be see by the given parameter whatConfig to handle the change.<br>
74      * Please have a look at {@link ChangeableDeviceConfigEnum} to see what configuration are changeable.
75      *
76      * @param whatConfig has changed
77      */
78     void onDeviceConfigChanged(ChangeableDeviceConfigEnum whatConfig);
79
80     /**
81      * This method is called whenever a scene configuration is added to a device.
82      *
83      * @param sceneID of a read scene configuration
84      */
85     void onSceneConfigAdded(short sceneID);
86
87     /**
88      * Returns the id of this {@link DeviceStatusListener}.
89      *
90      * @return the device listener id
91      */
92     String getDeviceStatusListenerID();
93 }