]> git.basschouten.com Git - openhab-addons.git/blob
e80871c4674452b9ad010760ca8b9f4a55ba4745
[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.lgwebos.internal;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.lgwebos.internal.handler.LGWebOSHandler;
17 import org.openhab.core.types.Command;
18
19 /**
20  * Channel Handler mediates between connect sdk device state changes and openhab channel events.
21  *
22  * @author Sebastian Prehn - initial contribution
23  */
24 @NonNullByDefault
25 public interface ChannelHandler {
26
27     /**
28      * This method will be called whenever a command is received for this handler.
29      * All implementations provide custom logic here.
30      *
31      * @param channelId must not be <code>null</code>
32      * @param handler must not be <code>null</code>
33      * @param command must not be <code>null</code>
34      */
35     void onReceiveCommand(String channelId, LGWebOSHandler handler, Command command);
36
37     /**
38      * Handle underlying subscription status if device changes online state, capabilities or channel gets linked or
39      * unlinked.
40      *
41      * Implementation first removes any subscription via removeAnySubscription and subsequently establishes any required
42      * subscription on this device channel handler.
43      *
44      * @param channelId must not be <code>null</code>
45      * @param handler must not be <code>null</code>
46      */
47     void refreshSubscription(String channelId, LGWebOSHandler handler);
48
49     /**
50      * Removes subscriptions if there are any.
51      *
52      * @param handler must not be <code>null</code>
53      */
54     void removeAnySubscription(LGWebOSHandler handler);
55
56     /**
57      * Callback method whenever a device disappears.
58      *
59      * @param channelId must not be <code>null</code>
60      * @param handler must not be <code>null</code>
61      */
62     void onDeviceRemoved(String channelId, LGWebOSHandler handler);
63
64     /**
65      * Callback method whenever a device is discovered and ready to operate.
66      *
67      * @param channelId must not be <code>null</code>
68      * @param handler must not be <code>null</code>
69      */
70     void onDeviceReady(String channelId, LGWebOSHandler handler);
71 }