Itron LCE research protocol on July 12, 2017. The protocol is based on Protocol Buffers developed by Google.
Dependents: ProtocBufTest Borsch
Revision 2:67db916a7e08, committed 2017-08-03
- Comitter:
- sgnezdov
- Date:
- Thu Aug 03 00:07:26 2017 +0000
- Parent:
- 1:83c12dd43854
- Commit message:
- updated protocol to use proper data types
Changed in this revision
source/job.pb.c | Show annotated file Show diff for this revision Revisions of this file |
source/job.pb.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 83c12dd43854 -r 67db916a7e08 source/job.pb.c --- a/source/job.pb.c Tue Aug 01 23:29:05 2017 +0000 +++ b/source/job.pb.c Thu Aug 03 00:07:26 2017 +0000 @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.8 at Tue Aug 1 16:20:24 2017. */ +/* Generated by nanopb-0.3.8 at Wed Aug 2 11:56:10 2017. */ #include "job.pb.h" @@ -14,14 +14,14 @@ PB_FIELD( 1, UINT32 , SINGULAR, STATIC , FIRST, protocol_Job, ID, ID, 0), PB_FIELD( 2, UINT32 , SINGULAR, STATIC , OTHER, protocol_Job, TypeID, ID, 0), PB_FIELD( 3, UENUM , SINGULAR, STATIC , OTHER, protocol_Job, ScheduleTypeID, TypeID, 0), - PB_FIELD( 4, BYTES , SINGULAR, CALLBACK, OTHER, protocol_Job, ScheduleData, ScheduleTypeID, 0), - PB_FIELD( 5, BYTES , SINGULAR, CALLBACK, OTHER, protocol_Job, Data, ScheduleData, 0), + PB_FIELD( 4, BYTES , SINGULAR, STATIC , OTHER, protocol_Job, ScheduleData, ScheduleTypeID, 0), + PB_FIELD( 5, BYTES , SINGULAR, STATIC , OTHER, protocol_Job, Data, ScheduleData, 0), PB_LAST_FIELD }; const pb_field_t protocol_JobList_fields[3] = { - PB_FIELD( 1, STRING , SINGULAR, CALLBACK, FIRST, protocol_JobList, sn, sn, 0), - PB_FIELD( 2, MESSAGE , REPEATED, CALLBACK, OTHER, protocol_JobList, items, sn, &protocol_Job_fields), + PB_FIELD( 1, STRING , SINGULAR, STATIC , FIRST, protocol_JobList, sn, sn, 0), + PB_FIELD( 2, MESSAGE , REPEATED, STATIC , OTHER, protocol_JobList, items, sn, &protocol_Job_fields), PB_LAST_FIELD }; @@ -48,4 +48,28 @@ +/* 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_JobList, items[0]) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_protocol_Job_protocol_JobList_protocol_RunOnceSchedule_protocol_PeriodicSchedule_protocol_TopOfHourSchedule_protocol_NeverRunSchedule) +#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_JobList, items[0]) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_protocol_Job_protocol_JobList_protocol_RunOnceSchedule_protocol_PeriodicSchedule_protocol_TopOfHourSchedule_protocol_NeverRunSchedule) +#endif + + /* @@protoc_insertion_point(eof) */
diff -r 83c12dd43854 -r 67db916a7e08 source/job.pb.h --- a/source/job.pb.h Tue Aug 01 23:29:05 2017 +0000 +++ b/source/job.pb.h Thu Aug 03 00:07:26 2017 +0000 @@ -1,12 +1,10 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.8 at Tue Aug 1 16:20:24 2017. */ +/* Generated by nanopb-0.3.8 at Wed Aug 2 11:56:10 2017. */ #ifndef PB_PROTOCOL_JOB_PB_H_INCLUDED #define PB_PROTOCOL_JOB_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. @@ -29,23 +27,19 @@ #define _protocol_ScheduleType_ARRAYSIZE ((protocol_ScheduleType)(protocol_ScheduleType_NeverRun+1)) /* Struct definitions */ -typedef struct _protocol_JobList { - pb_callback_t sn; - pb_callback_t items; -/* @@protoc_insertion_point(struct:protocol_JobList) */ -} protocol_JobList; - typedef struct _protocol_NeverRunSchedule { char dummy_field; /* @@protoc_insertion_point(struct:protocol_NeverRunSchedule) */ } protocol_NeverRunSchedule; +typedef PB_BYTES_ARRAY_T(100) protocol_Job_ScheduleData_t; +typedef PB_BYTES_ARRAY_T(100) protocol_Job_Data_t; typedef struct _protocol_Job { uint32_t ID; uint32_t TypeID; protocol_ScheduleType ScheduleTypeID; - pb_callback_t ScheduleData; - pb_callback_t Data; + protocol_Job_ScheduleData_t ScheduleData; + protocol_Job_Data_t Data; /* @@protoc_insertion_point(struct:protocol_Job) */ } protocol_Job; @@ -66,25 +60,30 @@ /* @@protoc_insertion_point(struct:protocol_TopOfHourSchedule) */ } protocol_TopOfHourSchedule; +typedef struct _protocol_JobList { + char sn[16]; + pb_size_t items_count; + protocol_Job items[16]; +/* @@protoc_insertion_point(struct:protocol_JobList) */ +} protocol_JobList; + /* Default values for struct fields */ /* Initializer values for message structs */ -#define protocol_Job_init_default {0, 0, (protocol_ScheduleType)0, {{NULL}, NULL}, {{NULL}, NULL}} -#define protocol_JobList_init_default {{{NULL}, NULL}, {{NULL}, NULL}} +#define protocol_Job_init_default {0, 0, (protocol_ScheduleType)0, {0, {0}}, {0, {0}}} +#define protocol_JobList_init_default {"", 0, {protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default, protocol_Job_init_default}} #define protocol_RunOnceSchedule_init_default {0} #define protocol_PeriodicSchedule_init_default {0, 0} #define protocol_TopOfHourSchedule_init_default {0, 0} #define protocol_NeverRunSchedule_init_default {0} -#define protocol_Job_init_zero {0, 0, (protocol_ScheduleType)0, {{NULL}, NULL}, {{NULL}, NULL}} -#define protocol_JobList_init_zero {{{NULL}, NULL}, {{NULL}, NULL}} +#define protocol_Job_init_zero {0, 0, (protocol_ScheduleType)0, {0, {0}}, {0, {0}}} +#define protocol_JobList_init_zero {"", 0, {protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero, protocol_Job_init_zero}} #define protocol_RunOnceSchedule_init_zero {0} #define protocol_PeriodicSchedule_init_zero {0, 0} #define protocol_TopOfHourSchedule_init_zero {0, 0} #define protocol_NeverRunSchedule_init_zero {0} /* Field tags (for use in manual encoding/decoding) */ -#define protocol_JobList_sn_tag 1 -#define protocol_JobList_items_tag 2 #define protocol_Job_ID_tag 1 #define protocol_Job_TypeID_tag 2 #define protocol_Job_ScheduleTypeID_tag 3 @@ -95,6 +94,8 @@ #define protocol_RunOnceSchedule_AtUnixSec_tag 1 #define protocol_TopOfHourSchedule_OffsetSec_tag 1 #define protocol_TopOfHourSchedule_PeriodSec_tag 2 +#define protocol_JobList_sn_tag 1 +#define protocol_JobList_items_tag 2 /* Struct field encoding specification for nanopb */ extern const pb_field_t protocol_Job_fields[6]; @@ -105,8 +106,8 @@ extern const pb_field_t protocol_NeverRunSchedule_fields[1]; /* Maximum encoded size of messages (where known) */ -/* protocol_Job_size depends on runtime parameters */ -/* protocol_JobList_size depends on runtime parameters */ +#define protocol_Job_size 218 +#define protocol_JobList_size 3554 #define protocol_RunOnceSchedule_size 6 #define protocol_PeriodicSchedule_size 12 #define protocol_TopOfHourSchedule_size 12