chrisdutz commented on code in PR #1902: URL: https://github.com/apache/plc4x/pull/1902#discussion_r1858576482
########## 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: Our ENUM constants, that I defined in the early versions of the ADS driver match here ... I mean ... we did an enum value of based on the name ... so I would expect the other direction to produce the name name (Except for the sized strings ... ) -- 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