plc4x icon indicating copy to clipboard operation
plc4x copied to clipboard

[Feature Request]: Can customize ‘default-payload-byte-order’ order

Open StrawberryBlue opened this issue 1 year ago • 3 comments

What would you like to happen?

now,Allowed values are:

  • BIG_ENDIAN
  • LITTLE_ENDIAN it is like
  • 3412
  • 1234
  • 4321
  • 2143

Programming Languages

  • [X] plc4j
  • [ ] plc4go
  • [ ] plc4c
  • [ ] plc4net

Protocols

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

StrawberryBlue avatar May 28 '24 03:05 StrawberryBlue

Actually the versions I implemented are more like this:

BIG_ENDIAN = 1234 LITTLE_ENDIAN = 4321

The other two options: 3412 and 2143 we didn't need at that time and couldn't find devices that need this. We would probably call them something else.

However implementing these options is more work than the first two. I personally would probably not be working on this any time soon. If you want me to prioritize this, I have this page, wehre you can drop a donation: https://buymeacoffee.com/christoferu which will definitely motivate me to do it sooner .... or - what would be even better, you whip up a PR for this feature yourself or you find someone who does it for you.

chrisdutz avatar May 28 '24 07:05 chrisdutz

Okay, I'll try to implement it

StrawberryBlue avatar May 29 '24 04:05 StrawberryBlue

Naming wise, I would opt for:

  • BIG_ENDIAN_WORD_SWAP
  • LITTLE_ENDIAN_WORD_SWAP

chrisdutz avatar May 29 '24 11:05 chrisdutz

Ok ... today I implemented the feature of supporting BIG_ENDIAN_BYTE_SWAP and LITTLE_ENDIAN_BYTE_SWAP as well as added support for overriding the default setting in the connection string on a per-tag basis.

chrisdutz avatar Jun 21 '24 16:06 chrisdutz