]> git.basschouten.com Git - openhab-addons.git/blob
b57368d873a620bbdf73a19b03d821d900156ef6
[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.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.velux.internal.bridge.VeluxBridgeInstance;
18 import org.openhab.binding.velux.internal.bridge.common.BridgeAPI;
19 import org.openhab.binding.velux.internal.bridge.common.GetDeviceStatus;
20 import org.openhab.binding.velux.internal.bridge.common.GetFirmware;
21 import org.openhab.binding.velux.internal.bridge.common.GetHouseStatus;
22 import org.openhab.binding.velux.internal.bridge.common.GetLANConfig;
23 import org.openhab.binding.velux.internal.bridge.common.GetProduct;
24 import org.openhab.binding.velux.internal.bridge.common.GetProductLimitation;
25 import org.openhab.binding.velux.internal.bridge.common.GetProducts;
26 import org.openhab.binding.velux.internal.bridge.common.GetScenes;
27 import org.openhab.binding.velux.internal.bridge.common.GetWLANConfig;
28 import org.openhab.binding.velux.internal.bridge.common.Login;
29 import org.openhab.binding.velux.internal.bridge.common.Logout;
30 import org.openhab.binding.velux.internal.bridge.common.RunProductCommand;
31 import org.openhab.binding.velux.internal.bridge.common.RunProductDiscovery;
32 import org.openhab.binding.velux.internal.bridge.common.RunProductIdentification;
33 import org.openhab.binding.velux.internal.bridge.common.RunProductSearch;
34 import org.openhab.binding.velux.internal.bridge.common.RunReboot;
35 import org.openhab.binding.velux.internal.bridge.common.RunScene;
36 import org.openhab.binding.velux.internal.bridge.common.SetHouseStatusMonitor;
37 import org.openhab.binding.velux.internal.bridge.common.SetProductLimitation;
38 import org.openhab.binding.velux.internal.bridge.common.SetSceneVelocity;
39 import org.slf4j.Logger;
40 import org.slf4j.LoggerFactory;
41
42 /**
43  * SLIP-based 3rd Level I/O interface towards the <B>Velux</B> bridge.
44  * <P>
45  * It provides the one-and-only protocol specific 1st-level communication class.
46  * Additionally it provides all methods for different gateway interactions.
47  * <P>
48  * The following class access methods exist:
49  * <UL>
50  * <LI>{@link SlipBridgeAPI#getDeviceStatus} for retrieving the bridge state (i.e. IDLE, BUSY, a.s.o),</LI>
51  * <LI>{@link SlipBridgeAPI#getFirmware} for retrieving the firmware version of the bridge,</LI>
52  * <LI>{@link SlipBridgeAPI#getHouseStatus} for retrieving the information about device state changes recognized by the
53  * bridge,</LI>
54  * <LI>{@link SlipBridgeAPI#getLANConfig} for retrieving the complete LAN information of the bridge,</LI>
55  * <LI>{@link SlipBridgeAPI#getProduct} for retrieving the any information about a device behind the bridge,</LI>
56  * <LI>{@link SlipBridgeAPI#getProductLimitation} for retrieving the limitation information about a device behind the
57  * bridge,</LI>
58  * <LI>{@link SlipBridgeAPI#getProducts} for retrieving the any information for all devices behind the bridge,</LI>
59  * <LI>{@link SlipBridgeAPI#getScenes} for retrieving the any information for all scenes defined on the bridge,</LI>
60  * <LI>{@link SlipBridgeAPI#getWLANConfig} for retrieving the complete WLAN information of the bridge,</LI>
61  * <LI>{@link SlipBridgeAPI#login} for establishing a trusted connectivity by authentication,</LI>
62  * <LI>{@link SlipBridgeAPI#logout} for tearing down the trusted connectivity by deauthentication,</LI>
63  * <LI>{@link SlipBridgeAPI#runProductCommand} for manipulation of a device behind the bridge (i.e. instructing to
64  * modify a position),</LI>
65  * <LI>{@link SlipBridgeAPI#runProductDiscovery} for activation of learning mode of the bridge to discovery new
66  * products,</LI>
67  * <LI>{@link SlipBridgeAPI#runProductIdentification} for human-oriented identification a device behind the bridge (i.e.
68  * by winking or switching on-and-off),</LI>
69  * <LI>{@link SlipBridgeAPI#runProductSearch} for searching for lost products on the bridge,</LI>
70  * <LI>{@link SlipBridgeAPI#runScene} for manipulation of a set of devices behind the bridge which are tied together as
71  * scene,</LI>
72  * <LI>{@link SlipBridgeAPI#setHouseStatusMonitor} for activation or deactivation of the house monitoring mode to be
73  * informed about device state changes recognized by the bridge,</LI>
74  * <LI>{@link SlipBridgeAPI#setSceneVelocity} for changes the velocity of a scene defined on the bridge (i.e. silent or
75  * fast mode).</LI>
76  * </UL>
77  * <P>
78  * As most derived class of the several inheritance levels it defines an
79  * interfacing method which returns the SLIP-protocol-specific communication for gateway interaction.
80  *
81  * @author Guenther Schreiner - Initial contribution.
82  */
83 @NonNullByDefault
84 class SlipBridgeAPI implements BridgeAPI {
85     private final Logger logger = LoggerFactory.getLogger(SlipBridgeAPI.class);
86
87     private final GetDeviceStatus slipGetDeviceStatus = new SCgetDeviceStatus();
88     private final GetFirmware slipGetFirmware = new SCgetFirmware();
89     private final GetHouseStatus slipGetHouseStatus = new SCgetHouseStatus();
90     private final GetLANConfig slipGetLanConfig = new SCgetLANConfig();
91     private final GetProduct slipGetProduct = new SCgetProduct();
92     private final GetProductLimitation slipGetProductLimitation = new SCgetLimitation();
93     private final GetProducts slipGetProducts = new SCgetProducts();
94     private final GetScenes slipGetScenes = new SCgetScenes();
95     private final GetWLANConfig slipGetWLanConfig = new SCgetWLANConfig();
96     private final Login slipLogin = new SClogin();
97     private final Logout slipLogout = new SClogout();
98     private final RunProductCommand slipRunProductCommand = new SCrunProductCommand();
99     private final RunProductDiscovery slipRunProductDiscovery = new SCrunProductDiscovery();
100     private final RunProductIdentification slipRunProductIdentification = new SCrunProductIdentification();
101     private final RunProductSearch slipRunProductSearch = new SCrunProductSearch();
102     private final RunScene slipRunScene = new SCrunScene();
103     private final SetHouseStatusMonitor slipSetHouseMonitor = new SCsetHouseStatusMonitor();
104     private final SetProductLimitation slipSetProductLimitation = new SCsetLimitation();
105     private final SetSceneVelocity slipSetSceneVelocity = new SCsetSceneVelocity();
106     private final RunReboot slipRunReboot = new SCrunReboot();
107     private final GetProduct slipGetProductStatus = new SCgetProductStatus();
108
109     /**
110      * Constructor.
111      * <P>
112      * Inherits the initialization of the binding-wide instance for dealing for common information and
113      * initializes the handler {@link SlipVeluxBridge#bridgeAPI}
114      * to pass the interface methods.
115      *
116      * @param bridgeInstance refers to the binding-wide instance for dealing for common informations.
117      */
118     SlipBridgeAPI(VeluxBridgeInstance bridgeInstance) {
119         logger.trace("SlipBridgeAPI(constructor) called.");
120     }
121
122     @Override
123     public GetDeviceStatus getDeviceStatus() {
124         return slipGetDeviceStatus;
125     }
126
127     @Override
128     public GetFirmware getFirmware() {
129         return slipGetFirmware;
130     }
131
132     @Override
133     public @Nullable GetHouseStatus getHouseStatus() {
134         return slipGetHouseStatus;
135     }
136
137     @Override
138     public GetLANConfig getLANConfig() {
139         return slipGetLanConfig;
140     }
141
142     @Override
143     public @Nullable GetProduct getProduct() {
144         return slipGetProduct;
145     }
146
147     @Override
148     public @Nullable GetProductLimitation getProductLimitation() {
149         return slipGetProductLimitation;
150     }
151
152     @Override
153     public @Nullable SetProductLimitation setProductLimitation() {
154         return slipSetProductLimitation;
155     }
156
157     @Override
158     public GetProducts getProducts() {
159         return slipGetProducts;
160     }
161
162     @Override
163     public GetScenes getScenes() {
164         return slipGetScenes;
165     }
166
167     @Override
168     public GetWLANConfig getWLANConfig() {
169         return slipGetWLanConfig;
170     }
171
172     @Override
173     public Login login() {
174         return slipLogin;
175     }
176
177     @Override
178     public Logout logout() {
179         return slipLogout;
180     }
181
182     @Override
183     public @Nullable RunProductCommand runProductCommand() {
184         return slipRunProductCommand;
185     }
186
187     @Override
188     public RunProductDiscovery runProductDiscovery() {
189         return slipRunProductDiscovery;
190     }
191
192     @Override
193     public RunProductIdentification runProductIdentification() {
194         return slipRunProductIdentification;
195     }
196
197     @Override
198     public RunProductSearch runProductSearch() {
199         return slipRunProductSearch;
200     }
201
202     @Override
203     public RunScene runScene() {
204         return slipRunScene;
205     }
206
207     @Override
208     public @Nullable SetHouseStatusMonitor setHouseStatusMonitor() {
209         return slipSetHouseMonitor;
210     }
211
212     @Override
213     public SetSceneVelocity setSceneVelocity() {
214         return slipSetSceneVelocity;
215     }
216
217     @Override
218     public @Nullable RunReboot runReboot() {
219         return slipRunReboot;
220     }
221
222     @Override
223     public @Nullable GetProduct getProductStatus() {
224         return slipGetProductStatus;
225     }
226 }