提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* @author 251823 |
|
5 |
* @description 灯光类型 |
|
6 |
* @date 2020/11/19 |
|
7 |
*/ |
|
8 |
public enum EM_SIGNLIGHT_TYPE { |
|
9 |
// 未知 |
|
10 |
EM_SIGNLIGHT_TYPE_UNKNOWN(0, "未知"), |
|
11 |
|
|
12 |
// 自动,按照sensor自动切换 |
|
13 |
EM_SIGNLIGHT_TYPE_AUTO(1, "自动,按照sensor自动切换"), |
|
14 |
|
|
15 |
// 定时模式 |
|
16 |
EM_SIGNLIGHT_TYPE_TIMING(2, "定时模式"), |
|
17 |
|
|
18 |
// 常灭 |
|
19 |
EM_SIGNLIGHT_TYPE_OFF(3, "常灭"), |
|
20 |
|
|
21 |
// 常亮模式 |
|
22 |
EM_SIGNLIGHT_TYPE_ON(4, "常亮模式"); |
|
23 |
|
|
24 |
private int value; |
|
25 |
private String note; |
|
26 |
|
|
27 |
private EM_SIGNLIGHT_TYPE(int givenValue, String note) { |
|
28 |
this.value = givenValue; |
|
29 |
this.note = note; |
|
30 |
} |
|
31 |
|
|
32 |
public String getNote() { |
|
33 |
return note; |
|
34 |
} |
|
35 |
|
|
36 |
public int getValue() { |
|
37 |
return value; |
|
38 |
} |
|
39 |
|
|
40 |
public static String getNoteByValue(int givenValue) { |
|
41 |
for (EM_SIGNLIGHT_TYPE enumType : EM_SIGNLIGHT_TYPE.values()) { |
|
42 |
if (givenValue == enumType.getValue()) { |
|
43 |
return enumType.getNote(); |
|
44 |
} |
|
45 |
} |
|
46 |
return null; |
|
47 |
} |
|
48 |
|
|
49 |
public static int getValueByNote(String givenNote) { |
|
50 |
for (EM_SIGNLIGHT_TYPE enumType : EM_SIGNLIGHT_TYPE.values()) { |
|
51 |
if (givenNote.equals(enumType.getNote())) { |
|
52 |
return enumType.getValue(); |
|
53 |
} |
|
54 |
} |
|
55 |
return -1; |
|
56 |
} |
|
57 |
} |