-
Notifications
You must be signed in to change notification settings - Fork 1k
Deprecate BinaryPayloadDecoder / BinaryPayloadBuilder. #2456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The new functions proposed as alternative do not include the ByteOrder and WordOrder! How can I translate the old BinaryPayloadDecoder/BinaryPayloadBuilder login with the new functions? |
|
Byte order and word order are handled internally. |
|
Can I ask you how the library handle this? |
|
Of course you can, take a look at the source code. You read/write to/from the modbus standard NOT how each device CPU is configured, that is the beauty of the modbus (and most other) protocols. |
|
@janiversen you are actually not correct... As stated here the Modbus Protocol does not set any explicit roules in regards to endiannes:
Losing the ability to choose it dynamically would be quite bad. Looking at the source code the registers unpacking using the newly suggested Also when creating the byte list from the registers the endiannes is fixed to |
|
It does, it defines big endian for address, count and registers, the modbus protocol do not (sadly) know about 32 bit integers etc. The new functions are made to support the "de facto" standard used in many but not all modbus devices. But no need to discuss, nobody are forced to use the convert functions supplied, it's an option. And remark there are no loss of functionality since python offers these conversions (which are actually used in the implementation as you nicely point out), struct.pack/unpack is part of the standard library. |
|
@janiversen I think I understand your point basically saying but if that is the intention why even have this half-baked method convert_from_registers, that makes assumptions about endians? If the idea is to keep unix people had it this way -> Write programs that do one thing and do it well. |
|
it's because I and a large number of users need exactly that. If you do no not want to use it, fine by me, it's an option not a demand. with my life long experience this is a proper solution for most professional devices. Please remember byte order is actually defined by the standard as big endian (otherwise there would have been a lot of problems with fields like address/count and all bit requests). Word order is a de facto standard defined by the largest manufacturers like siemens and schneider (which uses big endian), so yes there are companies not following the de facto standard....but these companies also often deviate from the standard in other ways. |
No description provided.