All in one solution demonstrating how to use nanopb Protocol Buffers library from within mbed environment. Test case is very simple. It works.
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.
Diff: source/protocol/eagle.pb.h
- Revision:
- 1:78f2fa2c125e
- Parent:
- 0:fbdd0d307c19
--- a/source/protocol/eagle.pb.h Wed Jul 12 22:40:29 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.8 at Wed Jul 12 11:04:33 2017. */ - -#ifndef PB_PROTOCOL_EAGLE_PB_H_INCLUDED -#define PB_PROTOCOL_EAGLE_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_EagleValveStatusType { - protocol_EagleValveStatusType_EagleUndefined = 0, - protocol_EagleValveStatusType_EagleValveStatus = 1, - protocol_EagleValveStatusType_EagleValveOpen = 2, - protocol_EagleValveStatusType_EagleValveClose = 3 -} protocol_EagleValveStatusType; -#define _protocol_EagleValveStatusType_MIN protocol_EagleValveStatusType_EagleUndefined -#define _protocol_EagleValveStatusType_MAX protocol_EagleValveStatusType_EagleValveClose -#define _protocol_EagleValveStatusType_ARRAYSIZE ((protocol_EagleValveStatusType)(protocol_EagleValveStatusType_EagleValveClose+1)) - -/* Struct definitions */ -typedef struct _protocol_EagleRawSample { - protocol_EagleValveStatusType ValveStatusType; - pb_callback_t ValveStatus; - pb_callback_t Consumption; -/* @@protoc_insertion_point(struct:protocol_EagleRawSample) */ -} protocol_EagleRawSample; - -/* Default values for struct fields */ - -/* Initializer values for message structs */ -#define protocol_EagleRawSample_init_default {(protocol_EagleValveStatusType)0, {{NULL}, NULL}, {{NULL}, NULL}} -#define protocol_EagleRawSample_init_zero {(protocol_EagleValveStatusType)0, {{NULL}, NULL}, {{NULL}, NULL}} - -/* Field tags (for use in manual encoding/decoding) */ -#define protocol_EagleRawSample_ValveStatusType_tag 2 -#define protocol_EagleRawSample_ValveStatus_tag 3 -#define protocol_EagleRawSample_Consumption_tag 4 - -/* Struct field encoding specification for nanopb */ -extern const pb_field_t protocol_EagleRawSample_fields[4]; - -/* Maximum encoded size of messages (where known) */ -/* protocol_EagleRawSample_size depends on runtime parameters */ - -/* Message IDs (where set with "msgid" option) */ -#ifdef PB_MSGID - -#define EAGLE_MESSAGES \ - - -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif -/* @@protoc_insertion_point(eof) */ - -#endif