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
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.
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)}.
37 * @author Michael Ochel - Initial contribution
38 * @author Matthias Siegele - Initial contribution
41 public interface DeviceStatusListener {
44 * ID of the device discovery listener.
46 static final String DEVICE_DISCOVERY = "DeviceDiscovery";
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.
53 * @param deviceStateUpdate new device status
55 void onDeviceStateChanged(DeviceStateUpdate deviceStateUpdate);
58 * This method is called whenever a device is removed.
60 * @param device which is removed
62 void onDeviceRemoved(GeneralDeviceInformation device);
65 * This method is called whenever a device is added.
67 * @param device which is added
69 void onDeviceAdded(GeneralDeviceInformation device);
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.
76 * @param whatConfig has changed
78 void onDeviceConfigChanged(ChangeableDeviceConfigEnum whatConfig);
81 * This method is called whenever a scene configuration is added to a device.
83 * @param sceneID of a read scene configuration
85 void onSceneConfigAdded(short sceneID);
88 * Returns the id of this {@link DeviceStatusListener}.
90 * @return the device listener id
92 String getDeviceStatusListenerID();