提交 | 用户 | 时间
|
ce910c
|
1 |
package com.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
/** |
|
4 |
* @author 251823 |
|
5 |
* @description 电池温度状态 |
|
6 |
* @date 2022/03/31 |
|
7 |
*/ |
|
8 |
public enum EM_BATTERY_TEMPER_STATE { |
|
9 |
// 未知 |
|
10 |
EM_BATTERY_TEMPER_STATE_UNKNOWN(0, "未知"), |
|
11 |
|
|
12 |
// 低温 |
|
13 |
EM_BATTERY_TEMPER_STATE_LOW_TEMPER(1, "低温"), |
|
14 |
|
|
15 |
// 常温 |
|
16 |
EM_BATTERY_TEMPER_STATE_NORMAL_TEMPER(2, "常温"), |
|
17 |
|
|
18 |
// 高温 |
|
19 |
EM_BATTERY_TEMPER_STATE_HIGH_TEMPER(3, "高温"), |
|
20 |
|
|
21 |
// 超温 |
|
22 |
EM_BATTERY_TEMPER_STATE_OVER_TEMPER(4, "超温"), |
|
23 |
|
|
24 |
// 异常 |
|
25 |
EM_BATTERY_TEMPER_STATE_ABNORMAL_TEMPER(5, "异常"); |
|
26 |
|
|
27 |
private int value; |
|
28 |
private String note; |
|
29 |
|
|
30 |
private EM_BATTERY_TEMPER_STATE(int givenValue, String note) { |
|
31 |
this.value = givenValue; |
|
32 |
this.note = note; |
|
33 |
} |
|
34 |
|
|
35 |
public String getNote() { |
|
36 |
return note; |
|
37 |
} |
|
38 |
|
|
39 |
public int getValue() { |
|
40 |
return value; |
|
41 |
} |
|
42 |
|
|
43 |
public static String getNoteByValue(int givenValue) { |
|
44 |
for (EM_BATTERY_TEMPER_STATE enumType : EM_BATTERY_TEMPER_STATE.values()) { |
|
45 |
if (givenValue == enumType.getValue()) { |
|
46 |
return enumType.getNote(); |
|
47 |
} |
|
48 |
} |
|
49 |
return null; |
|
50 |
} |
|
51 |
|
|
52 |
public static int getValueByNote(String givenNote) { |
|
53 |
for (EM_BATTERY_TEMPER_STATE enumType : EM_BATTERY_TEMPER_STATE.values()) { |
|
54 |
if (givenNote.equals(enumType.getNote())) { |
|
55 |
return enumType.getValue(); |
|
56 |
} |
|
57 |
} |
|
58 |
return -1; |
|
59 |
} |
|
60 |
|
|
61 |
} |