]> git.basschouten.com Git - openhab-addons.git/blob
b5a0d9088e8939fd10ab2a1ef179657d49bb93e3
[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.livisismarthome.internal.client.api.entity.device;
14
15 import org.openhab.binding.livisismarthome.internal.client.api.entity.state.BooleanStateDTO;
16 import org.openhab.binding.livisismarthome.internal.client.api.entity.state.DateTimeStateDTO;
17 import org.openhab.binding.livisismarthome.internal.client.api.entity.state.DoubleStateDTO;
18 import org.openhab.binding.livisismarthome.internal.client.api.entity.state.IntegerStateDTO;
19 import org.openhab.binding.livisismarthome.internal.client.api.entity.state.StringStateDTO;
20
21 import com.google.gson.annotations.SerializedName;
22
23 /**
24  * Holds the state of the Device.
25  *
26  * @author Oliver Kuhl - Initial contribution
27  *
28  */
29 public class StateDTO {
30     /** Standard device states */
31     @SerializedName("deviceInclusionState")
32     private StringStateDTO deviceInclusionState;
33     @SerializedName("deviceConfigurationState")
34     private StringStateDTO deviceConfigurationState;
35     private BooleanStateDTO isReachable;
36     private StringStateDTO updateState;
37     private StringStateDTO firmwareVersion;
38     @SerializedName("WHRating")
39     private DoubleStateDTO wHRating;
40
41     /** SHC device states */
42     // Removed updateAvailable because it is different between version 1 and 2 devices and not used anyway
43     // Related to openhab-addons #6613
44     // private StringState updateAvailable
45     private DateTimeStateDTO lastReboot;
46     private DoubleStateDTO memoryLoad;
47     @SerializedName("CPULoad")
48     private DoubleStateDTO cpuLoad;
49     @SerializedName("LBDongleAttached")
50     private BooleanStateDTO lBDongleAttached;
51     @SerializedName("MBusDongleAttached")
52     private BooleanStateDTO mBusDongleAttached;
53     private IntegerStateDTO configVersion;
54     @SerializedName("OSState")
55     private StringStateDTO osState;
56     private IntegerStateDTO wifiSignalStrength;
57     private StringStateDTO ethIpAddress;
58     private StringStateDTO wifiIpAddress;
59     private StringStateDTO ethMacAddress;
60     private StringStateDTO wifiMacAddress;
61     private StringStateDTO inUseAdapter;
62     private BooleanStateDTO discoveryActive;
63     private StringStateDTO operationStatus;
64     private DoubleStateDTO currentUtcOffset;
65     private DoubleStateDTO cpuUsage;
66     private DoubleStateDTO diskUsage;
67     private DoubleStateDTO memoryUsage;
68
69     public StateDTO() {
70         deviceInclusionState = new StringStateDTO();
71         deviceConfigurationState = new StringStateDTO();
72         isReachable = new BooleanStateDTO();
73         updateState = new StringStateDTO();
74         firmwareVersion = new StringStateDTO();
75         wHRating = new DoubleStateDTO();
76         lastReboot = new DateTimeStateDTO();
77         memoryLoad = new DoubleStateDTO();
78         cpuLoad = new DoubleStateDTO();
79         lBDongleAttached = new BooleanStateDTO();
80         mBusDongleAttached = new BooleanStateDTO();
81         configVersion = new IntegerStateDTO();
82         osState = new StringStateDTO();
83         wifiSignalStrength = new IntegerStateDTO();
84         ethIpAddress = new StringStateDTO();
85         wifiIpAddress = new StringStateDTO();
86         ethMacAddress = new StringStateDTO();
87         wifiMacAddress = new StringStateDTO();
88         inUseAdapter = new StringStateDTO();
89         discoveryActive = new BooleanStateDTO();
90         operationStatus = new StringStateDTO();
91         currentUtcOffset = new DoubleStateDTO();
92         cpuUsage = new DoubleStateDTO();
93         diskUsage = new DoubleStateDTO();
94         memoryUsage = new DoubleStateDTO();
95     }
96
97     /**
98      * @return the deviceInclusionState
99      */
100     public StringStateDTO getDeviceInclusionState() {
101         return deviceInclusionState;
102     }
103
104     /**
105      * @param deviceInclusionState the deviceInclusionState to set
106      */
107     public void setDeviceInclusionState(StringStateDTO deviceInclusionState) {
108         this.deviceInclusionState = deviceInclusionState;
109     }
110
111     /**
112      * @return the deviceConfigurationState
113      */
114     public StringStateDTO getDeviceConfigurationState() {
115         return deviceConfigurationState;
116     }
117
118     /**
119      * @param deviceConfigurationState the deviceConfigurationState to set
120      */
121     public void setDeviceConfigurationState(StringStateDTO deviceConfigurationState) {
122         this.deviceConfigurationState = deviceConfigurationState;
123     }
124
125     /**
126      * @return the isReachable
127      */
128     public BooleanStateDTO getIsReachable() {
129         return isReachable;
130     }
131
132     /**
133      * @param isReachable the isReachable to set
134      */
135     public void setIsReachable(BooleanStateDTO isReachable) {
136         this.isReachable = isReachable;
137     }
138
139     /**
140      * @return the updateState
141      */
142     public StringStateDTO getUpdateState() {
143         return updateState;
144     }
145
146     /**
147      * @param updateState the updateState to set
148      */
149     public void setUpdateState(StringStateDTO updateState) {
150         this.updateState = updateState;
151     }
152
153     /**
154      * @return the firmwareVersion
155      */
156     public StringStateDTO getFirmwareVersion() {
157         return firmwareVersion;
158     }
159
160     /**
161      * @param firmwareVersion the firmwareVersion to set
162      */
163     public void setFirmwareVersion(StringStateDTO firmwareVersion) {
164         this.firmwareVersion = firmwareVersion;
165     }
166
167     /**
168      * @return the wHRating
169      */
170     public DoubleStateDTO getWHRating() {
171         return wHRating;
172     }
173
174     /**
175      * @param wHRating the wHRating to set
176      */
177     public void setWHRating(DoubleStateDTO wHRating) {
178         this.wHRating = wHRating;
179     }
180
181     /**
182      * @return the lastReboot
183      */
184     public DateTimeStateDTO getLastReboot() {
185         return lastReboot;
186     }
187
188     /**
189      * @param lastReboot the lastReboot to set
190      */
191     public void setLastReboot(DateTimeStateDTO lastReboot) {
192         this.lastReboot = lastReboot;
193     }
194
195     /**
196      * @return the memoryLoad
197      */
198     public DoubleStateDTO getMemoryLoad() {
199         return memoryLoad;
200     }
201
202     /**
203      * @param memoryLoad the memoryLoad to set
204      */
205     public void setMemoryLoad(DoubleStateDTO memoryLoad) {
206         this.memoryLoad = memoryLoad;
207     }
208
209     /**
210      * @return the cPULoad
211      */
212     public DoubleStateDTO getCPULoad() {
213         return cpuLoad;
214     }
215
216     /**
217      * @param cpuLoad the cPULoad to set
218      */
219     public void setCPULoad(DoubleStateDTO cpuLoad) {
220         this.cpuLoad = cpuLoad;
221     }
222
223     /**
224      * @return the lBDongleAttached
225      */
226     public BooleanStateDTO getLBDongleAttached() {
227         return lBDongleAttached;
228     }
229
230     /**
231      * @param lBDongleAttached the lBDongleAttached to set
232      */
233     public void setLBDongleAttached(BooleanStateDTO lBDongleAttached) {
234         this.lBDongleAttached = lBDongleAttached;
235     }
236
237     /**
238      * @return the mBusDongleAttached
239      */
240     public BooleanStateDTO getMBusDongleAttached() {
241         return mBusDongleAttached;
242     }
243
244     /**
245      * @param mBusDongleAttached the mBusDongleAttached to set
246      */
247     public void setMBusDongleAttached(BooleanStateDTO mBusDongleAttached) {
248         this.mBusDongleAttached = mBusDongleAttached;
249     }
250
251     /**
252      * @return the configVersion
253      */
254     public IntegerStateDTO getConfigVersion() {
255         return configVersion;
256     }
257
258     /**
259      * @param configVersion the configVersion to set
260      */
261     public void setConfigVersion(IntegerStateDTO configVersion) {
262         this.configVersion = configVersion;
263     }
264
265     /**
266      * @return the oSState
267      */
268     public StringStateDTO getOSState() {
269         return osState;
270     }
271
272     /**
273      * @param osState the oSState to set
274      */
275     public void setOSState(StringStateDTO osState) {
276         this.osState = osState;
277     }
278
279     /**
280      * @return the wifiSignalStrength
281      */
282     public IntegerStateDTO getWifiSignalStrength() {
283         return wifiSignalStrength;
284     }
285
286     /**
287      * @param wifiSignalStrength the wifiSignalStrength to set
288      */
289     public void setWifiSignalStrength(IntegerStateDTO wifiSignalStrength) {
290         this.wifiSignalStrength = wifiSignalStrength;
291     }
292
293     /**
294      * @return the ethIpAddress
295      */
296     public StringStateDTO getEthIpAddress() {
297         return ethIpAddress;
298     }
299
300     /**
301      * @param ethIpAddress the ethIpAddress to set
302      */
303     public void setEthIpAddress(StringStateDTO ethIpAddress) {
304         this.ethIpAddress = ethIpAddress;
305     }
306
307     /**
308      * @return the wifiIpAddress
309      */
310     public StringStateDTO getWifiIpAddress() {
311         return wifiIpAddress;
312     }
313
314     /**
315      * @param wifiIpAddress the wifiIpAddress to set
316      */
317     public void setWifiIpAddress(StringStateDTO wifiIpAddress) {
318         this.wifiIpAddress = wifiIpAddress;
319     }
320
321     /**
322      * @return the ethMacAddress
323      */
324     public StringStateDTO getEthMacAddress() {
325         return ethMacAddress;
326     }
327
328     /**
329      * @param ethMacAddress the ethMacAddress to set
330      */
331     public void setEthMacAddress(StringStateDTO ethMacAddress) {
332         this.ethMacAddress = ethMacAddress;
333     }
334
335     /**
336      * @return the wifiMacAddress
337      */
338     public StringStateDTO getWifiMacAddress() {
339         return wifiMacAddress;
340     }
341
342     /**
343      * @param wifiMacAddress the wifiMacAddress to set
344      */
345     public void setWifiMacAddress(StringStateDTO wifiMacAddress) {
346         this.wifiMacAddress = wifiMacAddress;
347     }
348
349     /**
350      * @return the inUseAdapter
351      */
352     public StringStateDTO getInUseAdapter() {
353         return inUseAdapter;
354     }
355
356     /**
357      * @param inUseAdapter the inUseAdapter to set
358      */
359     public void setInUseAdapter(StringStateDTO inUseAdapter) {
360         this.inUseAdapter = inUseAdapter;
361     }
362
363     /**
364      * @return the discoveryActive
365      */
366     public BooleanStateDTO getDiscoveryActive() {
367         return discoveryActive;
368     }
369
370     /**
371      * @param discoveryActive the discoveryActive to set
372      */
373     public void setDiscoveryActive(BooleanStateDTO discoveryActive) {
374         this.discoveryActive = discoveryActive;
375     }
376
377     /**
378      * @return the operationStatus
379      */
380     public StringStateDTO getOperationStatus() {
381         return operationStatus;
382     }
383
384     /**
385      * @param operationStatus the operationStatus to set
386      */
387     public void setOperationStatus(StringStateDTO operationStatus) {
388         this.operationStatus = operationStatus;
389     }
390
391     /**
392      * @return the operationStatus
393      */
394     public StringStateDTO getOperationStatus(boolean isSHCClassic) {
395         if (isSHCClassic) {
396             return getOSState();
397         }
398         return getOperationStatus();
399     }
400
401     /**
402      * @return the currentUtcOffset
403      */
404     public DoubleStateDTO getCurrentUtcOffset() {
405         return currentUtcOffset;
406     }
407
408     /**
409      * @param currentUtcOffset the currentUtcOffset to set
410      */
411     public void setCurrentUtcOffset(DoubleStateDTO currentUtcOffset) {
412         this.currentUtcOffset = currentUtcOffset;
413     }
414
415     /**
416      * @return the cpuUsage
417      */
418     public DoubleStateDTO getCpuUsage() {
419         return cpuUsage;
420     }
421
422     /**
423      * @param cpuUsage the cpuUsage to set
424      */
425     public void setCpuUsage(DoubleStateDTO cpuUsage) {
426         this.cpuUsage = cpuUsage;
427     }
428
429     public DoubleStateDTO getCpuUsage(boolean isSHCClassic) {
430         if (isSHCClassic) {
431             return getCPULoad();
432         }
433         return getCpuUsage();
434     }
435
436     /**
437      * @return the diskUsage
438      */
439     public DoubleStateDTO getDiskUsage() {
440         return diskUsage;
441     }
442
443     /**
444      * @param diskUsage the diskUsage to set
445      */
446     public void setDiskUsage(DoubleStateDTO diskUsage) {
447         this.diskUsage = diskUsage;
448     }
449
450     /**
451      * @return the memoryUsage
452      */
453     public DoubleStateDTO getMemoryUsage() {
454         return memoryUsage;
455     }
456
457     /**
458      * @param memoryUsage the memoryUsage to set
459      */
460     public void setMemoryUsage(DoubleStateDTO memoryUsage) {
461         this.memoryUsage = memoryUsage;
462     }
463
464     /**
465      * @return the memoryUsage
466      */
467     public DoubleStateDTO getMemoryUsage(boolean isSHCClassic) {
468         if (isSHCClassic) {
469             return getMemoryLoad();
470         }
471         return getMemoryUsage();
472     }
473 }