All in one solution demonstrating how to use nanopb Protocol Buffers library from within mbed environment. Test case is very simple. It works.

Dependencies:   nanopb protocol

Original import was an all-in-one solution that only depends on mbed.

Current implementation extracted 2 librarires:

1) nanopb contains code required to use nanopb and Timestamp dependency. 2) protocol is a specific research protocol used by LCE at Itron at the moment of commit.

The application decodes Protocol Buffers message generated with GO application using the same 'protocol'. This test level application decodes message and validates that it matches expected.

It is simply a proof that nanopb library can be used.

Committer:
sgnezdov
Date:
Wed Jul 12 22:40:29 2017 +0000
Revision:
0:fbdd0d307c19
initial import demonstrates how to decode Sample protocol buffers message.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sgnezdov 0:fbdd0d307c19 1 /* Automatically generated nanopb header */
sgnezdov 0:fbdd0d307c19 2 /* Generated by nanopb-0.3.8 at Wed Jul 12 14:16:40 2017. */
sgnezdov 0:fbdd0d307c19 3
sgnezdov 0:fbdd0d307c19 4 #ifndef PB_GOOGLE_PROTOBUF_TIMESTAMP_PB_H_INCLUDED
sgnezdov 0:fbdd0d307c19 5 #define PB_GOOGLE_PROTOBUF_TIMESTAMP_PB_H_INCLUDED
sgnezdov 0:fbdd0d307c19 6 #include <pb.h>
sgnezdov 0:fbdd0d307c19 7
sgnezdov 0:fbdd0d307c19 8 /* @@protoc_insertion_point(includes) */
sgnezdov 0:fbdd0d307c19 9 #if PB_PROTO_HEADER_VERSION != 30
sgnezdov 0:fbdd0d307c19 10 #error Regenerate this file with the current version of nanopb generator.
sgnezdov 0:fbdd0d307c19 11 #endif
sgnezdov 0:fbdd0d307c19 12
sgnezdov 0:fbdd0d307c19 13 #ifdef __cplusplus
sgnezdov 0:fbdd0d307c19 14 extern "C" {
sgnezdov 0:fbdd0d307c19 15 #endif
sgnezdov 0:fbdd0d307c19 16
sgnezdov 0:fbdd0d307c19 17 /* Struct definitions */
sgnezdov 0:fbdd0d307c19 18 typedef struct _google_protobuf_Timestamp {
sgnezdov 0:fbdd0d307c19 19 int64_t seconds;
sgnezdov 0:fbdd0d307c19 20 int32_t nanos;
sgnezdov 0:fbdd0d307c19 21 /* @@protoc_insertion_point(struct:google_protobuf_Timestamp) */
sgnezdov 0:fbdd0d307c19 22 } google_protobuf_Timestamp;
sgnezdov 0:fbdd0d307c19 23
sgnezdov 0:fbdd0d307c19 24 /* Default values for struct fields */
sgnezdov 0:fbdd0d307c19 25
sgnezdov 0:fbdd0d307c19 26 /* Initializer values for message structs */
sgnezdov 0:fbdd0d307c19 27 #define google_protobuf_Timestamp_init_default {0, 0}
sgnezdov 0:fbdd0d307c19 28 #define google_protobuf_Timestamp_init_zero {0, 0}
sgnezdov 0:fbdd0d307c19 29
sgnezdov 0:fbdd0d307c19 30 /* Field tags (for use in manual encoding/decoding) */
sgnezdov 0:fbdd0d307c19 31 #define google_protobuf_Timestamp_seconds_tag 1
sgnezdov 0:fbdd0d307c19 32 #define google_protobuf_Timestamp_nanos_tag 2
sgnezdov 0:fbdd0d307c19 33
sgnezdov 0:fbdd0d307c19 34 /* Struct field encoding specification for nanopb */
sgnezdov 0:fbdd0d307c19 35 extern const pb_field_t google_protobuf_Timestamp_fields[3];
sgnezdov 0:fbdd0d307c19 36
sgnezdov 0:fbdd0d307c19 37 /* Maximum encoded size of messages (where known) */
sgnezdov 0:fbdd0d307c19 38 #define google_protobuf_Timestamp_size 22
sgnezdov 0:fbdd0d307c19 39
sgnezdov 0:fbdd0d307c19 40 /* Message IDs (where set with "msgid" option) */
sgnezdov 0:fbdd0d307c19 41 #ifdef PB_MSGID
sgnezdov 0:fbdd0d307c19 42
sgnezdov 0:fbdd0d307c19 43 #define TIMESTAMP_MESSAGES \
sgnezdov 0:fbdd0d307c19 44
sgnezdov 0:fbdd0d307c19 45
sgnezdov 0:fbdd0d307c19 46 #endif
sgnezdov 0:fbdd0d307c19 47
sgnezdov 0:fbdd0d307c19 48 #ifdef __cplusplus
sgnezdov 0:fbdd0d307c19 49 } /* extern "C" */
sgnezdov 0:fbdd0d307c19 50 #endif
sgnezdov 0:fbdd0d307c19 51 /* @@protoc_insertion_point(eof) */
sgnezdov 0:fbdd0d307c19 52
sgnezdov 0:fbdd0d307c19 53 #endif