dongyukun
2024-11-05 e8ad669f7c97d45cd23630dc101180a130d6c17e
提交 | 用户 | 时间
ce910c 1 package com.netsdk.lib.enumeration;
H 2
3
4 /** 
5 * @author 291189
6 * @description  led灯亮度 
7 * @date 2022/08/31 14:44:16
8 */
9 public enum EM_LED_BRIGHTNESS_LEVEL {
10 /**
11 未知
12 */
13 EM_LED_BRIGHTNESS_UNKNOWN(-1,"未知"),
14 /**
15 关闭
16 */
17 EM_LED_BRIGHTNESS_CLOSED(0,"关闭"),
18 /**
19 亮度最低
20 */
21 EM_LED_BRIGHTNESS_LOW(1,"亮度最低"),
22 /**
23 亮度适中
24 */
25 EM_LED_BRIGHTNESS_MEDIUM(2,"亮度适中"),
26 /**
27 亮度最高
28 */
29 EM_LED_BRIGHTNESS_HIGH(3,"亮度最高");
30
31 private int value;
32
33 private String note;
34
35 public String getNote() {
36         return note;
37     }
38
39 public int getValue() {
40         return value;
41     }
42
43 EM_LED_BRIGHTNESS_LEVEL(int givenValue, String note) {
44         this.value = givenValue;
45         this.note = note;
46     }
47
48 public static String getNoteByValue(int givenValue) {
49         for (EM_LED_BRIGHTNESS_LEVEL enumType : EM_LED_BRIGHTNESS_LEVEL.values()) {
50             if (givenValue == enumType.getValue()) {
51                 return enumType.getNote();
52             }
53         }
54         return null;
55     }
56
57 public static int getValueByNote(String givenNote) {
58         for (EM_LED_BRIGHTNESS_LEVEL enumType : EM_LED_BRIGHTNESS_LEVEL.values()) {
59             if (givenNote.equals(enumType.getNote())) {
60                 return enumType.getValue();
61             }
62         }
63         return -2;
64     }
65
66 public static EM_LED_BRIGHTNESS_LEVEL getEnum(int value) {
67         for (EM_LED_BRIGHTNESS_LEVEL e : EM_LED_BRIGHTNESS_LEVEL.values()) {
68             if (e.getValue() == value)
69                 return e;
70         }
71         return EM_LED_BRIGHTNESS_LEVEL.EM_LED_BRIGHTNESS_UNKNOWN;
72     }
73
74 }