]> git.basschouten.com Git - openhab-addons.git/blob
a204fbffecad1f3b1c828602b2501290724e386c
[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.freebox.internal.api.model;
14
15 import java.util.List;
16
17 /**
18  * The {@link FreeboxSystemConfig} is the Java class used to map the "SystemConfig"
19  * structure used by the system API
20  * https://dev.freebox.fr/sdk/os/system/#
21  *
22  * @author Laurent Garnier - Initial contribution
23  */
24 public class FreeboxSystemConfig {
25     private String firmwareVersion;
26     private String mac;
27     private String serial;
28     private String uptime;
29     private long uptimeVal;
30     private String boardName;
31     private int tempCpum;
32     private int tempSw;
33     private int tempCpub;
34     private int fanRpm;
35     private boolean boxAuthenticated;
36     private String diskStatus;
37     private String boxFlavor;
38     private String userMainStorage;
39     private List<FreeboxSensor> fans;
40     private List<FreeboxSensor> sensors;
41
42     public String getFirmwareVersion() {
43         return firmwareVersion;
44     }
45
46     public String getMac() {
47         return mac;
48     }
49
50     public String getSerial() {
51         return serial;
52     }
53
54     public String getUptime() {
55         return uptime;
56     }
57
58     public long getUptimeVal() {
59         return uptimeVal;
60     }
61
62     public String getBoardName() {
63         return boardName;
64     }
65
66     public int getTempCpum() {
67         if (sensors != null) {
68             for (FreeboxSensor sensor : sensors) {
69                 if ("temp_cpum".equals(sensor.getId())) {
70                     return sensor.getValue();
71                 }
72             }
73         }
74         return tempCpum;
75     }
76
77     public int getTempSw() {
78         if (sensors != null) {
79             for (FreeboxSensor sensor : sensors) {
80                 if ("temp_sw".equals(sensor.getId())) {
81                     return sensor.getValue();
82                 }
83             }
84         }
85         return tempSw;
86     }
87
88     public int getTempCpub() {
89         if (sensors != null) {
90             for (FreeboxSensor sensor : sensors) {
91                 if ("temp_cpub".equals(sensor.getId())) {
92                     return sensor.getValue();
93                 }
94             }
95         }
96         return tempCpub;
97     }
98
99     public int getFanRpm() {
100         if (fans != null) {
101             for (FreeboxSensor fan : fans) {
102                 if ("fan0_speed".equals(fan.getId())) {
103                     return fan.getValue();
104                 }
105             }
106         }
107         return fanRpm;
108     }
109
110     public boolean isBoxAuthenticated() {
111         return boxAuthenticated;
112     }
113
114     public String getDiskStatus() {
115         return diskStatus;
116     }
117
118     public String getBoxFlavor() {
119         return boxFlavor;
120     }
121
122     public String getUserMainStorage() {
123         return userMainStorage;
124     }
125 }