Page 1 of 1

Extending Unified Provisioning (BLE) Protobuf messages

Posted: Thu Dec 27, 2018 4:57 pm
by garagegadget
Hi,

I am testing the BLE Provisioning example which works fine.

1.How do I extend the Protobuf set config message to include additional custom fields?
2.What tooling is needed to extend the Protobuf messages?

BR,
Garage Gadget

Re: Extending Unified Provisioning (BLE) Protobuf messages

Posted: Fri Dec 28, 2018 12:13 pm
by ESP_Anurag
Hi,
1.How do I extend the Protobuf set config message to include additional custom fields?
The message structure is defined by Protobuf .proto files which are compiled to generate corresponding C files which are to be included by user code. You can add additional fields by writing your own Protobuf file and write the corresponding protocomm handlers for that.

For device side implementation, check https://github.com/espressif/esp-idf/tr ... tom_config which demonstrates creating a component custom_provisioning that adds additional fields (see https://github.com/espressif/esp-idf/bl ... /README.md).

https://github.com/espressif/esp-idf/bl ... nfig.proto has the definition of the custom fields. And this https://github.com/espressif/esp-idf/bl ... m_config.c implements the corresponding protocomm endpoint handler. In https://github.com/espressif/esp-idf/bl ... lers.c#L28 you would find a new provisioning handler corresponding to the endpoint handler. Now the endpoint handler (along with provisioning handler passed as private data) is to be registered with protocomm as shown here https://github.com/espressif/esp-idf/bl ... prov.c#L89.

There is also an example for client side implementation here https://github.com/espressif/esp-idf-pr ... rsions/avs. Though this is for a different message structure, not corresponding to the IDF example stated above. The custom Protobuf file is : https://github.com/espressif/esp-idf-pr ... nfig.proto which is used for generating the java file to be used by the android app.
2.What tooling is needed to extend the Protobuf messages?
protoc (Protobuf compiler) is required for generating java files, for which the release binaries can be found here https://github.com/protocolbuffers/protobuf/releases

While protoc-c (Protobuf C compiler) is required for generating C files, for which the source code can be found here https://github.com/protobuf-c/protobuf-c.

Re: Extending Unified Provisioning (BLE) Protobuf messages

Posted: Mon Dec 31, 2018 10:44 am
by garagegadget
Hi,

Thank you for the great feedback.

BR,
GarageGadget