]> git.basschouten.com Git - openhab-addons.git/blob
ed44c46450480039ca14d2f80c6265ed64710454
[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.paradoxalarm.internal.model;
14
15 /**
16  * The {@link Partition} Paradox partition states. Retrieved and parsed from RAM memory responses.
17  *
18  * @author Konstantin Polihronov - Initial contribution
19  */
20 public class PartitionState {
21
22     private static final String ARMED = "Armed";
23     private static final String DISARMED = "Disarmed";
24     private static final String IN_ALARM = "InAlarm";
25
26     private static final String ARMED_IN_NO_ENTRY = "NoEntry Armed";
27     private static final String ARMED_IN_STAY = "Stay Armed";
28     private static final String ARMED_IN_AWAY = "Away Armed";
29     private static final String FIRE_ALARM = "Fire Alarm";
30     private static final String AUDIBLE_ALARM = "Audible Alarm";
31     private static final String SILENT_ALARM = "Silent Alarm";
32     private boolean isArmed;
33     private boolean isArmedInAway;
34     private boolean isArmedInStay;
35     private boolean isArmedInNoEntry;
36     private boolean isInAlarm;
37     private boolean isInSilentAlarm;
38     private boolean isInAudibleAlarm;
39     private boolean isInFireAlarm;
40
41     private boolean isReadyToArm;
42     private boolean isInExitDelay;
43     private boolean isInEntryDelay;
44     private boolean isInTrouble;
45     private boolean hasAlarmInMemory;
46     private boolean isInZoneBypass;
47
48     private boolean hasZoneInTamperTrouble;
49     private boolean hasZoneInLowBatteryTrouble;
50     private boolean hasZoneInFireLoopTrouble;
51     private boolean hasZoneInSupervisionTrouble;
52
53     private boolean isStayInstantReady;
54     private boolean isForceReady;
55     private boolean isBypassReady;
56     private boolean isInhibitReady;
57     private boolean areAllZoneclosed;
58
59     public String getMainState() {
60         if (isInAlarm || isInSilentAlarm || isInAudibleAlarm || isInFireAlarm) {
61             return IN_ALARM;
62         } else {
63             return isArmed || isArmedInAway || isArmedInStay || isArmedInNoEntry ? ARMED : DISARMED;
64         }
65     }
66
67     public String getDetailedState() {
68         if (isInAlarm) {
69             if (isInSilentAlarm) {
70                 return SILENT_ALARM;
71             } else if (isInAudibleAlarm) {
72                 return AUDIBLE_ALARM;
73             } else if (isInFireAlarm) {
74                 return FIRE_ALARM;
75             }
76             return IN_ALARM;
77         } else if (isArmed) {
78             if (isArmedInAway) {
79                 return ARMED_IN_AWAY;
80             } else if (isArmedInStay) {
81                 return ARMED_IN_STAY;
82             } else if (isArmedInNoEntry) {
83                 return ARMED_IN_NO_ENTRY;
84             }
85             return ARMED;
86         }
87
88         return DISARMED;
89     }
90
91     @Override
92     public String toString() {
93         return "PartitionState [isArmed=" + isArmed + ", isArmedInAway=" + isArmedInAway + ", isArmedInStay="
94                 + isArmedInStay + ", isArmedInNoEntry=" + isArmedInNoEntry + ", isInAlarm=" + isInAlarm
95                 + ", isInSilentAlarm=" + isInSilentAlarm + ", isInAudibleAlarm=" + isInAudibleAlarm + ", isInFireAlarm="
96                 + isInFireAlarm + ", isReadyToArm=" + isReadyToArm + ", isInExitDelay=" + isInExitDelay
97                 + ", isInEntryDelay=" + isInEntryDelay + ", isInTrouble=" + isInTrouble + ", hasAlarmInMemory="
98                 + hasAlarmInMemory + ", isInZoneBypass=" + isInZoneBypass + ", hasZoneInTamperTrouble="
99                 + hasZoneInTamperTrouble + ", hasZoneInLowBatteryTrouble=" + hasZoneInLowBatteryTrouble
100                 + ", hasZoneInFireLoopTrouble=" + hasZoneInFireLoopTrouble + ", hasZoneInSupervisionTrouble="
101                 + hasZoneInSupervisionTrouble + ", isStayInstantReady=" + isStayInstantReady + ", isForceReady="
102                 + isForceReady + ", isBypassReady=" + isBypassReady + ", isInhibitReady=" + isInhibitReady
103                 + ", areAllZoneclosed=" + areAllZoneclosed + "]";
104     }
105
106     public boolean isArmed() {
107         return isArmed;
108     }
109
110     public void setArmed(boolean isArmed) {
111         this.isArmed = isArmed;
112     }
113
114     public boolean isArmedInAway() {
115         return isArmedInAway;
116     }
117
118     public void setArmedInAway(boolean isArmedInAway) {
119         this.isArmedInAway = isArmedInAway;
120     }
121
122     public boolean isArmedInStay() {
123         return isArmedInStay;
124     }
125
126     public void setArmedInStay(boolean isArmedInStay) {
127         this.isArmedInStay = isArmedInStay;
128     }
129
130     public boolean isArmedInNoEntry() {
131         return isArmedInNoEntry;
132     }
133
134     public void setArmedInNoEntry(boolean isArmedInNoEntry) {
135         this.isArmedInNoEntry = isArmedInNoEntry;
136     }
137
138     public boolean isInAlarm() {
139         return isInAlarm;
140     }
141
142     public void setInAlarm(boolean isInAlarm) {
143         this.isInAlarm = isInAlarm;
144     }
145
146     public boolean isInSilentAlarm() {
147         return isInSilentAlarm;
148     }
149
150     public void setInSilentAlarm(boolean isInSilentAlarm) {
151         this.isInSilentAlarm = isInSilentAlarm;
152     }
153
154     public boolean isInAudibleAlarm() {
155         return isInAudibleAlarm;
156     }
157
158     public void setInAudibleAlarm(boolean isInAudibleAlarm) {
159         this.isInAudibleAlarm = isInAudibleAlarm;
160     }
161
162     public boolean isInFireAlarm() {
163         return isInFireAlarm;
164     }
165
166     public void setInFireAlarm(boolean isInFireAlarm) {
167         this.isInFireAlarm = isInFireAlarm;
168     }
169
170     public boolean isReadyToArm() {
171         return isReadyToArm;
172     }
173
174     public void setReadyToArm(boolean isReadyToArm) {
175         this.isReadyToArm = isReadyToArm;
176     }
177
178     public boolean isInExitDelay() {
179         return isInExitDelay;
180     }
181
182     public void setInExitDelay(boolean isInExitDelay) {
183         this.isInExitDelay = isInExitDelay;
184     }
185
186     public boolean isInEntryDelay() {
187         return isInEntryDelay;
188     }
189
190     public void setInEntryDelay(boolean isInEntryDelay) {
191         this.isInEntryDelay = isInEntryDelay;
192     }
193
194     public boolean isInTrouble() {
195         return isInTrouble;
196     }
197
198     public void setInTrouble(boolean isInTrouble) {
199         this.isInTrouble = isInTrouble;
200     }
201
202     public boolean isHasAarmInMemory() {
203         return hasAlarmInMemory;
204     }
205
206     public void setHasAarmInMemory(boolean hasAarmInMemory) {
207         this.hasAlarmInMemory = hasAarmInMemory;
208     }
209
210     public boolean isInZoneBypass() {
211         return isInZoneBypass;
212     }
213
214     public void setInZoneBypass(boolean isInZoneBypass) {
215         this.isInZoneBypass = isInZoneBypass;
216     }
217
218     public boolean isHasZoneInTamperTrouble() {
219         return hasZoneInTamperTrouble;
220     }
221
222     public void setHasZoneInTamperTrouble(boolean hasZoneInTamperTrouble) {
223         this.hasZoneInTamperTrouble = hasZoneInTamperTrouble;
224     }
225
226     public boolean isHasZoneInLowBatteryTrouble() {
227         return hasZoneInLowBatteryTrouble;
228     }
229
230     public void setHasZoneInLowBatteryTrouble(boolean hasZoneInLowBatteryTrouble) {
231         this.hasZoneInLowBatteryTrouble = hasZoneInLowBatteryTrouble;
232     }
233
234     public boolean isHasZoneInFireLoopTrouble() {
235         return hasZoneInFireLoopTrouble;
236     }
237
238     public void setHasZoneInFireLoopTrouble(boolean hasZoneInFireLoopTrouble) {
239         this.hasZoneInFireLoopTrouble = hasZoneInFireLoopTrouble;
240     }
241
242     public boolean isHasZoneInSupervisionTrouble() {
243         return hasZoneInSupervisionTrouble;
244     }
245
246     public void setHasZoneInSupervisionTrouble(boolean hasZoneInSupervisionTrouble) {
247         this.hasZoneInSupervisionTrouble = hasZoneInSupervisionTrouble;
248     }
249
250     public boolean isStayInstantReady() {
251         return isStayInstantReady;
252     }
253
254     public void setStayInstantReady(boolean isStayInstantReady) {
255         this.isStayInstantReady = isStayInstantReady;
256     }
257
258     public boolean isForceReady() {
259         return isForceReady;
260     }
261
262     public void setForceReady(boolean isForceReady) {
263         this.isForceReady = isForceReady;
264     }
265
266     public boolean isBypassReady() {
267         return isBypassReady;
268     }
269
270     public void setBypassReady(boolean isBypassReady) {
271         this.isBypassReady = isBypassReady;
272     }
273
274     public boolean isInhibitReady() {
275         return isInhibitReady;
276     }
277
278     public void setInhibitReady(boolean isInhibitReady) {
279         this.isInhibitReady = isInhibitReady;
280     }
281
282     public boolean isAreAllZoneclosed() {
283         return areAllZoneclosed;
284     }
285
286     public void setAllZoneClosed(boolean areAllZoneclosed) {
287         this.areAllZoneclosed = areAllZoneclosed;
288     }
289
290     public boolean isHasAlarmInMemory() {
291         return hasAlarmInMemory;
292     }
293
294     public void setHasAlarmInMemory(boolean hasAlarmInMemory) {
295         this.hasAlarmInMemory = hasAlarmInMemory;
296     }
297 }