]> git.basschouten.com Git - openhab-addons.git/blob
6fa56fa93774820c4f53fe212c2590f185ba9d4c
[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 PanelType} Enum of all panel types
17  *
18  * @author Konstantin Polihronov - Initial contribution
19  */
20 public enum PanelType {
21     EVO48(4, 48, 2, 16),
22     EVO96(4, 96, 3, 16),
23     EVO192(8, 192, 5, 16),
24     EVOHD(8, 192, 5, 16),
25     SP5500,
26     SP6000,
27     SP7000,
28     MG5000,
29     MG5050,
30     SP4000,
31     SP65,
32     UNKNOWN;
33
34     private int partitions;
35     private int zones;
36     private int pgms; // Programmable outputs
37     private int ramPagesNumber; // Ram pages 64 bytes each
38
39     private PanelType() {
40         this(0, 0, 0, 0);
41     }
42
43     private PanelType(int numberPartitions, int numberZones, int pgms, int ramPages) {
44         this.partitions = numberPartitions;
45         this.zones = numberZones;
46         this.pgms = pgms;
47         this.ramPagesNumber = ramPages;
48     }
49
50     public static PanelType from(String panelTypeStr) {
51         if (panelTypeStr == null) {
52             return PanelType.UNKNOWN;
53         }
54
55         try {
56             return PanelType.valueOf(panelTypeStr);
57         } catch (IllegalArgumentException e) {
58             return PanelType.UNKNOWN;
59         }
60     }
61
62     public static boolean isBigRamEvo(PanelType panelType) {
63         return panelType == EVO192 || panelType == EVOHD;
64     }
65
66     public int getPartitions() {
67         return partitions;
68     }
69
70     public int getZones() {
71         return zones;
72     }
73
74     @Override
75     public String toString() {
76         return this.name();
77     }
78
79     public int getPgms() {
80         return pgms;
81     }
82
83     public int getRamPagesNumber() {
84         return ramPagesNumber;
85     }
86 }