chrisdutz commented on code in PR #1902: URL: https://github.com/apache/plc4x/pull/1902#discussion_r1858573548
########## plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/protocol/AdsProtocolLogic.java: ########## @@ -1953,13 +1949,28 @@ protected Optional<AdsDataTypeTableEntry> getDataTypeTableEntry(String name) { return Optional.of(dataTypeTable.get(name)); } try { - AdsDataType adsDataType = AdsDataType.valueOf(name); + AdsDataType adsDataType; + int numBytes; + + if (name.startsWith("STRING(")) { + adsDataType = AdsDataType.valueOf("CHAR"); + numBytes = Integer.parseInt(name.substring(7, name.length() - 1)) + 1; + } + else if (name.startsWith("WSTRING(")) { + adsDataType = AdsDataType.valueOf("WCHAR"); + numBytes = Integer.parseInt(name.substring(8, name.length() - 1)) * 2 + 2; + } + else { + adsDataType = AdsDataType.valueOf(name); + numBytes = adsDataType.getNumBytes(); + } + // !It seems that the dataType value differs from system to system, // !However, we never really seem to use that value, so I would say it doesn't matter. return Optional.of(new AdsDataTypeTableEntry( - 128, 1, 0, 0, adsDataType.getNumBytes(), 0, + 128, 1, 0, 0, numBytes, 0, adsDataType.getValue(), 0, 0, 0, - adsDataType.name(), "", "", Review Comment: I think I remember that I had a look locally and this was also what I saw in the case of my TC3 devices Table. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@plc4x.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org