]> git.basschouten.com Git - openhab-addons.git/blob
da25be95a20b50dbd720db202245179cc542a317
[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.neeo.internal;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.core.thing.ThingStatus;
18 import org.openhab.core.thing.ThingStatusDetail;
19 import org.openhab.core.types.State;
20
21 /**
22  *
23  * This interface is used to provide a callback mechanism between a {@link org.openhab.core.thing.binding.ThingHandler}
24  * and the associated protocol.
25  * This is necessary since the status and state of a bridge/thing is private and the protocol handler cannot access it
26  * directly.
27  *
28  * @author Tim Roberts - Initial contribution
29  *
30  */
31 @NonNullByDefault
32 public interface NeeoHandlerCallback {
33     /**
34      * Callback to the bridge/thing to update the status of the bridge/thing.
35      *
36      * @param status a non-null {@link ThingStatus}
37      * @param detail a non-null {@link ThingStatusDetail}
38      * @param msg a possibly null, possibly empty message
39      */
40     void statusChanged(ThingStatus status, ThingStatusDetail detail, String msg);
41
42     /**
43      * Callback to the bridge/thing to update the state of a channel in the bridge/thing.
44      *
45      * @param channelId the non-null, non-empty channel id
46      * @param state the new non-null {@State}
47      */
48     void stateChanged(String channelId, State state);
49
50     /**
51      * Callback to set a property for the thing.
52      *
53      * @param propertyName a non-null, non-empty property name
54      * @param propertyValue a non-null, possibly empty property value
55      */
56     void setProperty(String propertyName, String propertyValue);
57
58     /**
59      * Schedule a task to be executed in the future
60      *
61      * @param task the non-null task
62      * @param milliSeconds the milliseconds (>0)
63      */
64     void scheduleTask(Runnable task, long milliSeconds);
65
66     /**
67      * Callback to trigger an event
68      *
69      * @param channelID a non-null, non-empty channel id
70      * @param event a possibly null, possibly empty event
71      */
72     void triggerEvent(String channelID, String event);
73
74     /**
75      * Callback to retrieve the current {@link NeeoBrainApi}
76      *
77      * @return a possibly null {@link NeeoBrainApi}
78      */
79     @Nullable
80     NeeoBrainApi getApi();
81 }