]> git.basschouten.com Git - openhab-addons.git/blob
d448011d8af72472b899737e52daac8e7b10da33
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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     OPENCLOSENUMBER("openclosenumber"),
32     OPENCLOSE("openclose"),
33     STRING("string"),
34     CUSTOMSTRING("customstring"),
35     NUMBER("number"),
36     COLOR("color"),
37     UNKNOWN("unknown");
38
39     private String text;
40
41     CommandParameterType(String text) {
42         this.text = text;
43     }
44
45     public static CommandParameterType fromString(String text) {
46         for (CommandParameterType param : CommandParameterType.values()) {
47             if (param.text.equalsIgnoreCase(text)) {
48                 return param;
49             }
50         }
51         return UNKNOWN;
52     }
53 }