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