Home | History | Annotate | Download | only in simple
      1 Nanopb example "simple"
      2 =======================
      3 
      4 This example demonstrates the very basic use of nanopb. It encodes and
      5 decodes a simple message.
      6 
      7 The code uses four different API functions:
      8 
      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
     13 
     14 Example usage
     15 -------------
     16 
     17 On Linux, simply type "make" to build the example. After that, you can
     18 run it with the command: ./simple
     19 
     20 On other platforms, you first have to compile the protocol definition using
     21 the following command::
     22 
     23   ../../generator-bin/protoc --nanopb_out=. simple.proto
     24 
     25 After that, add the following four files to your project and compile:
     26 
     27   simple.c  simple.pb.c  pb_encode.c  pb_decode.c
     28 
     29 
     30