Binary union packet definition support #112
git-gawwyt
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Reason\Context
Some highly constrained devices/transport protocols find the overheads of JSON or even protobuf to be too large to handle. Such as when using Lora or CAN for transport or running a sensor attached to a micro (e.g. an ATMEGA324PB).
In these situations, event payloads are encoded into space-optimized binary unions (see below for C++ example). It would be nice if the same tooling for defining the event systems further upstream could be used at this level so the solution can be approached as a whole.
C++ union example for clarity
The above struct is a simplified example but the general idea is to pack as much useful information into what might be a very limited transport payload size (8 bytes in CAN)
Implementation ideas
To keep impact outside of this niche use case limited, it might be a good idea to implement this as an extension of the binary format for a string.
ie:
an alternative would be to extend integer to have an optional bits field and create a new union format for objects that indicates it should be de/serialized as such.
ie:
Took a step back from "just doing it" to check which implementation approach the maintainers would go with and get some feedback.
Beta Was this translation helpful? Give feedback.
All reactions