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.rfxcom.internal.messages;
15 import org.openhab.binding.rfxcom.internal.config.RFXComDeviceConfiguration;
16 import org.openhab.binding.rfxcom.internal.exceptions.RFXComException;
17 import org.openhab.binding.rfxcom.internal.exceptions.RFXComInvalidStateException;
18 import org.openhab.binding.rfxcom.internal.exceptions.RFXComUnsupportedChannelException;
19 import org.openhab.core.types.Type;
22 * This interface defines interface which every message class should implement.
24 * @author Pauli Anttila - Initial contribution
26 public interface RFXComMessage {
29 * Procedure for encode raw data.
31 * @param data Raw data.
33 void encodeMessage(byte[] data) throws RFXComException;
36 * Procedure for decode object to raw data.
40 byte[] decodeMessage() throws RFXComException;
43 * Procedure for converting openHAB state to RFXCOM object.
45 * @throws RFXComUnsupportedChannelException If we do not support setting this channel
46 * @throws RFXComInvalidStateException If the state (type) is invalid for the channel
48 void convertFromState(String channelId, Type type)
49 throws RFXComUnsupportedChannelException, RFXComInvalidStateException;
52 * Procedure to pass configuration to a message
54 * @param deviceConfiguration configuration about the device
55 * @throws RFXComException if the configuration could not be handled properly
57 void setConfig(RFXComDeviceConfiguration deviceConfiguration) throws RFXComException;