15
15
*/
16
16
package com .hivemq .edge .adapters .s7 .config ;
17
17
18
+ import java .math .BigInteger ;
18
19
import java .time .LocalDate ;
19
20
import java .time .LocalDateTime ;
20
21
import java .time .LocalTime ;
22
+ import java .util .List ;
23
+
24
+ import static com .hivemq .edge .adapters .s7 .config .S7Versions .S7_1200 ;
25
+ import static com .hivemq .edge .adapters .s7 .config .S7Versions .S7_1500 ;
26
+ import static com .hivemq .edge .adapters .s7 .config .S7Versions .S7_200 ;
27
+ import static com .hivemq .edge .adapters .s7 .config .S7Versions .S7_300 ;
28
+ import static com .hivemq .edge .adapters .s7 .config .S7Versions .S7_400 ;
21
29
22
30
/**
23
- * @author Simon L Johnson
31
+ * Documented here:
32
+ * https://support.industry.siemens.com/cs/mdm/109054417?c=69695636619&lc=en-GE
24
33
*/
25
34
public enum S7DataType {
26
- BOOL (Boolean .class ),
27
- BYTE (Byte .class ),
35
+ BOOL (Boolean .class , 1 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ), "Boolean" , "https://support.industry.siemens.com/cs/mdm/109054417?c=46422035979&lc=en-GE" ),
36
+ BYTE (Byte .class , 8 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ), "Byte" , "https://support.industry.siemens.com/cs/mdm/109054417?c=56595553163&lc=en-GE" ),
37
+ WORD (Byte [].class , 16 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ), "Word" , "https://support.industry.siemens.com/cs/mdm/109054417?c=56595472523&lc=en-GE" ),
38
+ DWORD (Byte [].class , 32 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ), "Double Word" , "https://support.industry.siemens.com/cs/mdm/109054417?c=56595322763&lc=en-GE" ),
39
+ LWORD (Byte [].class , 64 , List .of (S7_1500 ), "Long Word" , "https://support.industry.siemens.com/cs/mdm/109054417?c=56595507211&lc=en-GE" ),
40
+ USINT (Short .class , 8 , List .of (S7_1200 , S7_1500 ), "Unsigned Short Integer" , "https://support.industry.siemens.com/cs/mdm/109054417?c=46521647883&lc=en-GE" ),
41
+ UINT (Integer .class , 16 , List .of (S7_1200 , S7_1500 ), "Unsigned Integer" , "https://support.industry.siemens.com/cs/mdm/109054417?c=46521834123&lc=en-GE" ),
42
+ UDINT (Long .class , 32 , List .of (S7_1200 , S7_1500 ), "Unsigned Double Integer" , "https://support.industry.siemens.com/cs/mdm/109054417?c=46521930763&lc=en-GE" ),
43
+ ULINT (BigInteger .class , 64 , List .of (S7_1500 ), "Unsigned Long Integer" , "https://support.industry.siemens.com/cs/mdm/109054417?c=59653945739&lc=en-GE" ),
44
+ SINT (Byte .class , 8 , List .of (S7_1200 , S7_1500 ), "Short Integer" , "https://support.industry.siemens.com/cs/mdm/109054417?c=68894861835&lc=en-GE" ),
45
+ INT (Short .class , 16 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ),"Integer" , "https://support.industry.siemens.com/cs/mdm/109054417?c=63679745547&lc=en-GE" ),
46
+ DINT (Integer .class , 32 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ), "Double Integer" , "https://support.industry.siemens.com/cs/mdm/109054417?c=46521869963&lc=en-GE" ),
47
+ LINT (Long .class , 64 , List .of (S7_1500 ), "Long Integer" , "https://support.industry.siemens.com/cs/mdm/109054417?c=66825552267&lc=en-GE" ),
48
+ REAL (Float .class , 32 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ), "Real" , "https://support.industry.siemens.com/cs/mdm/109054417?c=68826794251&lc=en-GE" ),
49
+ LREAL (Float .class , 64 , List .of (S7_1200 , S7_1500 ), "Long Real" , "https://support.industry.siemens.com/cs/mdm/109054417?c=68826903691&lc=en-GE" ),
50
+
51
+ CHAR (Character .class , 8 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ), "Character" , "https://support.industry.siemens.com/cs/mdm/109054417?c=57152595083&lc=en-GE" ),
52
+ WCHAR (Short .class , 16 , List .of (S7_1200 , S7_1500 ), "Wide Character" , "https://support.industry.siemens.com/cs/mdm/109054417?c=10488733835&lc=en-GE" ),
53
+ STRING (String .class , -1 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ), "String, 0 to 254 characters only ASCII" , "https://support.industry.siemens.com/cs/mdm/109054417?c=63689840011&lc=en-GE" ),
54
+ WSTRING (String .class , -1 , List .of (S7_1200 , S7_1500 ), "Wide String, 0 to 254 characters only Unicode" , "https://support.industry.siemens.com/cs/mdm/109054417?c=61472021771&lc=en-GE" ), //
55
+
56
+ TIME (Long .class , 32 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ), "IEC Time (ms)" , "https://support.industry.siemens.com/cs/mdm/109054417?c=61085966091&lc=en-GE" ),
57
+ LTIME (BigInteger .class , 64 , List .of (S7_1500 ), "IEC Time (ns)" , "https://support.industry.siemens.com/cs/mdm/109054417?c=61410814475&lc=en-GE" ),
58
+
59
+ DATE (Short .class , 8 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ), "IEC Date, since 01-01-1990 (Year-Month-Day)" , "https://support.industry.siemens.com/cs/mdm/109054417?c=46522046859&lc=en-GE" ),
60
+ TOD (Long .class , 32 , List .of (S7_300 , S7_400 , S7_1200 , S7_1500 ), "Time Of Day (hours:minutes:seconds.milliseconds)" , "https://support.industry.siemens.com/cs/mdm/109054417?c=64869849355&lc=en-GE" ),
61
+ LTOD (BigInteger .class , 64 , List .of (S7_1500 ), "Time-of-day (hours:minutes:seconds.nanoseconds)" , "https://support.industry.siemens.com/cs/mdm/109054417?c=64869390987&lc=en-GE" ),
62
+ DT (BigInteger .class , 64 , List .of (S7_1500 ), "Date and time (year-month-day-hour:minute:second:millisecond)" , "https://support.industry.siemens.com/cs/mdm/109054417?c=61473284875&lc=en-GE" ),
63
+ LDT (BigInteger .class , 64 , List .of (S7_1500 ), "Date and time (year-month-day-hour:minute:second:nanoseconds)" , "https://support.industry.siemens.com/cs/mdm/109054417?c=71834521483&lc=en-GE" ),
64
+ DTL (BigInteger .class , 64 , List .of (S7_1500 ), "Date and time (year-month-day-hour:minute:second:nanoseconds)" , "https://support.industry.siemens.com/cs/mdm/109054417?c=64682916235&lc=en-GE" ),
65
+
66
+
67
+ /**
68
+ * UNSUPPORTED
69
+ * S5TIME https://support.industry.siemens.com/cs/mdm/109054417?c=63689295627&lc=en-GE
70
+ */
71
+
72
+ BYTE_ARRAY (Byte [].class ),
28
73
INT16 (Short .class ),
29
74
UINT16 (Short .class ),
30
75
INT32 (Integer .class ),
@@ -38,13 +83,36 @@ public enum S7DataType {
38
83
DATE_AND_TIME (LocalDateTime .class ),
39
84
TIME (Long .class );
40
85
41
- S7DataType (Class <?> javaType ){
86
+ S7DataType (Class <?> javaType , int lengthInBits , List < S7Versions > availableOn , String description , String docs ){
42
87
this .javaType = javaType ;
88
+ this .lengthInBits = lengthInBits ;
89
+ this .availableOn = availableOn ;
90
+ this .description = description ;
91
+ this .docs = docs ;
43
92
}
44
93
private Class <?> javaType ;
94
+ private final int lengthInBits ;
95
+ private final List <S7Versions > availableOn ;
96
+ private final String description ;
97
+ private final String docs ;
45
98
46
99
public Class <?> getJavaType () {
47
100
return javaType ;
48
101
}
49
102
103
+ public int getLengthInBits () {
104
+ return lengthInBits ;
105
+ }
106
+
107
+ public List <S7Versions > getAvailableOn () {
108
+ return availableOn ;
109
+ }
110
+
111
+ public String getDescription () {
112
+ return description ;
113
+ }
114
+
115
+ public String getDocs () {
116
+ return docs ;
117
+ }
50
118
}
0 commit comments