chrisdutz commented on code in PR #1902: URL: https://github.com/apache/plc4x/pull/1902#discussion_r1858589632
########## 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: Possibly change it to that then? However I don't really think the information is ever read again ... but one would need to check that ... I think usually we use the "read by map-key" and don't really check the "getName" of the entry. -- 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