]> git.basschouten.com Git - openhab-addons.git/blob
3e619dc49bf5045bda1ec2b8c277bac9ae3eab24
[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.miio.internal.basic;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * Various types of parameters to be send
19  *
20  * @author Marcel Verpaalen - Initial contribution
21  */
22 @NonNullByDefault
23 public enum CommandParameterType {
24     NONE("none"),
25     EMPTY("empty"),
26     ONOFF("onoff"),
27     ONOFFPARA("onoffpara"),
28     ONOFFBOOL("onoffbool"),
29     ONOFFBOOLSTRING("onoffboolstring"),
30     ONOFFNUMBER("onoffnumber"),
31     OPENCLOSE("openclose"),
32     OPENCLOSENUMBER("openclosenumber"),
33     OPENCLOSESWITCH("opencloseswitch"),
34     STRING("string"),
35     CUSTOMSTRING("customstring"),
36     NUMBER("number"),
37     COLOR("color"),
38     UNKNOWN("unknown");
39
40     private String text;
41
42     CommandParameterType(String text) {
43         this.text = text;
44     }
45
46     public static CommandParameterType fromString(String text) {
47         for (CommandParameterType param : CommandParameterType.values()) {
48             if (param.text.equalsIgnoreCase(text)) {
49                 return param;
50             }
51         }
52         return UNKNOWN;
53     }
54 }