Questions about efficient fpp struct definitions and little endian serialization/deserialization #2735
Unanswered
ReggieMarr
asked this question in
Q&A
Replies: 1 comment 4 replies
-
It honestly looks like you are trying to re-implement serialization instead of building your own framer/deframer (which, in effect, is a serializer and deserializer) to talk to an external entity. Have you looked at the Comms Adapter Interface documentation yet? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
I have been implementing Endurosat's User protocol for a flight software project and I thought I'd leverage fpp here. I'm mostly looking for tips of how to best architect my data structures.
For example I have the following fpp code:
Note that for each packet we'll have a header which is going to have a the same default headerId however each command has a unique cmdId and typeId.
I've leveraged defaults to set these however it feels a bit awkward since the CmdId and TypeId should really be part of the header. The reason they aren't is that it doesn't seem that we can express nested defaults.
It would also make sense to be able to set constants within a data structure but that also doesn't seem to be allowed.
Is there some way I can improve this ?
Also since the device I'm communicating with uses little endian I end up having to manually shift things like so:
I suppose I could just override the serialization function for the underlying type but I wanted to see if there was a better way (and if not am I able to get information about the order of members from the object)
Thanks so much for the help btw ! I hope that I can at some point formally release this since on the community page/somewhere I think it'd be useful for others.
Beta Was this translation helpful? Give feedback.
All reactions