]> git.basschouten.com Git - openhab-addons.git/blob
0b85b2308e9e76d50ce196e5e2b96032eb6881d7
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.RFXComUnsupportedChannelException;
18 import org.openhab.core.types.Type;
19
20 /**
21  * This interface defines interface which every message class should implement.
22  *
23  * @author Pauli Anttila - Initial contribution
24  */
25 public interface RFXComMessage {
26
27     /**
28      * Procedure for encode raw data.
29      *
30      * @param data Raw data.
31      */
32     void encodeMessage(byte[] data) throws RFXComException;
33
34     /**
35      * Procedure for decode object to raw data.
36      *
37      * @return raw data.
38      */
39     byte[] decodeMessage() throws RFXComException;
40
41     /**
42      * Procedure for converting openHAB state to RFXCOM object.
43      */
44     void convertFromState(String channelId, Type type) throws RFXComUnsupportedChannelException;
45
46     /**
47      * Procedure to pass configuration to a message
48      *
49      * @param deviceConfiguration configuration about the device
50      * @throws RFXComException if the configuration could not be handled properly
51      */
52     void setConfig(RFXComDeviceConfiguration deviceConfiguration) throws RFXComException;
53 }