]> git.basschouten.com Git - openhab-addons.git/blob
9fb10098b648982a43fedb6c0170b41ee5b54739
[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.digiplex.internal.communication;
14
15 import java.util.Arrays;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 /**
20  * Indicates arm type
21  *
22  * @author Robert Michalak - Initial contribution
23  *
24  */
25 @NonNullByDefault
26 public enum ArmType {
27     REGULAR_ARM('A'),
28     FORCE_ARM('F'),
29     STAY_ARM('S'),
30     INSTANT_ARM('I'),
31     UNKNOWN('u');
32
33     private char indicator;
34
35     ArmType(char indicator) {
36         this.indicator = indicator;
37     }
38
39     public char getIndicator() {
40         return indicator;
41     }
42
43     public static ArmType fromMessage(char indicator) {
44         return Arrays.stream(values()).filter(type -> type.indicator == indicator).findFirst().orElse(UNKNOWN);
45     }
46 }