]> git.basschouten.com Git - openhab-addons.git/blob
6678942dbdd894d9b04ba4b3ba217968ffea1888
[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.russound.internal.rio;
14
15 import org.openhab.core.thing.ThingStatus;
16 import org.openhab.core.thing.ThingStatusDetail;
17 import org.openhab.core.types.State;
18
19 /**
20  *
21  * This interface is used to provide a callback mechanism between {@link AbstractRioProtocol} and the associated
22  * bridge/thing ({@link AbstractBridgeHandler} and {@link AbstractThingHandler}). This is necessary since the status and
23  * state of a bridge/thing is private and the protocol handler cannot access it directly.
24  *
25  * @author Tim Roberts - Initial contribution
26  */
27 public interface RioHandlerCallback {
28     /**
29      * Callback to the bridge/thing to update the status of the bridge/thing.
30      *
31      * @param status a non-null {@link ThingStatus}
32      * @param detail a non-null {@link ThingStatusDetail}
33      * @param msg a possibly null, possibly empty message
34      */
35     void statusChanged(ThingStatus status, ThingStatusDetail detail, String msg);
36
37     /**
38      * Callback to the bridge/thing to update the state of a channel in the bridge/thing.
39      *
40      * @param channelId the non-null, non-empty channel id
41      * @param state the new non-null {@link State}
42      */
43     void stateChanged(String channelId, State state);
44
45     /**
46      * Callback to set a property for the thing
47      *
48      * @param propertyName a non-null, non-empty property name
49      * @param propertyValue a non-null, possibly empty property value
50      */
51     void setProperty(String propertyName, String propertyValue);
52
53     /**
54      * Adds a listener to changes to the channelId
55      *
56      * @param channelId a non-null, non-empty channelID
57      * @param listener a non-null listener
58      * @throws IllegalArgumentException if channelId is null or empty
59      * @throws IllegalArgumentException if listener is null
60      */
61     void addListener(String channelId, RioHandlerCallbackListener listener);
62
63     /**
64      * Removes the specified listener for the specified channel
65      *
66      * @param channelId a non-null, non-empty channelID
67      * @param listener a non-null listener
68      * @throws IllegalArgumentException if channelId is null or empty
69      * @throws IllegalArgumentException if listener is null
70      */
71     void removeListener(String channelId, RioHandlerCallbackListener listener);
72 }