2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.digitalstrom.internal.lib.listener;
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;
20 * The {@link DeviceStatusListener} is notified, if a {@link Device} status or configuration has changed, if a scene
21 * configuration is added to a {@link Device} or if a device has been added or removed. The {@link DeviceStatusListener}
22 * can be also registered by a {@link Circuit} to get informed by configuration or status changes.
24 * By implementation with the id {@link #DEVICE_DISCOVERY} this listener can be used as a device discovery to get
25 * informed, if a new {@link Device} or {@link Circuit} is added or removed from the digitalSTROM-System.<br>
26 * For that the {@link DeviceStatusListener} has to be registered on the
27 * {@link DeviceStatusManager#registerDeviceListener(DeviceStatusListener)}. Then the {@link DeviceStatusListener} gets
28 * informed by the methods {@link #onDeviceAdded(Object)} and {@link #onDeviceRemoved(Object)}.
31 * @author Michael Ochel - Initial contribution
32 * @author Matthias Siegele - Initial contribution
35 public interface DeviceStatusListener {
38 * ID of the device discovery listener.
40 static final String DEVICE_DISCOVERY = "DeviceDiscovery";
43 * This method is called whenever the state of the {@link Device} has changed and passes the new device state as an
44 * {@link DeviceStateUpdate} object.
46 * @param deviceStateUpdate new device status
48 void onDeviceStateChanged(DeviceStateUpdate deviceStateUpdate);
51 * This method is called whenever a device is removed.
53 * @param device which is removed
55 void onDeviceRemoved(GeneralDeviceInformation device);
58 * This method is called whenever a device is added.
60 * @param device which is added
62 void onDeviceAdded(GeneralDeviceInformation device);
65 * This method is called whenever a configuration of a device has changed. What configuration has changed
66 * can be see by the given parameter whatConfig to handle the change.<br>
67 * Please have a look at {@link ChangeableDeviceConfigEnum} to see what configuration are changeable.
69 * @param whatConfig has changed
71 void onDeviceConfigChanged(ChangeableDeviceConfigEnum whatConfig);
74 * This method is called whenever a scene configuration is added to a device.
76 * @param sceneID of a read scene configuration
78 void onSceneConfigAdded(short sceneID);
81 * Returns the id of this {@link DeviceStatusListener}.
83 * @return the device listener id
85 String getDeviceStatusListenerID();