]> git.basschouten.com Git - openhab-addons.git/blob
e1e4fb1306581355843c5e3cec665baad757b062
[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.rfxcom.internal.messages;
14
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;
20
21 /**
22  * This interface defines interface which every message class should implement.
23  *
24  * @author Pauli Anttila - Initial contribution
25  */
26 public interface RFXComMessage {
27
28     /**
29      * Procedure for encode raw data.
30      *
31      * @param data Raw data.
32      */
33     void encodeMessage(byte[] data) throws RFXComException;
34
35     /**
36      * Procedure for decode object to raw data.
37      *
38      * @return raw data.
39      */
40     byte[] decodeMessage() throws RFXComException;
41
42     /**
43      * Procedure for converting openHAB state to RFXCOM object.
44      *
45      * @throws RFXComUnsupportedChannelException If we do not support setting this channel
46      * @throws RFXComInvalidStateException If the state (type) is invalid for the channel
47      */
48     void convertFromState(String channelId, Type type)
49             throws RFXComUnsupportedChannelException, RFXComInvalidStateException;
50
51     /**
52      * Procedure to pass configuration to a message
53      *
54      * @param deviceConfiguration configuration about the device
55      * @throws RFXComException if the configuration could not be handled properly
56      */
57     void setConfig(RFXComDeviceConfiguration deviceConfiguration) throws RFXComException;
58 }