]> git.basschouten.com Git - openhab-addons.git/blob
97baedfbdfda4da0628c6378db9bf5e243b36025
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.powermax.internal.state;
14
15 import java.util.HashMap;
16 import java.util.Map;
17
18 /**
19  * A class to store the state of the alarm system
20  *
21  * @author Laurent Garnier - Initial contribution
22  */
23 public class PowermaxState {
24
25     private Boolean powerlinkMode;
26     private Boolean downloadMode;
27     private PowermaxZoneState[] zones;
28     private Boolean[] pgmX10DevicesStatus;
29     private Boolean ready;
30     private Boolean bypass;
31     private Boolean alarmActive;
32     private Boolean trouble;
33     private Boolean alertInMemory;
34     private String statusStr;
35     private String armMode;
36     private Boolean downloadSetupRequired;
37     private Long lastKeepAlive;
38     private byte[] updateSettings;
39     private String panelStatus;
40     private String alarmType;
41     private String troubleType;
42     private String[] eventLog;
43     private Map<Integer, Byte> updatedZoneNames;
44     private Map<Integer, Integer> updatedZoneInfos;
45
46     /**
47      * Constructor (default values)
48      */
49     public PowermaxState(PowermaxPanelSettings panelSettings) {
50         zones = new PowermaxZoneState[panelSettings.getNbZones()];
51         for (int i = 0; i < panelSettings.getNbZones(); i++) {
52             zones[i] = new PowermaxZoneState();
53         }
54         pgmX10DevicesStatus = new Boolean[panelSettings.getNbPGMX10Devices()];
55         updatedZoneNames = new HashMap<>();
56         updatedZoneInfos = new HashMap<>();
57     }
58
59     /**
60      * Get the current mode (standard or Powerlink)
61      *
62      * @return true when the current mode is Powerlink; false when standard
63      */
64     public Boolean isPowerlinkMode() {
65         return powerlinkMode;
66     }
67
68     /**
69      * Set the current mode (standard or Powerlink)
70      *
71      * @param powerlinkMode true for Powerlink or false for standard
72      */
73     public void setPowerlinkMode(Boolean powerlinkMode) {
74         this.powerlinkMode = powerlinkMode;
75     }
76
77     /**
78      * Get whether or not the setup is being downloaded
79      *
80      * @return true when downloading the setup
81      */
82     public Boolean isDownloadMode() {
83         return downloadMode;
84     }
85
86     /**
87      * Set whether or not the setup is being downloaded
88      *
89      * @param downloadMode true when downloading the setup
90      */
91     public void setDownloadMode(Boolean downloadMode) {
92         this.downloadMode = downloadMode;
93     }
94
95     /**
96      * Get whether or not the zone sensor is tripped
97      *
98      * @param zone the index of the zone (first zone is index 1)
99      *
100      * @return true when the zone sensor is tripped
101      */
102     public Boolean isSensorTripped(int zone) {
103         return ((zone < 1) || (zone > zones.length)) ? null : zones[zone - 1].isTripped();
104     }
105
106     /**
107      * Set whether or not the zone sensor is tripped
108      *
109      * @param zone the index of the zone (first zone is index 1)
110      * @param tripped true if tripped
111      */
112     public void setSensorTripped(int zone, Boolean tripped) {
113         if ((zone >= 1) && (zone <= zones.length)) {
114             this.zones[zone - 1].setTripped(tripped);
115         }
116     }
117
118     /**
119      * Get the timestamp when the zone sensor was last tripped
120      *
121      * @param zone the index of the zone (first zone is index 1)
122      *
123      * @return the timestamp
124      */
125     public Long getSensorLastTripped(int zone) {
126         return ((zone < 1) || (zone > zones.length)) ? null : zones[zone - 1].getLastTripped();
127     }
128
129     /**
130      * Set the timestamp when the zone sensor was last tripped
131      *
132      * @param zone the index of the zone (first zone is index 1)
133      * @param lastTripped the timestamp
134      */
135     public void setSensorLastTripped(int zone, Long lastTripped) {
136         if ((zone >= 1) && (zone <= zones.length)) {
137             this.zones[zone - 1].setLastTripped(lastTripped);
138         }
139     }
140
141     /**
142      * Compare the sensor last trip with a given time
143      *
144      * @param zone the index of the zone (first zone is index 1)
145      * @param refTime the time in ms to compare with
146      *
147      * @return true if the sensor is tripped and last trip is older than the given time
148      */
149     public boolean isLastTripBeforeTime(int zone, long refTime) {
150         return ((zone < 1) || (zone > zones.length)) ? false : zones[zone - 1].isLastTripBeforeTime(refTime);
151     }
152
153     /**
154      * Get whether or not the battery of the zone sensor is low
155      *
156      * @param zone the index of the zone (first zone is index 1)
157      *
158      * @return true when the battery is low
159      */
160     public Boolean isSensorLowBattery(int zone) {
161         return ((zone < 1) || (zone > zones.length)) ? null : zones[zone - 1].isLowBattery();
162     }
163
164     /**
165      * Set whether or not the battery of the zone sensor is low
166      *
167      * @param zone the index of the zone (first zone is index 1)
168      * @param lowBattery true if battery is low
169      */
170     public void setSensorLowBattery(int zone, Boolean lowBattery) {
171         if ((zone >= 1) && (zone <= zones.length)) {
172             this.zones[zone - 1].setLowBattery(lowBattery);
173         }
174     }
175
176     /**
177      * Get whether or not the zone sensor is bypassed
178      *
179      * @param zone the index of the zone (first zone is index 1)
180      *
181      * @return true if bypassed
182      */
183     public Boolean isSensorBypassed(int zone) {
184         return ((zone < 1) || (zone > zones.length)) ? null : zones[zone - 1].isBypassed();
185     }
186
187     /**
188      * Set whether or not the zone sensor is bypassed
189      *
190      * @param zone the index of the zone (first zone is index 1)
191      * @param bypassed true if bypassed
192      */
193     public void setSensorBypassed(int zone, Boolean bypassed) {
194         if ((zone >= 1) && (zone <= zones.length)) {
195             this.zones[zone - 1].setBypassed(bypassed);
196         }
197     }
198
199     /**
200      * Get whether or not the zone sensor is armed
201      *
202      * @param zone the index of the zone (first zone is index 1)
203      *
204      * @return true if armed
205      */
206     public Boolean isSensorArmed(int zone) {
207         return ((zone < 1) || (zone > zones.length)) ? null : zones[zone - 1].isArmed();
208     }
209
210     /**
211      * Set whether or not the zone sensor is armed
212      *
213      * @param zone the index of the zone (first zone is index 1)
214      * @param armed true if armed
215      */
216     public void setSensorArmed(int zone, Boolean armed) {
217         if ((zone >= 1) && (zone <= zones.length)) {
218             this.zones[zone - 1].setArmed(armed);
219         }
220     }
221
222     /**
223      * Get the status of a PGM or X10 device
224      *
225      * @param device the index of the PGM/X10 device (0 s for PGM; for X10 device is index 1)
226      *
227      * @return the status (true or false)
228      */
229     public Boolean getPGMX10DeviceStatus(int device) {
230         return ((device < 0) || (device >= pgmX10DevicesStatus.length)) ? null : pgmX10DevicesStatus[device];
231     }
232
233     /**
234      * Set the status of a PGM or X10 device
235      *
236      * @param device the index of the PGM/X10 device (0 s for PGM; for X10 device is index 1)
237      * @param status true or false
238      */
239     public void setPGMX10DeviceStatus(int device, Boolean status) {
240         if ((device >= 0) && (device < pgmX10DevicesStatus.length)) {
241             this.pgmX10DevicesStatus[device] = status;
242         }
243     }
244
245     /**
246      * Get whether or not the panel is ready
247      *
248      * @return true if ready
249      */
250     public Boolean isReady() {
251         return ready;
252     }
253
254     /**
255      * Set whether or not the panel is ready
256      *
257      * @param ready true if ready
258      */
259     public void setReady(Boolean ready) {
260         this.ready = ready;
261     }
262
263     /**
264      * Get whether or not at least one zone is bypassed
265      *
266      * @return true if at least one zone is bypassed
267      */
268     public Boolean isBypass() {
269         return bypass;
270     }
271
272     /**
273      * Set whether or not at least one zone is bypassed
274      *
275      * @param bypass true if at least one zone is bypassed
276      */
277     public void setBypass(Boolean bypass) {
278         this.bypass = bypass;
279     }
280
281     /**
282      * Get whether or not the alarm is active
283      *
284      * @return true if active
285      */
286     public Boolean isAlarmActive() {
287         return alarmActive;
288     }
289
290     /**
291      * Set whether or not the alarm is active
292      *
293      * @param alarmActive true if the alarm is active
294      */
295     public void setAlarmActive(Boolean alarmActive) {
296         this.alarmActive = alarmActive;
297     }
298
299     /**
300      * Get whether or not the panel is identifying a trouble
301      *
302      * @return true if the panel is identifying a trouble
303      */
304     public Boolean isTrouble() {
305         return trouble;
306     }
307
308     /**
309      * Set whether or not the panel is identifying a trouble
310      *
311      * @param trouble true if trouble is identified
312      */
313     public void setTrouble(Boolean trouble) {
314         this.trouble = trouble;
315     }
316
317     /**
318      * Get whether or not the panel has saved an alert in memory
319      *
320      * @return true if the panel has saved an alert in memory
321      */
322     public Boolean isAlertInMemory() {
323         return alertInMemory;
324     }
325
326     /**
327      * Set whether or not the panel has saved an alert in memory
328      *
329      * @param alertInMemory true if an alert is saved in memory
330      */
331     public void setAlertInMemory(Boolean alertInMemory) {
332         this.alertInMemory = alertInMemory;
333     }
334
335     /**
336      * Get the partition status
337      *
338      * @return the status as a short string
339      */
340     public String getStatusStr() {
341         return statusStr;
342     }
343
344     /**
345      * Set the partition status
346      *
347      * @param statusStr the status as a short string
348      */
349     public void setStatusStr(String statusStr) {
350         this.statusStr = statusStr;
351     }
352
353     /**
354      * Get the arming name
355      *
356      * @return the arming mode
357      */
358     public String getArmMode() {
359         return armMode;
360     }
361
362     /**
363      * Set the arming name
364      *
365      * @param armMode the arming name
366      */
367     public void setArmMode(String armMode) {
368         this.armMode = armMode;
369     }
370
371     /**
372      * Get whether or not the setup downloading is required
373      *
374      * @return true when downloading the setup is required
375      */
376     public Boolean isDownloadSetupRequired() {
377         return downloadSetupRequired;
378     }
379
380     /**
381      * Set whether or not the setup downloading is required
382      *
383      * @param downloadSetupRequired true when downloading setup is required
384      */
385     public void setDownloadSetupRequired(Boolean downloadSetupRequired) {
386         this.downloadSetupRequired = downloadSetupRequired;
387     }
388
389     /**
390      * Get the timestamp of the last received "keep alive" message
391      *
392      * @return the timestamp
393      */
394     public Long getLastKeepAlive() {
395         return lastKeepAlive;
396     }
397
398     /**
399      * Set the timestamp of the last received "keep alive" message
400      *
401      * @param lastKeepAlive the timestamp
402      */
403     public void setLastKeepAlive(Long lastKeepAlive) {
404         this.lastKeepAlive = lastKeepAlive;
405     }
406
407     /**
408      * Get the raw buffer containing all the settings
409      *
410      * @return the raw buffer as a table of bytes
411      */
412     public byte[] getUpdateSettings() {
413         return updateSettings;
414     }
415
416     /**
417      * Set the raw buffer containing all the settings
418      *
419      * @param updateSettings the raw buffer as a table of bytes
420      */
421     public void setUpdateSettings(byte[] updateSettings) {
422         this.updateSettings = updateSettings;
423     }
424
425     /**
426      * Get the panel status
427      *
428      * @return the panel status
429      */
430     public String getPanelStatus() {
431         return panelStatus;
432     }
433
434     /**
435      * Set the panel status
436      *
437      * @param panelStatus the status as a short string
438      */
439     public void setPanelStatus(String panelStatus) {
440         this.panelStatus = panelStatus;
441     }
442
443     /**
444      * Get the kind of the current alarm identified by the panel
445      *
446      * @return the kind of the current alarm; null if no alarm
447      */
448     public String getAlarmType() {
449         return alarmType;
450     }
451
452     /**
453      * Set the kind of the current alarm identified by the panel
454      *
455      * @param alarmType the kind of alarm (set it to null if no alarm)
456      */
457     public void setAlarmType(String alarmType) {
458         this.alarmType = alarmType;
459     }
460
461     /**
462      * Get the kind of the current trouble identified by the panel
463      *
464      * @return the kind of the current trouble; null if no trouble
465      */
466     public String getTroubleType() {
467         return troubleType;
468     }
469
470     /**
471      * Set the kind of the current trouble identified by the panel
472      *
473      * @param troubleType the kind of trouble (set it to null if no trouble)
474      */
475     public void setTroubleType(String troubleType) {
476         this.troubleType = troubleType;
477     }
478
479     /**
480      * Get the number of entries in the event log
481      *
482      * @return the number of entries
483      */
484     public int getEventLogSize() {
485         return (eventLog == null) ? 0 : eventLog.length;
486     }
487
488     /**
489      * Set the number of entries in the event log
490      *
491      * @param size the number of entries
492      */
493     public void setEventLogSize(int size) {
494         eventLog = new String[size];
495     }
496
497     /**
498      * Get one entry from the event logs
499      *
500      * @param index the entry index (1 for the most recent entry)
501      *
502      * @return the entry value (event)
503      */
504     public String getEventLog(int index) {
505         return ((index < 1) || (index > getEventLogSize())) ? null : eventLog[index - 1];
506     }
507
508     /**
509      * Set one entry from the event logs
510      *
511      * @param index the entry index (1 for the most recent entry)
512      * @param event the entry value (event)
513      */
514     public void setEventLog(int index, String event) {
515         if ((index >= 1) && (index <= getEventLogSize())) {
516             this.eventLog[index - 1] = event;
517         }
518     }
519
520     public Map<Integer, Byte> getUpdatedZoneNames() {
521         return updatedZoneNames;
522     }
523
524     public void updateZoneName(int zoneIdx, byte zoneNameIdx) {
525         this.updatedZoneNames.put(zoneIdx, zoneNameIdx);
526     }
527
528     public Map<Integer, Integer> getUpdatedZoneInfos() {
529         return updatedZoneInfos;
530     }
531
532     public void updateZoneInfo(int zoneIdx, int zoneInfo) {
533         this.updatedZoneInfos.put(zoneIdx, zoneInfo);
534     }
535
536     /**
537      * Get the panel mode
538      *
539      * @return either Download or Powerlink or Standard
540      */
541     public String getPanelMode() {
542         String mode = null;
543         if (Boolean.TRUE.equals(downloadMode)) {
544             mode = "Download";
545         } else if (Boolean.TRUE.equals(powerlinkMode)) {
546             mode = "Powerlink";
547         } else if (Boolean.FALSE.equals(powerlinkMode)) {
548             mode = "Standard";
549         }
550         return mode;
551     }
552
553     /**
554      * Get whether or not the current arming mode is considered as armed
555      *
556      * @return true or false
557      */
558     public Boolean isArmed() {
559         return isArmed(getArmMode());
560     }
561
562     /**
563      * Get whether or not an arming mode is considered as armed
564      *
565      * @param armMode the arming mode
566      *
567      * @return true or false; null if mode is unexpected
568      */
569     private static Boolean isArmed(String armMode) {
570         Boolean result = null;
571         if (armMode != null) {
572             try {
573                 PowermaxArmMode mode = PowermaxArmMode.fromName(armMode);
574                 result = mode.isArmed();
575             } catch (IllegalArgumentException e) {
576                 result = Boolean.FALSE;
577             }
578         }
579         return result;
580     }
581
582     /**
583      * Get the short description associated to the current arming mode
584      *
585      * @return the short description
586      */
587     public String getShortArmMode() {
588         return getShortArmMode(getArmMode());
589     }
590
591     /**
592      * Get the short name associated to an arming mode
593      *
594      * @param armMode the arming mode
595      *
596      * @return the short name or null if mode is unexpected
597      */
598     private static String getShortArmMode(String armMode) {
599         String result = null;
600         if (armMode != null) {
601             try {
602                 PowermaxArmMode mode = PowermaxArmMode.fromName(armMode);
603                 result = mode.getShortName();
604             } catch (IllegalArgumentException e) {
605                 result = armMode;
606             }
607         }
608         return result;
609     }
610
611     /**
612      * Keep only data that are different from another state and reset all others data to undefined
613      *
614      * @param otherState the other state
615      */
616     public void keepOnlyDifferencesWith(PowermaxState otherState) {
617         for (int i = 1; i <= zones.length; i++) {
618             if ((isSensorTripped(i) != null) && isSensorTripped(i).equals(otherState.isSensorTripped(i))) {
619                 setSensorTripped(i, null);
620             }
621             if ((getSensorLastTripped(i) != null)
622                     && getSensorLastTripped(i).equals(otherState.getSensorLastTripped(i))) {
623                 setSensorLastTripped(i, null);
624             }
625             if ((isSensorLowBattery(i) != null) && isSensorLowBattery(i).equals(otherState.isSensorLowBattery(i))) {
626                 setSensorLowBattery(i, null);
627             }
628             if ((isSensorBypassed(i) != null) && isSensorBypassed(i).equals(otherState.isSensorBypassed(i))) {
629                 setSensorBypassed(i, null);
630             }
631             if ((isSensorArmed(i) != null) && isSensorArmed(i).equals(otherState.isSensorArmed(i))) {
632                 setSensorArmed(i, null);
633             }
634         }
635         for (int i = 0; i < pgmX10DevicesStatus.length; i++) {
636             if ((getPGMX10DeviceStatus(i) != null)
637                     && getPGMX10DeviceStatus(i).equals(otherState.getPGMX10DeviceStatus(i))) {
638                 setPGMX10DeviceStatus(i, null);
639             }
640         }
641         if ((ready != null) && ready.equals(otherState.isReady())) {
642             ready = null;
643         }
644         if ((bypass != null) && bypass.equals(otherState.isBypass())) {
645             bypass = null;
646         }
647         if ((alarmActive != null) && alarmActive.equals(otherState.isAlarmActive())) {
648             alarmActive = null;
649         }
650         if ((trouble != null) && trouble.equals(otherState.isTrouble())) {
651             trouble = null;
652         }
653         if ((alertInMemory != null) && alertInMemory.equals(otherState.isAlertInMemory())) {
654             alertInMemory = null;
655         }
656         if ((statusStr != null) && statusStr.equals(otherState.getStatusStr())) {
657             statusStr = null;
658         }
659         if ((armMode != null) && armMode.equals(otherState.getArmMode())) {
660             armMode = null;
661         }
662         if ((lastKeepAlive != null) && lastKeepAlive.equals(otherState.getLastKeepAlive())) {
663             lastKeepAlive = null;
664         }
665         if ((panelStatus != null) && panelStatus.equals(otherState.getPanelStatus())) {
666             panelStatus = null;
667         }
668         if ((alarmType != null) && alarmType.equals(otherState.getAlarmType())) {
669             alarmType = null;
670         }
671         if ((troubleType != null) && troubleType.equals(otherState.getTroubleType())) {
672             troubleType = null;
673         }
674     }
675
676     /**
677      * Update (override) the current state data from another state, ignoring in this other state
678      * the undefined data
679      *
680      * @param update the other state to consider for the update
681      */
682     public void merge(PowermaxState update) {
683         if (update.isPowerlinkMode() != null) {
684             powerlinkMode = update.isPowerlinkMode();
685         }
686         if (update.isDownloadMode() != null) {
687             downloadMode = update.isDownloadMode();
688         }
689         for (int i = 1; i <= zones.length; i++) {
690             if (update.isSensorTripped(i) != null) {
691                 setSensorTripped(i, update.isSensorTripped(i));
692             }
693             if (update.getSensorLastTripped(i) != null) {
694                 setSensorLastTripped(i, update.getSensorLastTripped(i));
695             }
696             if (update.isSensorLowBattery(i) != null) {
697                 setSensorLowBattery(i, update.isSensorLowBattery(i));
698             }
699             if (update.isSensorBypassed(i) != null) {
700                 setSensorBypassed(i, update.isSensorBypassed(i));
701             }
702             if (update.isSensorArmed(i) != null) {
703                 setSensorArmed(i, update.isSensorArmed(i));
704             }
705         }
706         for (int i = 0; i < pgmX10DevicesStatus.length; i++) {
707             if (update.getPGMX10DeviceStatus(i) != null) {
708                 setPGMX10DeviceStatus(i, update.getPGMX10DeviceStatus(i));
709             }
710         }
711         if (update.isReady() != null) {
712             ready = update.isReady();
713         }
714         if (update.isBypass() != null) {
715             bypass = update.isBypass();
716         }
717         if (update.isAlarmActive() != null) {
718             alarmActive = update.isAlarmActive();
719         }
720         if (update.isTrouble() != null) {
721             trouble = update.isTrouble();
722         }
723         if (update.isAlertInMemory() != null) {
724             alertInMemory = update.isAlertInMemory();
725         }
726         if (update.getStatusStr() != null) {
727             statusStr = update.getStatusStr();
728         }
729         if (update.getArmMode() != null) {
730             armMode = update.getArmMode();
731         }
732         if (update.getLastKeepAlive() != null) {
733             lastKeepAlive = update.getLastKeepAlive();
734         }
735         if (update.getPanelStatus() != null) {
736             panelStatus = update.getPanelStatus();
737         }
738         if (update.getAlarmType() != null) {
739             alarmType = update.getAlarmType();
740         }
741         if (update.getTroubleType() != null) {
742             troubleType = update.getTroubleType();
743         }
744         if (update.getEventLogSize() > getEventLogSize()) {
745             setEventLogSize(update.getEventLogSize());
746         }
747         for (int i = 1; i <= getEventLogSize(); i++) {
748             if (update.getEventLog(i) != null) {
749                 setEventLog(i, update.getEventLog(i));
750             }
751         }
752     }
753
754     @Override
755     public String toString() {
756         String str = "";
757
758         if (powerlinkMode != null) {
759             str += "\n - powerlink mode = " + (powerlinkMode ? "yes" : "no");
760         }
761         if (downloadMode != null) {
762             str += "\n - download mode = " + (downloadMode ? "yes" : "no");
763         }
764         for (int i = 1; i <= zones.length; i++) {
765             if (isSensorTripped(i) != null) {
766                 str += String.format("\n - sensor zone %d %s", i, isSensorTripped(i) ? "tripped" : "untripped");
767             }
768             if (getSensorLastTripped(i) != null) {
769                 str += String.format("\n - sensor zone %d last trip %d", i, getSensorLastTripped(i));
770             }
771             if (isSensorLowBattery(i) != null) {
772                 str += String.format("\n - sensor zone %d %s", i, isSensorLowBattery(i) ? "low battery" : "battery ok");
773             }
774             if (isSensorBypassed(i) != null) {
775                 str += String.format("\n - sensor zone %d %sbypassed", i, isSensorBypassed(i) ? "" : "not ");
776             }
777             if (isSensorArmed(i) != null) {
778                 str += String.format("\n - sensor zone %d %s", i, isSensorArmed(i) ? "armed" : "disarmed");
779             }
780         }
781         for (int i = 0; i < pgmX10DevicesStatus.length; i++) {
782             if (getPGMX10DeviceStatus(i) != null) {
783                 str += String.format("\n - %s status = %s", (i == 0) ? "PGM device" : String.format("X10 device %d", i),
784                         getPGMX10DeviceStatus(i) ? "ON" : "OFF");
785             }
786         }
787         if (ready != null) {
788             str += "\n - ready = " + (ready ? "yes" : "no");
789         }
790         if (bypass != null) {
791             str += "\n - bypass = " + (bypass ? "yes" : "no");
792         }
793         if (alarmActive != null) {
794             str += "\n - alarm active = " + (alarmActive ? "yes" : "no");
795         }
796         if (trouble != null) {
797             str += "\n - trouble = " + (trouble ? "yes" : "no");
798         }
799         if (alertInMemory != null) {
800             str += "\n - alert in memory = " + (alertInMemory ? "yes" : "no");
801         }
802         if (statusStr != null) {
803             str += "\n - status = " + statusStr;
804         }
805         if (armMode != null) {
806             str += "\n - arm mode = " + armMode;
807         }
808         if (lastKeepAlive != null) {
809             str += "\n - last keep alive = " + lastKeepAlive;
810         }
811         if (panelStatus != null) {
812             str += "\n - panel status = " + panelStatus;
813         }
814         if (alarmType != null) {
815             str += "\n - alarm type = " + alarmType;
816         }
817         if (troubleType != null) {
818             str += "\n - trouble type = " + troubleType;
819         }
820         for (int i = 1; i <= getEventLogSize(); i++) {
821             if (getEventLog(i) != null) {
822                 str += "\n - event log " + i + " = " + getEventLog(i);
823             }
824         }
825
826         return str;
827     }
828 }