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