]> git.basschouten.com Git - openhab-addons.git/blob
511f93da01cdd0c323a50d7146cc46735af74449
[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;
14
15 import java.util.Arrays;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 /**
20  *
21  * Indicates type of arm/disarm message returned for PRT3 module
22  *
23  * @author Robert Michalak - Initial contribution
24  *
25  */
26 @NonNullByDefault
27 public enum ArmDisarmType {
28     ARM("AA"),
29     QUICK_ARM("AQ"),
30     DISARM("AD"),
31     UNKNOWN("");
32
33     private String indicator;
34
35     ArmDisarmType(String indicator) {
36         this.indicator = indicator;
37     }
38
39     public static ArmDisarmType fromMessage(String indicator) {
40         return Arrays.stream(ArmDisarmType.values()).filter(type -> type.indicator.equals(indicator)).findFirst()
41                 .orElse(UNKNOWN);
42     }
43 }