2 * Copyright (c) 2010-2020 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.powermax.internal.message;
16 * All defined alarm types
18 * @author Laurent Garnier - Initial contribution
20 public enum PowermaxAlarmType {
22 ALARM_TYPE_1(0x01, "Intruder"),
23 ALARM_TYPE_2(0x02, "Intruder"),
24 ALARM_TYPE_3(0x03, "Intruder"),
25 ALARM_TYPE_4(0x04, "Intruder"),
26 ALARM_TYPE_5(0x05, "Intruder"),
27 ALARM_TYPE_6(0x06, "Tamper"),
28 ALARM_TYPE_7(0x07, "Tamper"),
29 ALARM_TYPE_8(0x08, "Tamper"),
30 ALARM_TYPE_9(0x09, "Tamper"),
31 ALARM_TYPE_10(0x0B, "Panic"),
32 ALARM_TYPE_11(0x0C, "Panic"),
33 ALARM_TYPE_12(0x20, "Fire"),
34 ALARM_TYPE_13(0x23, "Emergency"),
35 ALARM_TYPE_14(0x49, "Gas"),
36 ALARM_TYPE_15(0x4D, "Flood");
41 private PowermaxAlarmType(int code, String label) {
47 * @return the code identifying the alarm type
49 public int getCode() {
54 * @return the label associated to the alarm type
56 public String getLabel() {
61 * Get the ENUM value from its identifying code
63 * @param code the identifying code
65 * @return the corresponding ENUM value
67 * @throws IllegalArgumentException if no ENUM value corresponds to this code
69 public static PowermaxAlarmType fromCode(int code) throws IllegalArgumentException {
70 for (PowermaxAlarmType alarmType : PowermaxAlarmType.values()) {
71 if (alarmType.getCode() == code) {
76 throw new IllegalArgumentException("Invalid code: " + code);