]> git.basschouten.com Git - openhab-addons.git/blob
3280b633562811d955a508c4cf23a71ea98ee11d
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.digiplex.internal.communication.events;
14
15 import java.util.Arrays;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 /**
20  * Type of special alarm.
21  *
22  * @author Robert Michalak - Initial contribution
23  *
24  */
25 @NonNullByDefault
26 public enum SpecialAlarmType {
27     EMERGENCY_PANIC(0),
28     MEDICAL_PANIC(1),
29     FIRE_PANIC(2),
30     RECENT_CLOSING(3),
31     POLICE_CODE(4),
32     GLOBAL_SHUTDOWN(5),
33     UNKNOWN(-1);
34
35     private int indicator;
36
37     SpecialAlarmType(int indicator) {
38         this.indicator = indicator;
39     }
40
41     public static SpecialAlarmType fromMessage(int indicator) {
42         return Arrays.stream(values()).filter(type -> type.indicator == indicator).findFirst().orElse(UNKNOWN);
43     }
44 }