apache/plc4x

[Bug]: ADS Driver has issues writing Structs

chrisdutz opened this issue · 2 comments

What happened?

When running the manual tests, it turns out that there seem to be issues with writing Structs.

Version

0.11.0-SNAPSHOT

Programming Languages

  • plc4j
  • plc4go
  • plc4c
  • plc4net

Protocols

  • AB-Ethernet
  • ADS /AMS
  • BACnet/IP
  • CANopen
  • DeltaV
  • DF1
  • EtherNet/IP
  • Firmata
  • KNXnet/IP
  • Modbus
  • OPC-UA
  • S7

I think I have found the issue:

  • When reading a Struct/UDT, we get a chunk of bytes back from the server. The Tag information defines which element is located where and how long it is.
  • Some times the start of the next tag leaves a gap and when parsing we simply skip those bytes
  • Currently when writing we don't fill these gaps (This is what needs to be changed)

I have contacted my guy at Beckhoff, asking him if it's safe to simply fill these gaps with zero-bytes, or if we need to fetch the chunk we want to update first and then to update it, leaving the skipped bytes unchanged.

In the end the padding bytes were one cause of the problem, the second one was that WSTRING fields were serialized BigEndian, no matter what the encoding said.