Fixing command parsing is a necessary part of making it possible to have many front-ends, at least without causing massive cross-compatibility problems.
Steps:
- Fix terminal CLI parsing
- Fix command history and parsing
- Create structures, one for each command, to hold the command’s arguments
- CLI parsing → just convert command line to the corresponding structures
- … then pass the filled-in structure to the existing functions to do what they do today
- Expose a
protobuff
-based interface over USB- Use COBS for packetizing the data.
- Start with a test message / static data, just to get framework working
- Slowly migrate commands to have protobuf equivalents
- Protobuf handler just converts protobuf into the corresponding structures
- … then pass the filled-in structure to the existing functions to do what they do today
- Lather, rinse, repeat … Slowly adding existing commands to the protobuf definitions
- Use the protobuf protocol definition file to generate the glue code necessary to use whatever language is preferred … .NET, Java, Python, Go, C, C++, …
- All the difficult work of enabling each of those languages is encapsulated into the protobuf compilers’ outputs.
- Use the generated API to generate the protobuf message, pipe that through a COBS encoder, and sends the resulting COBS-encoded packet over USB.
- Similarly, use COBS-decoder to get a protobuf packet response from USB
I’ve been looking on-and-off for ways to make the above transition workable for a while. It’s a decidedly non-trivial task, and doing so will have long-term positive results. I’ve not given up on it yet, and it’s not likely to be something completed in the next 1-2 months (at least based on my own volunteer time). The links above document some thoughts on how to make this work in a sustainable manner.