I have a C++ embedded app and I would like to create a web interface to configure it.
My plan is to describe the configuration structs in Cap'nProto then use the generated code on C++ and Javascript side.
A config scenario would be the following:
web app asks for the actual config (Javascript)
native app serves the actual config - serialization/write (C++)
- web app displays the actual config after deserialization/read (Javascript)
- user can modify the config in the web app - HOW? (Javascript)
- web app sends back the new config - serialization/write (Javascript)
- native app uses the new config after deserialization/read (C++)
- native app can modify the config - HOW? (C++)
4 and 7 are the tricky parts, because as far as I understand the API I can only deserialize a reader that is read only, however I would like to modify and re-serialize it later.
My questions are the followings:
- Is the described scenario the best approach to do what I want or I should do something totally different?
- Can I de-serialize a builder? Or somehow transform a reader into a builder (without copying)
- Should I use the generated C++ / Javascript structs as a direct source of configuration (actual code <-> Cap'nProto structs) or I should introduce "native" structs to interact with (actual code <-> "native" structs <->(serialize/deserialize) Cap'nProto structs)