]> git.basschouten.com Git - openhab-addons.git/blob
4d21205ec7165aae6145827fb3e354630904ef21
[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.velux.internal.bridge.slip;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.velux.internal.bridge.common.BridgeCommunicationProtocol;
17 import org.openhab.binding.velux.internal.things.VeluxKLFAPI.CommandNumber;
18
19 /**
20  * Protocol specific bridge communication supported by the Velux bridge:
21  * <B>Authentication</B>
22  * <P>
23  * Common Message semantic: Communication with the bridge and (optionally) storing returned information within the class
24  * itself.
25  * <P>
26  * As 2nd level interface it defines the methods to help in sending a query and
27  * processing the received answer.
28  * <P>
29  * (Additional) Methods in this interface for the appropriate interaction:
30  * <UL>
31  * <LI>{@link getRequestCommand} to return the intended command to be sent.</LI>
32  * <LI>{@link getRequestDataAsArrayOfBytes} to return the intended data part to be sent.</LI>
33  * <LI>{@link setResponse} to store the response already separated into response command and data part.</LI>
34  * <LI>{@link isCommunicationFinished} to signal the completeness of the interaction (only available
35  * after storing the response).</LI>
36  * </UL>
37  * <P>
38  * Other mandatory methods are inherited from {@link BridgeCommunicationProtocol}.
39  *
40  * @author Guenther Schreiner - Initial contribution.
41  */
42 @NonNullByDefault
43 interface SlipBridgeCommunicationProtocol extends BridgeCommunicationProtocol {
44
45     /**
46      * Provides an empty array of bytes.
47      *
48      */
49     public static final byte[] EMPTYDATA = new byte[0];
50
51     /**
52      * Returning the command part of the request object for further SLIP serialization.
53      *
54      * @return <b>commandNumber</b>
55      *         is of type {@link CommandNumber}.
56      */
57     public CommandNumber getRequestCommand();
58
59     /**
60      * Returning the data part of the request object for further SLIP serialization.
61      *
62      * @return <b>dataAsArrayOfBytes</b>
63      *         is an Array of byte.
64      */
65     public byte[] getRequestDataAsArrayOfBytes();
66
67     /**
68      * Storing the command and the data part of the response object for further checks.
69      *
70      * @param thisResponseCommand of type short: command part of the response packet.
71      * @param thisResponseData of type Array of bytes: data part of response packet to be processed.
72      * @param isSequentialEnforced of type boolean: enforces the strict handshake sequence even for long duration
73      *            interactions.
74      */
75     public void setResponse(short thisResponseCommand, byte[] thisResponseData, boolean isSequentialEnforced);
76
77     /**
78      * Returning the communication status included within the response message..
79      *
80      * @return <b>isFinished</b>
81      *         is a boolean signaling the end of this transaction.
82      */
83     public boolean isCommunicationFinished();
84 }