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.lgwebos.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.lgwebos.internal.handler.LGWebOSHandler;
17 import org.openhab.core.types.Command;
20 * Channel Handler mediates between connect sdk device state changes and openhab channel events.
22 * @author Sebastian Prehn - initial contribution
25 public interface ChannelHandler {
28 * This method will be called whenever a command is received for this handler.
29 * All implementations provide custom logic here.
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>
35 void onReceiveCommand(String channelId, LGWebOSHandler handler, Command command);
38 * Handle underlying subscription status if device changes online state, capabilities or channel gets linked or
41 * Implementation first removes any subscription via removeAnySubscription and subsequently establishes any required
42 * subscription on this device channel handler.
44 * @param channelId must not be <code>null</code>
45 * @param handler must not be <code>null</code>
47 void refreshSubscription(String channelId, LGWebOSHandler handler);
50 * Removes subscriptions if there are any.
52 * @param handler must not be <code>null</code>
54 void removeAnySubscription(LGWebOSHandler handler);
57 * Callback method whenever a device disappears.
59 * @param channelId must not be <code>null</code>
60 * @param handler must not be <code>null</code>
62 void onDeviceRemoved(String channelId, LGWebOSHandler handler);
65 * Callback method whenever a device is discovered and ready to operate.
67 * @param channelId must not be <code>null</code>
68 * @param handler must not be <code>null</code>
70 void onDeviceReady(String channelId, LGWebOSHandler handler);