From f8ea5374f584310fbd7521b41385a71eb7c613d3 Mon Sep 17 00:00:00 2001 From: Christopher Peplin Date: Thu, 24 Oct 2013 10:09:30 -0400 Subject: Minimize the number of separate protobuf types. --- gen/cpp/openxc.pb | 29 +++++++++++++++++++---------- gen/cpp/openxc.pb.c | 19 ++++++++++--------- gen/cpp/openxc.pb.h | 42 +++++++++++++++++++++++++++--------------- 3 files changed, 56 insertions(+), 34 deletions(-) (limited to 'gen/cpp') diff --git a/gen/cpp/openxc.pb b/gen/cpp/openxc.pb index d4356e1c..88cf91aa 100644 --- a/gen/cpp/openxc.pb +++ b/gen/cpp/openxc.pb @@ -1,5 +1,5 @@ -à +è openxc.protoopenxc"¼ VehicleMessage) type (2.openxc.VehicleMessage.Type' @@ -14,14 +14,23 @@ RawMessage bus ( message_id (  -data ("­ -TranslatedMessage -name (  - string_value (  -numerical_value ( - boolean_value ( - string_event (  -numerical_event ( - boolean_event (B +data ("µ +TranslatedMessage, +type (2.openxc.TranslatedMessage.Type +name (  + string_value (  + numeric_value ( + boolean_value ( + string_event (  + numeric_event ( + boolean_event ("\ +Type + +STRING +NUM +BOOL +EVENTED_STRING + EVENTED_NUM + EVENTED_BOOLB com.openxcBBinaryMessages \ No newline at end of file diff --git a/gen/cpp/openxc.pb.c b/gen/cpp/openxc.pb.c index 91667bf3..1625254e 100644 --- a/gen/cpp/openxc.pb.c +++ b/gen/cpp/openxc.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.2.4-dev at Wed Oct 9 14:26:13 2013. */ +/* Generated by nanopb-0.2.4-dev at Thu Oct 24 10:06:38 2013. */ #include "openxc.pb.h" @@ -19,14 +19,15 @@ const pb_field_t openxc_RawMessage_fields[4] = { PB_LAST_FIELD }; -const pb_field_t openxc_TranslatedMessage_fields[8] = { - PB_FIELD2( 1, STRING , OPTIONAL, STATIC, FIRST, openxc_TranslatedMessage, name, name, 0), - PB_FIELD2( 2, STRING , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, string_value, name, 0), - PB_FIELD2( 3, DOUBLE , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, numerical_value, string_value, 0), - PB_FIELD2( 4, BOOL , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, boolean_value, numerical_value, 0), - PB_FIELD2( 5, STRING , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, string_event, boolean_value, 0), - PB_FIELD2( 6, DOUBLE , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, numerical_event, string_event, 0), - PB_FIELD2( 7, BOOL , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, boolean_event, numerical_event, 0), +const pb_field_t openxc_TranslatedMessage_fields[9] = { + PB_FIELD2( 1, ENUM , OPTIONAL, STATIC, FIRST, openxc_TranslatedMessage, type, type, 0), + PB_FIELD2( 2, STRING , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, name, type, 0), + PB_FIELD2( 3, STRING , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, string_value, name, 0), + PB_FIELD2( 4, DOUBLE , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, numeric_value, string_value, 0), + PB_FIELD2( 5, BOOL , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, boolean_value, numeric_value, 0), + PB_FIELD2( 6, STRING , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, string_event, boolean_value, 0), + PB_FIELD2( 7, DOUBLE , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, numeric_event, string_event, 0), + PB_FIELD2( 8, BOOL , OPTIONAL, STATIC, OTHER, openxc_TranslatedMessage, boolean_event, numeric_event, 0), PB_LAST_FIELD }; diff --git a/gen/cpp/openxc.pb.h b/gen/cpp/openxc.pb.h index d278c681..81a0779d 100644 --- a/gen/cpp/openxc.pb.h +++ b/gen/cpp/openxc.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.2.4-dev at Wed Oct 9 14:26:13 2013. */ +/* Generated by nanopb-0.2.4-dev at Thu Oct 24 10:06:38 2013. */ #ifndef _PB_OPENXC_PB_H_ #define _PB_OPENXC_PB_H_ @@ -15,6 +15,15 @@ typedef enum _openxc_VehicleMessage_Type { openxc_VehicleMessage_Type_TRANSLATED = 2 } openxc_VehicleMessage_Type; +typedef enum _openxc_TranslatedMessage_Type { + openxc_TranslatedMessage_Type_STRING = 1, + openxc_TranslatedMessage_Type_NUM = 2, + openxc_TranslatedMessage_Type_BOOL = 3, + openxc_TranslatedMessage_Type_EVENTED_STRING = 4, + openxc_TranslatedMessage_Type_EVENTED_NUM = 5, + openxc_TranslatedMessage_Type_EVENTED_BOOL = 6 +} openxc_TranslatedMessage_Type; + /* Struct definitions */ typedef struct _openxc_RawMessage { bool has_bus; @@ -26,18 +35,20 @@ typedef struct _openxc_RawMessage { } openxc_RawMessage; typedef struct _openxc_TranslatedMessage { + bool has_type; + openxc_TranslatedMessage_Type type; bool has_name; char name[100]; bool has_string_value; char string_value[100]; - bool has_numerical_value; - double numerical_value; + bool has_numeric_value; + double numeric_value; bool has_boolean_value; bool boolean_value; bool has_string_event; char string_event[100]; - bool has_numerical_event; - double numerical_event; + bool has_numeric_event; + double numeric_event; bool has_boolean_event; bool boolean_event; } openxc_TranslatedMessage; @@ -57,13 +68,14 @@ typedef struct _openxc_VehicleMessage { #define openxc_RawMessage_bus_tag 1 #define openxc_RawMessage_message_id_tag 2 #define openxc_RawMessage_data_tag 3 -#define openxc_TranslatedMessage_name_tag 1 -#define openxc_TranslatedMessage_string_value_tag 2 -#define openxc_TranslatedMessage_numerical_value_tag 3 -#define openxc_TranslatedMessage_boolean_value_tag 4 -#define openxc_TranslatedMessage_string_event_tag 5 -#define openxc_TranslatedMessage_numerical_event_tag 6 -#define openxc_TranslatedMessage_boolean_event_tag 7 +#define openxc_TranslatedMessage_type_tag 1 +#define openxc_TranslatedMessage_name_tag 2 +#define openxc_TranslatedMessage_string_value_tag 3 +#define openxc_TranslatedMessage_numeric_value_tag 4 +#define openxc_TranslatedMessage_boolean_value_tag 5 +#define openxc_TranslatedMessage_string_event_tag 6 +#define openxc_TranslatedMessage_numeric_event_tag 7 +#define openxc_TranslatedMessage_boolean_event_tag 8 #define openxc_VehicleMessage_type_tag 1 #define openxc_VehicleMessage_raw_message_tag 2 #define openxc_VehicleMessage_translated_message_tag 3 @@ -71,12 +83,12 @@ typedef struct _openxc_VehicleMessage { /* Struct field encoding specification for nanopb */ extern const pb_field_t openxc_VehicleMessage_fields[4]; extern const pb_field_t openxc_RawMessage_fields[4]; -extern const pb_field_t openxc_TranslatedMessage_fields[8]; +extern const pb_field_t openxc_TranslatedMessage_fields[9]; /* Maximum encoded size of messages (where known) */ -#define openxc_VehicleMessage_size 362 +#define openxc_VehicleMessage_size 368 #define openxc_RawMessage_size 23 -#define openxc_TranslatedMessage_size 328 +#define openxc_TranslatedMessage_size 334 #ifdef __cplusplus } /* extern "C" */ -- cgit 1.2.3-korg