I need to implement a fairly simple network protocol: there is a device with a microcontroller (C language) and a Java application, they need to communicate: I need to implement a firmware update and, possibly, some other things.
At least I need to pass some data structures as headers.
Only the ugly way comes to mind:
I can declare a packed structure on the C side and somehow process the same data stream on the Java side. So, if my structure is changed, I need to make changes on both sides: C and Java. I really don't like it.
Is there a better way to do this? Perhaps something like this: I have to write the protocol structures in some special format, and then some utility can generate code for the C and Java sides.
Or maybe something else.
I would be glad to see the offers.
source share