Bluenet is the in-house firmware on Crownstone hardware. Functions: switching, dimming, energy monitoring, presence detection, indoor localization, switchcraft.
However, this is not done consistently. A setup package has a lot of fields that cross 4-byte boundaries. This makes storing them much more cumbersome. In the worst case, it requires copying every field to the right alignment. A protocol redesign that takes into 4 bytes separation would be useful.
For now, I'll construct wrapper structs that prepend for example the setup package with a few bytes so that most of the large fields will be 4-byte aligned.
A lot of packets at https://github.com/crownstone/bluenet/blob/master/docs/PROTOCOL.md seem to be nicely 4-byte aligned. A state packet starts for example with two uint8_t values and then a length of uint16_t.
However, this is not done consistently. A setup package has a lot of fields that cross 4-byte boundaries. This makes storing them much more cumbersome. In the worst case, it requires copying every field to the right alignment. A protocol redesign that takes into 4 bytes separation would be useful.
For now, I'll construct wrapper structs that prepend for example the setup package with a few bytes so that most of the large fields will be 4-byte aligned.