提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.lib.enumeration; |
H |
2 |
|
|
3 |
|
|
4 |
/** |
|
5 |
* @author 291189 |
|
6 |
* @description 传输模式 |
|
7 |
* @date 2022/03/08 09:56:03 |
|
8 |
*/ |
|
9 |
public enum EM_NET_WIEGAND_TRANSFER_MODE { |
|
10 |
/** |
|
11 |
未知 |
|
12 |
*/ |
|
13 |
EM_NET_WIEGAND_MODE_UNKNOWN(-1,"未知"), |
|
14 |
/** |
|
15 |
韦根34bit传输,4字节卡号,2Bit校验; |
|
16 |
*/ |
|
17 |
EM_NET_WIEGAND_MODE_BIT_34(0,"韦根34bit传输,4字节卡号,2Bit校验;"), |
|
18 |
/** |
|
19 |
韦根66bit传输,8字节卡号,2Bit校验; |
|
20 |
*/ |
|
21 |
EM_NET_WIEGAND_MODE_BIT_66(1,"韦根66bit传输,8字节卡号,2Bit校验;"), |
|
22 |
/** |
|
23 |
韦根26bit传输,3字节卡号,2Bit校验; |
|
24 |
*/ |
|
25 |
EM_NET_WIEGAND_MODE_BIT_26(2,"韦根26bit传输,3字节卡号,2Bit校验;"), |
|
26 |
/** |
|
27 |
韦根32bit传输,4字节卡号,无校验位 |
|
28 |
*/ |
|
29 |
EM_NET_WIEGAND_MODE_BIT_32(3,"韦根32bit传输,4字节卡号,无校验位"), |
|
30 |
/** |
|
31 |
韦根42bit传输,5字节卡号,2Bit校验 |
|
32 |
*/ |
|
33 |
EM_NET_WIEGAND_MODE_BIT_42(4,"韦根42bit传输,5字节卡号,2Bit校验"); |
|
34 |
|
|
35 |
private int value; |
|
36 |
|
|
37 |
private String note; |
|
38 |
|
|
39 |
public String getNote() { |
|
40 |
return note; |
|
41 |
} |
|
42 |
|
|
43 |
public int getValue() { |
|
44 |
return value; |
|
45 |
} |
|
46 |
|
|
47 |
EM_NET_WIEGAND_TRANSFER_MODE(int givenValue, String note) { |
|
48 |
this.value = givenValue; |
|
49 |
this.note = note; |
|
50 |
} |
|
51 |
|
|
52 |
public static String getNoteByValue(int givenValue) { |
|
53 |
for (EM_NET_WIEGAND_TRANSFER_MODE enumType : EM_NET_WIEGAND_TRANSFER_MODE.values()) { |
|
54 |
if (givenValue == enumType.getValue()) { |
|
55 |
return enumType.getNote(); |
|
56 |
} |
|
57 |
} |
|
58 |
return null; |
|
59 |
} |
|
60 |
|
|
61 |
public static int getValueByNote(String givenNote) { |
|
62 |
for (EM_NET_WIEGAND_TRANSFER_MODE enumType : EM_NET_WIEGAND_TRANSFER_MODE.values()) { |
|
63 |
if (givenNote.equals(enumType.getNote())) { |
|
64 |
return enumType.getValue(); |
|
65 |
} |
|
66 |
} |
|
67 |
return -2; |
|
68 |
} |
|
69 |
|
|
70 |
public static EM_NET_WIEGAND_TRANSFER_MODE getEnum(int value) { |
|
71 |
for (EM_NET_WIEGAND_TRANSFER_MODE e : EM_NET_WIEGAND_TRANSFER_MODE.values()) { |
|
72 |
if (e.getValue() == value) |
|
73 |
return e; |
|
74 |
} |
|
75 |
return EM_NET_WIEGAND_TRANSFER_MODE.EM_NET_WIEGAND_MODE_UNKNOWN; |
|
76 |
} |
|
77 |
|
|
78 |
} |