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/command.pb.h
--- a/source/protocol/command.pb.h	Wed Jul 12 22:40:29 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/* Automatically generated nanopb header */
-/* Generated by nanopb-0.3.8 at Wed Jul 12 11:04:33 2017. */
-
-#ifndef PB_PROTOCOL_COMMAND_PB_H_INCLUDED
-#define PB_PROTOCOL_COMMAND_PB_H_INCLUDED
-#include <pb.h>
-
-#include "google/protobuf/timestamp.pb.h"
-
-/* @@protoc_insertion_point(includes) */
-#if PB_PROTO_HEADER_VERSION != 30
-#error Regenerate this file with the current version of nanopb generator.
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Enum definitions */
-typedef enum _protocol_CommandStatus {
-    protocol_CommandStatus_Success = 0
-} protocol_CommandStatus;
-#define _protocol_CommandStatus_MIN protocol_CommandStatus_Success
-#define _protocol_CommandStatus_MAX protocol_CommandStatus_Success
-#define _protocol_CommandStatus_ARRAYSIZE ((protocol_CommandStatus)(protocol_CommandStatus_Success+1))
-
-/* Struct definitions */
-typedef struct _protocol_CommandBatch {
-    pb_callback_t sn;
-    pb_callback_t items;
-/* @@protoc_insertion_point(struct:protocol_CommandBatch) */
-} protocol_CommandBatch;
-
-typedef struct _protocol_CommandResponseBatch {
-    pb_callback_t sn;
-    pb_callback_t items;
-/* @@protoc_insertion_point(struct:protocol_CommandResponseBatch) */
-} protocol_CommandResponseBatch;
-
-typedef struct _protocol_SecureCommandBatch {
-    pb_callback_t signature;
-    pb_callback_t content;
-/* @@protoc_insertion_point(struct:protocol_SecureCommandBatch) */
-} protocol_SecureCommandBatch;
-
-typedef struct _protocol_Command {
-    google_protobuf_Timestamp issuedDT;
-    uint32_t commandType;
-    pb_callback_t payload;
-/* @@protoc_insertion_point(struct:protocol_Command) */
-} protocol_Command;
-
-typedef struct _protocol_CommandResponse {
-    google_protobuf_Timestamp issuedDT;
-    protocol_CommandStatus status;
-/* @@protoc_insertion_point(struct:protocol_CommandResponse) */
-} protocol_CommandResponse;
-
-/* Default values for struct fields */
-
-/* Initializer values for message structs */
-#define protocol_Command_init_default            {google_protobuf_Timestamp_init_default, 0, {{NULL}, NULL}}
-#define protocol_CommandBatch_init_default       {{{NULL}, NULL}, {{NULL}, NULL}}
-#define protocol_SecureCommandBatch_init_default {{{NULL}, NULL}, {{NULL}, NULL}}
-#define protocol_CommandResponse_init_default    {google_protobuf_Timestamp_init_default, (protocol_CommandStatus)0}
-#define protocol_CommandResponseBatch_init_default {{{NULL}, NULL}, {{NULL}, NULL}}
-#define protocol_Command_init_zero               {google_protobuf_Timestamp_init_zero, 0, {{NULL}, NULL}}
-#define protocol_CommandBatch_init_zero          {{{NULL}, NULL}, {{NULL}, NULL}}
-#define protocol_SecureCommandBatch_init_zero    {{{NULL}, NULL}, {{NULL}, NULL}}
-#define protocol_CommandResponse_init_zero       {google_protobuf_Timestamp_init_zero, (protocol_CommandStatus)0}
-#define protocol_CommandResponseBatch_init_zero  {{{NULL}, NULL}, {{NULL}, NULL}}
-
-/* Field tags (for use in manual encoding/decoding) */
-#define protocol_CommandBatch_sn_tag             1
-#define protocol_CommandBatch_items_tag          10
-#define protocol_CommandResponseBatch_sn_tag     1
-#define protocol_CommandResponseBatch_items_tag  2
-#define protocol_SecureCommandBatch_signature_tag 1
-#define protocol_SecureCommandBatch_content_tag  2
-#define protocol_Command_issuedDT_tag            1
-#define protocol_Command_commandType_tag         2
-#define protocol_Command_payload_tag             10
-#define protocol_CommandResponse_issuedDT_tag    1
-#define protocol_CommandResponse_status_tag      2
-
-/* Struct field encoding specification for nanopb */
-extern const pb_field_t protocol_Command_fields[4];
-extern const pb_field_t protocol_CommandBatch_fields[3];
-extern const pb_field_t protocol_SecureCommandBatch_fields[3];
-extern const pb_field_t protocol_CommandResponse_fields[3];
-extern const pb_field_t protocol_CommandResponseBatch_fields[3];
-
-/* Maximum encoded size of messages (where known) */
-/* protocol_Command_size depends on runtime parameters */
-/* protocol_CommandBatch_size depends on runtime parameters */
-/* protocol_SecureCommandBatch_size depends on runtime parameters */
-#define protocol_CommandResponse_size            26
-/* protocol_CommandResponseBatch_size depends on runtime parameters */
-
-/* Message IDs (where set with "msgid" option) */
-#ifdef PB_MSGID
-
-#define COMMAND_MESSAGES \
-
-
-#endif
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-/* @@protoc_insertion_point(eof) */
-
-#endif