]> git.basschouten.com Git - openhab-addons.git/blob
1ccbe5bbae74718df2cb39cdf99025782a370d3a
[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.nuki.internal.constants;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * Enumeration of all lock actions Nuki Opener accepts
20  *
21  * @author Jan Vybíral - Initial contribution
22  */
23 @NonNullByDefault
24 public enum OpenerAction {
25     ACTIVATE_RING_TO_OPEN(1),
26     DEACTIVATE_RING_TO_OPEN(2),
27     ELECTRIC_STRIKE_ACTUATION(3),
28     ACTIVATE_CONTINUOUS_MODE(4),
29     DEACTIVATE_CONTINUOUS_MODE(5);
30
31     private final int action;
32
33     OpenerAction(int action) {
34         this.action = action;
35     }
36
37     public static @Nullable OpenerAction fromAction(int action) {
38         for (OpenerAction value : values()) {
39             if (value.action == action) {
40                 return value;
41             }
42         }
43         return null;
44     }
45
46     public int getAction() {
47         return action;
48     }
49 }