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.

Revision:
1:78f2fa2c125e
Parent:
0:fbdd0d307c19
diff -r fbdd0d307c19 -r 78f2fa2c125e source/protocol/info.pb.c
--- a/source/protocol/info.pb.c	Wed Jul 12 22:40:29 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/* Automatically generated nanopb constant definitions */
-/* Generated by nanopb-0.3.8 at Wed Jul 12 11:04:33 2017. */
-
-#include "info.pb.h"
-
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-
-
-const pb_field_t protocol_ISOMVersion_fields[7] = {
-    PB_FIELD(  1, STRING  , SINGULAR, CALLBACK, FIRST, protocol_ISOMVersion, buildStr, buildStr, 0),
-    PB_FIELD(  2, UINT32  , SINGULAR, STATIC  , OTHER, protocol_ISOMVersion, major, buildStr, 0),
-    PB_FIELD(  3, UINT32  , SINGULAR, STATIC  , OTHER, protocol_ISOMVersion, minor, major, 0),
-    PB_FIELD(  4, UINT32  , SINGULAR, STATIC  , OTHER, protocol_ISOMVersion, revision, minor, 0),
-    PB_FIELD(  5, UINT32  , SINGULAR, STATIC  , OTHER, protocol_ISOMVersion, build, revision, 0),
-    PB_FIELD(  6, UINT32  , SINGULAR, STATIC  , OTHER, protocol_ISOMVersion, changelist, build, 0),
-    PB_LAST_FIELD
-};
-
-const pb_field_t protocol_ErrCodeMsg_fields[3] = {
-    PB_FIELD(  1, UINT32  , SINGULAR, STATIC  , FIRST, protocol_ErrCodeMsg, code, code, 0),
-    PB_FIELD(  2, STRING  , SINGULAR, CALLBACK, OTHER, protocol_ErrCodeMsg, detail, code, 0),
-    PB_LAST_FIELD
-};
-
-const pb_field_t protocol_Info_fields[13] = {
-    PB_FIELD(  1, STRING  , SINGULAR, CALLBACK, FIRST, protocol_Info, hwPushBuildStr, hwPushBuildStr, 0),
-    PB_FIELD(  2, MESSAGE , SINGULAR, STATIC  , OTHER, protocol_Info, isomVer, hwPushBuildStr, &protocol_ISOMVersion_fields),
-    PB_FIELD(  3, STRING  , SINGULAR, CALLBACK, OTHER, protocol_Info, stmBuildStr, isomVer, 0),
-    PB_FIELD(  4, UINT32  , SINGULAR, STATIC  , OTHER, protocol_Info, batteryV, stmBuildStr, 0),
-    PB_FIELD(  5, UINT32  , SINGULAR, STATIC  , OTHER, protocol_Info, isomV, batteryV, 0),
-    PB_FIELD(  6, UINT32  , SINGULAR, STATIC  , OTHER, protocol_Info, isom33V, isomV, 0),
-    PB_FIELD(  7, UINT32  , SINGULAR, STATIC  , OTHER, protocol_Info, sw33V, isom33V, 0),
-    PB_FIELD(  8, UINT32  , SINGULAR, STATIC  , OTHER, protocol_Info, usbV, sw33V, 0),
-    PB_FIELD(  9, STRING  , SINGULAR, CALLBACK, OTHER, protocol_Info, cellIPStr, usbV, 0),
-    PB_FIELD( 10, STRING  , SINGULAR, CALLBACK, OTHER, protocol_Info, rssiStr, cellIPStr, 0),
-    PB_FIELD( 11, MESSAGE , SINGULAR, STATIC  , OTHER, protocol_Info, takenDT, rssiStr, &google_protobuf_Timestamp_fields),
-    PB_FIELD( 12, MESSAGE , REPEATED, CALLBACK, OTHER, protocol_Info, errors, takenDT, &protocol_Info_ErrorsEntry_fields),
-    PB_LAST_FIELD
-};
-
-const pb_field_t protocol_Info_ErrorsEntry_fields[3] = {
-    PB_FIELD(  1, STRING  , SINGULAR, CALLBACK, FIRST, protocol_Info_ErrorsEntry, key, key, 0),
-    PB_FIELD(  2, MESSAGE , SINGULAR, STATIC  , OTHER, protocol_Info_ErrorsEntry, value, key, &protocol_ErrCodeMsg_fields),
-    PB_LAST_FIELD
-};
-
-
-/* Check that field information fits in pb_field_t */
-#if !defined(PB_FIELD_32BIT)
-/* If you get an error here, it means that you need to define PB_FIELD_32BIT
- * compile-time option. You can do that in pb.h or on compiler command line.
- * 
- * The reason you need to do this is that some of your messages contain tag
- * numbers or field sizes that are larger than what can fit in 8 or 16 bit
- * field descriptors.
- */
-PB_STATIC_ASSERT((pb_membersize(protocol_Info, isomVer) < 65536 && pb_membersize(protocol_Info, takenDT) < 65536 && pb_membersize(protocol_Info_ErrorsEntry, value) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_protocol_ISOMVersion_protocol_ErrCodeMsg_protocol_Info_protocol_Info_ErrorsEntry)
-#endif
-
-#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
-/* If you get an error here, it means that you need to define PB_FIELD_16BIT
- * compile-time option. You can do that in pb.h or on compiler command line.
- * 
- * The reason you need to do this is that some of your messages contain tag
- * numbers or field sizes that are larger than what can fit in the default
- * 8 bit descriptors.
- */
-PB_STATIC_ASSERT((pb_membersize(protocol_Info, isomVer) < 256 && pb_membersize(protocol_Info, takenDT) < 256 && pb_membersize(protocol_Info_ErrorsEntry, value) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_protocol_ISOMVersion_protocol_ErrCodeMsg_protocol_Info_protocol_Info_ErrorsEntry)
-#endif
-
-
-/* @@protoc_insertion_point(eof) */