1 Nanopb example "simple"
2 =======================
4 This example demonstrates the very basic use of nanopb. It encodes and
5 decodes a simple message.
7 The code uses four different API functions:
9 * pb_ostream_from_buffer() to declare the output buffer that is to be used
10 * pb_encode() to encode a message
11 * pb_istream_from_buffer() to declare the input buffer that is to be used
12 * pb_decode() to decode a message
17 On Linux, simply type "make" to build the example. After that, you can
18 run it with the command: ./simple
20 On other platforms, you first have to compile the protocol definition using
21 the following two commands::
23 protoc -osimple.pb simple.proto
24 python nanopb_generator.py simple.pb
26 After that, add the following four files to your project and compile:
28 simple.c simple.pb.c pb_encode.c pb_decode.c