1 package net.sf.mbus4j.dataframes.datablocks.dif;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 public enum DataFieldCode {
36
37 NO_DATA(0x00, "No Data"),
38 _8_BIT_INTEGER(0x01, "8 Bit Integer"),
39 _16_BIT_INTEGER(0x02, "16 Bit Integer"),
40 _24_BIT_INTEGER(0x03, "24 Bit Integer"),
41 _32_BIT_INTEGER(0x04, "32 Bit Integer"),
42 _32_BIT_REAL(0x05, "32 Bit Real"),
43 _48_BIT_INTEGER(0x06, "48 Bit Integer"),
44 _64_BIT_INTEGER(0x07, "64 Bit Integer"),
45 SELECTION_FOR_READOUT(0x08, "Selection for readout"),
46 _2_DIGIT_BCD(0x09, "2 digit BCD"),
47 _4_DIGIT_BCD(0x0a, "4 digit BCD"),
48 _6_DIGIT_BCD(0x0b, "6 digit BCD"),
49 _8_DIGIT_BCD(0x0c, "8 digit BCD"),
50 VARIABLE_LENGTH(0x0d, "variable length"),
51 _12_DIGIT_BCD(0x0e, "12 digit BCD"),
52 SPECIAL_FUNCTION_MAN_SPEC_DATA_LAST_PACKET(0x0f, "Special Function Manufacturer specific data"),
53 SPECIAL_FUNCTION_MAN_SPEC_DATA_PACKETS_FOLLOWS(0x1f, "Special Function Manufacturer specific data more records follow in next telegram"),
54 SPECIAL_FUNCTION_IDLE_FILLER(0x2f, "Special Function Idle filler"),
55
56 SPECIAL_FUNCTION_GLOBAL_READOUT_REQUEST(0x7f, "Special Function Global readout request");
57 private final String label;
58 public final byte code;
59
60 private DataFieldCode(int code, String name) {
61 this.label = name;
62 this.code = (byte) code;
63 }
64
65 @Override
66 public String toString() {
67 return label;
68 }
69
70 public String getLabel() {
71 return label;
72 }
73
74 public static DataFieldCode fromLabel(String label) {
75 for (DataFieldCode value : values()) {
76 if (value.getLabel().equals(label)) {
77 return value;
78 }
79 }
80 return valueOf(label);
81 }
82 }