1.. zephyr:code-sample:: nanopb 2 :name: Nanopb 3 4 Serialize and deserialize structured data using the nanopb module. 5 6Overview 7******** 8 9A simple protocol buffer sample using :ref:`nanopb_reference` for serializing structured data 10to platform independent raw buffers or streams. 11 12The structured data to encode/decode is presented as follows: 13 14.. code-block:: proto 15 16 syntax = "proto3"; 17 18 message SimpleMessage { 19 int32 lucky_number = 1; 20 bytes buffer = 2; 21 int32 unlucky_number = 3; 22 } 23 24Configuration 25************* 26 27This sample uses two configuration options to modify the behavior. 28 29* :kconfig:option:`CONFIG_SAMPLE_BUFFER_SIZE` sets the ``buffer`` field's size 30* :kconfig:option:`CONFIG_SAMPLE_UNLUCKY_NUMBER` either enables or disables the ``unlucky_number`` 31 field. 32 33Building and Running 34******************** 35 36This application can be built as follows: 37 38.. zephyr-app-commands:: 39 :zephyr-app: samples/modules/nanopb 40 :host-os: unix 41 :board: qemu_x86 42 :goals: run 43 :compact: 44