]> git.basschouten.com Git - openhab-addons.git/blob
f01262773f8bcf19b9d857a2ed2aee93ad88f824
[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.satel.internal.types;
14
15 /**
16  * Available Integra types.
17  *
18  * @author Krzysztof Goworek - Initial contribution
19  */
20 public enum IntegraType {
21     UNKNOWN(-1, "Unknown", 0, 0, 0),
22     I24(0, "Integra 24", 4, 24, 4),
23     I32(1, "Integra 32", 16, 32, 8),
24     I64(2, "Integra 64", 32, 64, 16),
25     I128(3, "Integra 128", 32, 128, 16),
26     I128_SIM300(4, "Integra 128-WRL SIM300", 32, 128, 8),
27     I128_LEON(132, "Integra 128-WRL LEON", 32, 128, 8),
28     I64_PLUS(66, "Integra 64 Plus", 32, 64, 16),
29     I128_PLUS(67, "Integra 128 Plus", 32, 128, 16),
30     I256_PLUS(72, "Integra 256 Plus", 32, 256, 16, true);
31
32     private int code;
33     private String name;
34     private int partitions;
35     private int zones;
36     private int onMainboard;
37     private boolean extPayload;
38
39     IntegraType(int code, String name, int partitions, int zones, int onMainboard) {
40         this(code, name, partitions, zones, onMainboard, false);
41     }
42
43     IntegraType(int code, String name, int partitions, int zones, int onMainboard, boolean extPayload) {
44         this.code = code;
45         this.name = name;
46         this.partitions = partitions;
47         this.zones = zones;
48         this.onMainboard = onMainboard;
49         this.extPayload = extPayload;
50     }
51
52     /**
53      * @return name of Integra type
54      */
55     public String getName() {
56         return this.name;
57     }
58
59     /**
60      * @return max number of partitions
61      */
62     public int getPartitions() {
63         return partitions;
64     }
65
66     /**
67      * @return max number of zones
68      */
69     public int getZones() {
70         return zones;
71     }
72
73     /**
74      * @return wired zones/outputs available on mainboard
75      */
76     public int getOnMainboard() {
77         return onMainboard;
78     }
79
80     /**
81      * @return <code>true</code> if this Integra requires extended message payload
82      */
83     public boolean hasExtPayload() {
84         return this.extPayload;
85     }
86
87     /**
88      * Returns Integra type for given code.
89      *
90      * @param code code to get type for
91      * @return Integra type object
92      */
93     public static IntegraType valueOf(int code) {
94         for (IntegraType val : IntegraType.values()) {
95             if (val.code == code) {
96                 return val;
97             }
98         }
99         return UNKNOWN;
100     }
101 }