|
10 | 10 | import org.slf4j.Logger;
|
11 | 11 | import org.slf4j.LoggerFactory;
|
12 | 12 |
|
| 13 | +import java.math.BigInteger; |
13 | 14 | import java.util.List;
|
14 | 15 | import java.util.stream.Collectors;
|
15 | 16 | import java.util.stream.IntStream;
|
16 | 17 |
|
| 18 | +import static com.hivemq.edge.adapters.s7.config.S7Versions.S7_1200; |
| 19 | +import static com.hivemq.edge.adapters.s7.config.S7Versions.S7_1500; |
| 20 | +import static com.hivemq.edge.adapters.s7.config.S7Versions.S7_300; |
| 21 | +import static com.hivemq.edge.adapters.s7.config.S7Versions.S7_400; |
| 22 | + |
17 | 23 | public class S7Client {
|
18 | 24 |
|
19 | 25 | private static final Logger log = LoggerFactory.getLogger(S7Client.class);
|
@@ -48,20 +54,34 @@ public List<DataPoint> read(final @NotNull S7DataType type, final @NotNull List<
|
48 | 54 | log.trace("Reading data from addresses {} with type {}", addresses, type);
|
49 | 55 | }
|
50 | 56 | switch (type) {
|
51 |
| - case BYTE: throw new IllegalArgumentException("Byte data type not supported by this method, use readBytes"); |
52 | 57 | case BOOL: return combine(dataPointFactory, addresses, s7PLC.readBoolean(addresses));
|
53 |
| - case INT16: return combine(dataPointFactory, addresses, s7PLC.readInt16(addresses)); |
54 |
| - case UINT16: return combine(dataPointFactory, addresses, s7PLC.readUInt16(addresses)); |
55 |
| - case INT32: return combine(dataPointFactory, addresses, s7PLC.readInt32(addresses)); |
56 |
| - case UINT32: return combine(dataPointFactory, addresses, s7PLC.readUInt32(addresses)); |
57 |
| - case INT64: return combine(dataPointFactory, addresses, s7PLC.readInt64(addresses)); |
| 58 | + case BYTE: throw new IllegalArgumentException("Byte data type not supported by this method, use readBytes"); |
| 59 | + case WORD: return null; |
| 60 | + case DWORD: return null; |
| 61 | + case LWORD: return null; |
| 62 | + case USINT: return combine(dataPointFactory, addresses, s7PLC.readUInt16(addresses)); |
| 63 | + case UINT: return null; |
| 64 | + case UDINT: return combine(dataPointFactory, addresses, s7PLC.readUInt32(addresses)); |
| 65 | + case ULINT: return null; |
| 66 | + case SINT: return null; |
| 67 | + case INT: return combine(dataPointFactory, addresses, s7PLC.readInt16(addresses)); |
| 68 | + case DINT: return combine(dataPointFactory, addresses, s7PLC.readInt32(addresses)); |
| 69 | + case LINT: return combine(dataPointFactory, addresses, s7PLC.readInt64(addresses)); |
58 | 70 | case REAL: return combine(dataPointFactory, addresses, s7PLC.readFloat32(addresses));
|
59 | 71 | case LREAL: return combine(dataPointFactory, addresses, s7PLC.readFloat64(addresses));
|
| 72 | + case CHAR: return null; |
| 73 | + case WCHAR: return null; |
60 | 74 | case STRING: return combine(dataPointFactory, addresses, addresses.stream().map(s7PLC::readString).collect(Collectors.toList()));
|
61 |
| - case DATE: return combine(dataPointFactory, addresses, addresses.stream().map(s7PLC::readDate).collect(Collectors.toList())); |
62 |
| - case TIME_OF_DAY: return combine(dataPointFactory, addresses, addresses.stream().map(s7PLC::readTimeOfDay).collect(Collectors.toList())); |
| 75 | + case WSTRING: return null; |
63 | 76 | case TIME: return combine(dataPointFactory, addresses, addresses.stream().map(s7PLC::readTime).collect(Collectors.toList()));
|
64 |
| - case DATE_AND_TIME: return combine(dataPointFactory, addresses, addresses.stream().map(s7PLC::readDTL).collect(Collectors.toList())); |
| 77 | + case LTIME: return null; |
| 78 | + case DATE: return combine(dataPointFactory, addresses, addresses.stream().map(s7PLC::readDate).collect(Collectors.toList())); |
| 79 | + case TOD: return combine(dataPointFactory, addresses, addresses.stream().map(s7PLC::readTimeOfDay).collect(Collectors.toList())); |
| 80 | + case LTOD: return null; |
| 81 | + case DT: return combine(dataPointFactory, addresses, addresses.stream().map(s7PLC::readDTL).collect(Collectors.toList())); |
| 82 | + case LDT: return null; |
| 83 | + case DTL: return null; |
| 84 | + case ARRAY: return null; |
65 | 85 | default: {
|
66 | 86 | log.error("Unspported tag-type {} at address {}", type, addresses);
|
67 | 87 | throw new IllegalArgumentException("Unspported tag-type " + type + " at address " + addresses);
|
|
0 commit comments