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.

source/protocol/info.pb.h

Committer:
sgnezdov
Date:
2017-07-12
Revision:
0:fbdd0d307c19

File content as of revision 0:fbdd0d307c19:

/* Automatically generated nanopb header */
/* Generated by nanopb-0.3.8 at Wed Jul 12 11:04:33 2017. */

#ifndef PB_PROTOCOL_INFO_PB_H_INCLUDED
#define PB_PROTOCOL_INFO_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

/* Struct definitions */
typedef struct _protocol_ErrCodeMsg {
    uint32_t code;
    pb_callback_t detail;
/* @@protoc_insertion_point(struct:protocol_ErrCodeMsg) */
} protocol_ErrCodeMsg;

typedef struct _protocol_ISOMVersion {
    pb_callback_t buildStr;
    uint32_t major;
    uint32_t minor;
    uint32_t revision;
    uint32_t build;
    uint32_t changelist;
/* @@protoc_insertion_point(struct:protocol_ISOMVersion) */
} protocol_ISOMVersion;

typedef struct _protocol_Info {
    pb_callback_t hwPushBuildStr;
    protocol_ISOMVersion isomVer;
    pb_callback_t stmBuildStr;
    uint32_t batteryV;
    uint32_t isomV;
    uint32_t isom33V;
    uint32_t sw33V;
    uint32_t usbV;
    pb_callback_t cellIPStr;
    pb_callback_t rssiStr;
    google_protobuf_Timestamp takenDT;
    pb_callback_t errors;
/* @@protoc_insertion_point(struct:protocol_Info) */
} protocol_Info;

typedef struct _protocol_Info_ErrorsEntry {
    pb_callback_t key;
    protocol_ErrCodeMsg value;
/* @@protoc_insertion_point(struct:protocol_Info_ErrorsEntry) */
} protocol_Info_ErrorsEntry;

/* Default values for struct fields */

/* Initializer values for message structs */
#define protocol_ISOMVersion_init_default        {{{NULL}, NULL}, 0, 0, 0, 0, 0}
#define protocol_ErrCodeMsg_init_default         {0, {{NULL}, NULL}}
#define protocol_Info_init_default               {{{NULL}, NULL}, protocol_ISOMVersion_init_default, {{NULL}, NULL}, 0, 0, 0, 0, 0, {{NULL}, NULL}, {{NULL}, NULL}, google_protobuf_Timestamp_init_default, {{NULL}, NULL}}
#define protocol_Info_ErrorsEntry_init_default   {{{NULL}, NULL}, protocol_ErrCodeMsg_init_default}
#define protocol_ISOMVersion_init_zero           {{{NULL}, NULL}, 0, 0, 0, 0, 0}
#define protocol_ErrCodeMsg_init_zero            {0, {{NULL}, NULL}}
#define protocol_Info_init_zero                  {{{NULL}, NULL}, protocol_ISOMVersion_init_zero, {{NULL}, NULL}, 0, 0, 0, 0, 0, {{NULL}, NULL}, {{NULL}, NULL}, google_protobuf_Timestamp_init_zero, {{NULL}, NULL}}
#define protocol_Info_ErrorsEntry_init_zero      {{{NULL}, NULL}, protocol_ErrCodeMsg_init_zero}

/* Field tags (for use in manual encoding/decoding) */
#define protocol_ErrCodeMsg_code_tag             1
#define protocol_ErrCodeMsg_detail_tag           2
#define protocol_ISOMVersion_buildStr_tag        1
#define protocol_ISOMVersion_major_tag           2
#define protocol_ISOMVersion_minor_tag           3
#define protocol_ISOMVersion_revision_tag        4
#define protocol_ISOMVersion_build_tag           5
#define protocol_ISOMVersion_changelist_tag      6
#define protocol_Info_hwPushBuildStr_tag         1
#define protocol_Info_isomVer_tag                2
#define protocol_Info_stmBuildStr_tag            3
#define protocol_Info_batteryV_tag               4
#define protocol_Info_isomV_tag                  5
#define protocol_Info_isom33V_tag                6
#define protocol_Info_sw33V_tag                  7
#define protocol_Info_usbV_tag                   8
#define protocol_Info_cellIPStr_tag              9
#define protocol_Info_rssiStr_tag                10
#define protocol_Info_takenDT_tag                11
#define protocol_Info_errors_tag                 12
#define protocol_Info_ErrorsEntry_key_tag        1
#define protocol_Info_ErrorsEntry_value_tag      2

/* Struct field encoding specification for nanopb */
extern const pb_field_t protocol_ISOMVersion_fields[7];
extern const pb_field_t protocol_ErrCodeMsg_fields[3];
extern const pb_field_t protocol_Info_fields[13];
extern const pb_field_t protocol_Info_ErrorsEntry_fields[3];

/* Maximum encoded size of messages (where known) */
/* protocol_ISOMVersion_size depends on runtime parameters */
/* protocol_ErrCodeMsg_size depends on runtime parameters */
/* protocol_Info_size depends on runtime parameters */
/* protocol_Info_ErrorsEntry_size depends on runtime parameters */

/* Message IDs (where set with "msgid" option) */
#ifdef PB_MSGID

#define INFO_MESSAGES \


#endif

#ifdef __cplusplus
} /* extern "C" */
#endif
/* @@protoc_insertion_point(eof) */

#endif