Hello All,
refactoring a system where data is exchanged and stored in a terse binary format, I'm looking for abstraction methods.
The packets consist of length, version and a version dependent sequence of byte and (two-byte) word values.
The legacy version uses a set of defines with offsets and type casts to access the byte and word values directly in the raw byte array. Of course this is limited to controllers with the same endianness (currently that's true). Not pretty but fast.
I'm considering a table based copy to a working structure for the faster hosts, but that's not possible in the resource (speed and memory) limited 8 bit controller.
Besides this, it will be difficult to use the same structure definition for both methods, and I would dislike somewhat to to keep two representations in sync (manually or by an automatic converter).
Any thoughts?
Oliver