]> git.basschouten.com Git - openhab-addons.git/blob
12fd7ac883e64b756b597a858e37f8c8efe19544
[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.json;
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  * JSON-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 JsonBridgeAPI#getDeviceStatus} for retrieving the bridge state (i.e. IDLE, BUSY, a.s.o),</LI>
51  * <LI>{@link JsonBridgeAPI#getFirmware} for retrieving the firmware version of the bridge,</LI>
52  * <LI>{@link JsonBridgeAPI#getHouseStatus} for retrieving the information about device state changes recognized by the
53  * bridge,</LI>
54  * <LI>{@link JsonBridgeAPI#getLANConfig} for retrieving the complete LAN information of the bridge,</LI>
55  * <LI>{@link JsonBridgeAPI#getProduct} for retrieving the any information about a device behind the bridge,</LI>
56  * <LI>{@link JsonBridgeAPI#getProductLimitation} for retrieving the limitation information about a device behind the
57  * bridge,</LI>
58  * <LI>{@link JsonBridgeAPI#getProducts} for retrieving the any information for all devices behind the bridge,</LI>
59  * <LI>{@link JsonBridgeAPI#getScenes} for retrieving the any information for all scenes defined on the bridge,</LI>
60  * <LI>{@link JsonBridgeAPI#getWLANConfig} for retrieving the complete WLAN information of the bridge,</LI>
61  * <LI>{@link JsonBridgeAPI#login} for establishing a trusted connectivity by authentication,</LI>
62  * <LI>{@link JsonBridgeAPI#logout} for tearing down the trusted connectivity by deauthentication,</LI>
63  * <LI>{@link JsonBridgeAPI#runProductCommand} for manipulation of a device behind the bridge (i.e. instructing to
64  * modify a position),</LI>
65  * <LI>{@link JsonBridgeAPI#runProductDiscovery} for activation of learning mode of the bridge to discovery new
66  * products,</LI>
67  * <LI>{@link JsonBridgeAPI#runProductIdentification} for human-oriented identification a device behind the bridge (i.e.
68  * by winking or switching on-and-off),</LI>
69  * <LI>{@link JsonBridgeAPI#runProductSearch} for searching for lost products on the bridge,</LI>
70  * <LI>{@link JsonBridgeAPI#runScene} for manipulation of a set of devices behind the bridge which are tied together as
71  * scene,</LI>
72  * <LI>{@link JsonBridgeAPI#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 JsonBridgeAPI#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 JSON-protocol-specific communication for gateway interaction.
80  *
81  * @author Guenther Schreiner - Initial contribution.
82  */
83 @NonNullByDefault
84 class JsonBridgeAPI implements BridgeAPI {
85     private final Logger logger = LoggerFactory.getLogger(JsonBridgeAPI.class);
86
87     private final GetDeviceStatus jsonGetDeviceStatus = new JCgetDeviceStatus();
88     private final GetFirmware jsonGetFirmware = new JCgetFirmware();
89     private final GetLANConfig jsonGetLanConfig = new JCgetLANConfig();
90     private final GetProducts jsonGetProducts = new JCgetProducts();
91     private final GetScenes jsonGetScenes = new JCgetScenes();
92     private final GetWLANConfig jsonGetWLanConfig = new JCgetWLANConfig();
93     private final Login jsonLogin = new JClogin();
94     private final Logout jsonLogout = new JClogout();
95     private final RunProductDiscovery jsonRunProductDiscovery = new JCrunProductDiscovery();
96     private final RunProductIdentification jsonRunProductIdentification = new JCrunProductIdentification();
97     private final RunProductSearch jsonRunProductSearch = new JCrunProductSearch();
98     private final RunScene jsonRunScene = new JCrunScene();
99     private final SetSceneVelocity jsonSetSceneVelocity = new JCsetSceneVelocity();
100
101     /**
102      * Constructor.
103      * <P>
104      * Inherits the initialization of the binding-wide instance for dealing for common information and
105      * initializes the handler {@link org.openhab.binding.velux.internal.bridge.json.JsonVeluxBridge#bridgeAPI
106      * JsonVeluxBridge.bridgeAPI}
107      * to pass the interface methods.
108      *
109      * @param bridgeInstance refers to the binding-wide instance for dealing for common informations.
110      */
111     JsonBridgeAPI(VeluxBridgeInstance bridgeInstance) {
112         logger.trace("JsonBridgeAPI(constructor) called.");
113     }
114
115     @Override
116     public GetDeviceStatus getDeviceStatus() {
117         return jsonGetDeviceStatus;
118     }
119
120     @Override
121     public GetFirmware getFirmware() {
122         return jsonGetFirmware;
123     }
124
125     @Override
126     public @Nullable GetHouseStatus getHouseStatus() {
127         return null;
128     }
129
130     @Override
131     public GetLANConfig getLANConfig() {
132         return jsonGetLanConfig;
133     }
134
135     @Override
136     public @Nullable GetProduct getProduct() {
137         return null;
138     }
139
140     @Override
141     public @Nullable GetProductLimitation getProductLimitation() {
142         return null;
143     }
144
145     @Override
146     public @Nullable SetProductLimitation setProductLimitation() {
147         return null;
148     }
149
150     @Override
151     public GetProducts getProducts() {
152         return jsonGetProducts;
153     }
154
155     @Override
156     public GetScenes getScenes() {
157         return jsonGetScenes;
158     }
159
160     @Override
161     public GetWLANConfig getWLANConfig() {
162         return jsonGetWLanConfig;
163     }
164
165     @Override
166     public Login login() {
167         return jsonLogin;
168     }
169
170     @Override
171     public Logout logout() {
172         return jsonLogout;
173     }
174
175     @Override
176     public @Nullable RunProductCommand runProductCommand() {
177         return null;
178     }
179
180     @Override
181     public RunProductDiscovery runProductDiscovery() {
182         return jsonRunProductDiscovery;
183     }
184
185     @Override
186     public RunProductIdentification runProductIdentification() {
187         return jsonRunProductIdentification;
188     }
189
190     @Override
191     public RunProductSearch runProductSearch() {
192         return jsonRunProductSearch;
193     }
194
195     @Override
196     public RunScene runScene() {
197         return jsonRunScene;
198     }
199
200     @Override
201     public @Nullable SetHouseStatusMonitor setHouseStatusMonitor() {
202         return null;
203     }
204
205     @Override
206     public SetSceneVelocity setSceneVelocity() {
207         return jsonSetSceneVelocity;
208     }
209
210     @Override
211     public @Nullable RunReboot runReboot() {
212         return null;
213     }
214
215     @Override
216     public @Nullable GetProduct getProductStatus() {
217         return null;
218     }
219 }