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.webthing.internal;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.thing.ChannelUID;
17 import org.openhab.core.types.Command;
18 import org.openhab.core.types.State;
21 * The {@link ChannelHandler} class is a simplified abstraction of an openHAB Channel implementing
22 * methods to observe a channel as well to update an Item associated to a channel
24 * @author Gregor Roth - Initial contribution
27 public interface ChannelHandler {
30 * register a listener to observer the channel regarding item change events
32 * @param channelUID the channel identifier
33 * @param listener the listener to be notified
35 void observeChannel(ChannelUID channelUID, ItemChangedListener listener);
38 * updates an Item state of a dedicated channel
40 * @param channelUID the channel identifier
41 * @param command the state update command
43 void updateItemState(ChannelUID channelUID, Command command);
46 * Listener that will be notified, if an Item state is changed
48 interface ItemChangedListener {
51 * item change callback method
53 * @param channelUID the channel identifier
54 * @param stateCommand the item change command
56 void onItemStateChanged(ChannelUID channelUID, State stateCommand);