Add protobuf versioning (#954)
* Add protobuf versioning * Add protobuf version unit test * Change pb version providing * Remove redundant 'call'
This commit is contained in:
@@ -96,6 +96,8 @@ typedef struct _PB_Main {
|
||||
PB_System_GetDateTimeResponse system_get_datetime_response;
|
||||
PB_System_SetDateTimeRequest system_set_datetime_request;
|
||||
PB_System_PlayAudiovisualAlertRequest system_play_audiovisual_alert_request;
|
||||
PB_System_ProtobufVersionRequest system_protobuf_version_request;
|
||||
PB_System_ProtobufVersionResponse system_protobuf_version_response;
|
||||
} content;
|
||||
} PB_Main;
|
||||
|
||||
@@ -157,6 +159,8 @@ extern "C" {
|
||||
#define PB_Main_system_get_datetime_response_tag 36
|
||||
#define PB_Main_system_set_datetime_request_tag 37
|
||||
#define PB_Main_system_play_audiovisual_alert_request_tag 38
|
||||
#define PB_Main_system_protobuf_version_request_tag 39
|
||||
#define PB_Main_system_protobuf_version_response_tag 40
|
||||
|
||||
/* Struct field encoding specification for nanopb */
|
||||
#define PB_Empty_FIELDLIST(X, a) \
|
||||
@@ -207,7 +211,9 @@ X(a, STATIC, ONEOF, MSG_W_CB, (content,system_factory_reset_request,content
|
||||
X(a, STATIC, ONEOF, MSG_W_CB, (content,system_get_datetime_request,content.system_get_datetime_request), 35) \
|
||||
X(a, STATIC, ONEOF, MSG_W_CB, (content,system_get_datetime_response,content.system_get_datetime_response), 36) \
|
||||
X(a, STATIC, ONEOF, MSG_W_CB, (content,system_set_datetime_request,content.system_set_datetime_request), 37) \
|
||||
X(a, STATIC, ONEOF, MSG_W_CB, (content,system_play_audiovisual_alert_request,content.system_play_audiovisual_alert_request), 38)
|
||||
X(a, STATIC, ONEOF, MSG_W_CB, (content,system_play_audiovisual_alert_request,content.system_play_audiovisual_alert_request), 38) \
|
||||
X(a, STATIC, ONEOF, MSG_W_CB, (content,system_protobuf_version_request,content.system_protobuf_version_request), 39) \
|
||||
X(a, STATIC, ONEOF, MSG_W_CB, (content,system_protobuf_version_response,content.system_protobuf_version_response), 40)
|
||||
#define PB_Main_CALLBACK NULL
|
||||
#define PB_Main_DEFAULT NULL
|
||||
#define PB_Main_content_empty_MSGTYPE PB_Empty
|
||||
@@ -245,6 +251,8 @@ X(a, STATIC, ONEOF, MSG_W_CB, (content,system_play_audiovisual_alert_reques
|
||||
#define PB_Main_content_system_get_datetime_response_MSGTYPE PB_System_GetDateTimeResponse
|
||||
#define PB_Main_content_system_set_datetime_request_MSGTYPE PB_System_SetDateTimeRequest
|
||||
#define PB_Main_content_system_play_audiovisual_alert_request_MSGTYPE PB_System_PlayAudiovisualAlertRequest
|
||||
#define PB_Main_content_system_protobuf_version_request_MSGTYPE PB_System_ProtobufVersionRequest
|
||||
#define PB_Main_content_system_protobuf_version_response_MSGTYPE PB_System_ProtobufVersionResponse
|
||||
|
||||
extern const pb_msgdesc_t PB_Empty_msg;
|
||||
extern const pb_msgdesc_t PB_StopSession_msg;
|
||||
|
3
assets/compiled/protobuf_version.h
Normal file
3
assets/compiled/protobuf_version.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
#define PROTOBUF_MAJOR_VERSION 0
|
||||
#define PROTOBUF_MINOR_VERSION 1
|
@@ -39,5 +39,11 @@ PB_BIND(PB_System_DateTime, PB_System_DateTime, AUTO)
|
||||
PB_BIND(PB_System_PlayAudiovisualAlertRequest, PB_System_PlayAudiovisualAlertRequest, AUTO)
|
||||
|
||||
|
||||
PB_BIND(PB_System_ProtobufVersionRequest, PB_System_ProtobufVersionRequest, AUTO)
|
||||
|
||||
|
||||
PB_BIND(PB_System_ProtobufVersionResponse, PB_System_ProtobufVersionResponse, AUTO)
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -45,6 +45,10 @@ typedef struct _PB_System_PlayAudiovisualAlertRequest {
|
||||
char dummy_field;
|
||||
} PB_System_PlayAudiovisualAlertRequest;
|
||||
|
||||
typedef struct _PB_System_ProtobufVersionRequest {
|
||||
char dummy_field;
|
||||
} PB_System_ProtobufVersionRequest;
|
||||
|
||||
typedef struct _PB_System_DateTime {
|
||||
/* Time */
|
||||
uint8_t hour; /* *< Hour in 24H format: 0-23 */
|
||||
@@ -57,6 +61,11 @@ typedef struct _PB_System_DateTime {
|
||||
uint8_t weekday; /* *< Current weekday: 1-7 */
|
||||
} PB_System_DateTime;
|
||||
|
||||
typedef struct _PB_System_ProtobufVersionResponse {
|
||||
uint32_t major;
|
||||
uint32_t minor;
|
||||
} PB_System_ProtobufVersionResponse;
|
||||
|
||||
typedef struct _PB_System_RebootRequest {
|
||||
PB_System_RebootRequest_RebootMode mode;
|
||||
} PB_System_RebootRequest;
|
||||
@@ -94,6 +103,8 @@ extern "C" {
|
||||
#define PB_System_SetDateTimeRequest_init_default {false, PB_System_DateTime_init_default}
|
||||
#define PB_System_DateTime_init_default {0, 0, 0, 0, 0, 0, 0}
|
||||
#define PB_System_PlayAudiovisualAlertRequest_init_default {0}
|
||||
#define PB_System_ProtobufVersionRequest_init_default {0}
|
||||
#define PB_System_ProtobufVersionResponse_init_default {0, 0}
|
||||
#define PB_System_PingRequest_init_zero {NULL}
|
||||
#define PB_System_PingResponse_init_zero {NULL}
|
||||
#define PB_System_RebootRequest_init_zero {_PB_System_RebootRequest_RebootMode_MIN}
|
||||
@@ -105,6 +116,8 @@ extern "C" {
|
||||
#define PB_System_SetDateTimeRequest_init_zero {false, PB_System_DateTime_init_zero}
|
||||
#define PB_System_DateTime_init_zero {0, 0, 0, 0, 0, 0, 0}
|
||||
#define PB_System_PlayAudiovisualAlertRequest_init_zero {0}
|
||||
#define PB_System_ProtobufVersionRequest_init_zero {0}
|
||||
#define PB_System_ProtobufVersionResponse_init_zero {0, 0}
|
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */
|
||||
#define PB_System_DeviceInfoResponse_key_tag 1
|
||||
@@ -118,6 +131,8 @@ extern "C" {
|
||||
#define PB_System_DateTime_month_tag 5
|
||||
#define PB_System_DateTime_year_tag 6
|
||||
#define PB_System_DateTime_weekday_tag 7
|
||||
#define PB_System_ProtobufVersionResponse_major_tag 1
|
||||
#define PB_System_ProtobufVersionResponse_minor_tag 2
|
||||
#define PB_System_RebootRequest_mode_tag 1
|
||||
#define PB_System_GetDateTimeResponse_datetime_tag 1
|
||||
#define PB_System_SetDateTimeRequest_datetime_tag 1
|
||||
@@ -187,6 +202,17 @@ X(a, STATIC, SINGULAR, UINT32, weekday, 7)
|
||||
#define PB_System_PlayAudiovisualAlertRequest_CALLBACK NULL
|
||||
#define PB_System_PlayAudiovisualAlertRequest_DEFAULT NULL
|
||||
|
||||
#define PB_System_ProtobufVersionRequest_FIELDLIST(X, a) \
|
||||
|
||||
#define PB_System_ProtobufVersionRequest_CALLBACK NULL
|
||||
#define PB_System_ProtobufVersionRequest_DEFAULT NULL
|
||||
|
||||
#define PB_System_ProtobufVersionResponse_FIELDLIST(X, a) \
|
||||
X(a, STATIC, SINGULAR, UINT32, major, 1) \
|
||||
X(a, STATIC, SINGULAR, UINT32, minor, 2)
|
||||
#define PB_System_ProtobufVersionResponse_CALLBACK NULL
|
||||
#define PB_System_ProtobufVersionResponse_DEFAULT NULL
|
||||
|
||||
extern const pb_msgdesc_t PB_System_PingRequest_msg;
|
||||
extern const pb_msgdesc_t PB_System_PingResponse_msg;
|
||||
extern const pb_msgdesc_t PB_System_RebootRequest_msg;
|
||||
@@ -198,6 +224,8 @@ extern const pb_msgdesc_t PB_System_GetDateTimeResponse_msg;
|
||||
extern const pb_msgdesc_t PB_System_SetDateTimeRequest_msg;
|
||||
extern const pb_msgdesc_t PB_System_DateTime_msg;
|
||||
extern const pb_msgdesc_t PB_System_PlayAudiovisualAlertRequest_msg;
|
||||
extern const pb_msgdesc_t PB_System_ProtobufVersionRequest_msg;
|
||||
extern const pb_msgdesc_t PB_System_ProtobufVersionResponse_msg;
|
||||
|
||||
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||
#define PB_System_PingRequest_fields &PB_System_PingRequest_msg
|
||||
@@ -211,6 +239,8 @@ extern const pb_msgdesc_t PB_System_PlayAudiovisualAlertRequest_msg;
|
||||
#define PB_System_SetDateTimeRequest_fields &PB_System_SetDateTimeRequest_msg
|
||||
#define PB_System_DateTime_fields &PB_System_DateTime_msg
|
||||
#define PB_System_PlayAudiovisualAlertRequest_fields &PB_System_PlayAudiovisualAlertRequest_msg
|
||||
#define PB_System_ProtobufVersionRequest_fields &PB_System_ProtobufVersionRequest_msg
|
||||
#define PB_System_ProtobufVersionResponse_fields &PB_System_ProtobufVersionResponse_msg
|
||||
|
||||
/* Maximum encoded size of messages (where known) */
|
||||
/* PB_System_PingRequest_size depends on runtime parameters */
|
||||
@@ -222,6 +252,8 @@ extern const pb_msgdesc_t PB_System_PlayAudiovisualAlertRequest_msg;
|
||||
#define PB_System_GetDateTimeRequest_size 0
|
||||
#define PB_System_GetDateTimeResponse_size 24
|
||||
#define PB_System_PlayAudiovisualAlertRequest_size 0
|
||||
#define PB_System_ProtobufVersionRequest_size 0
|
||||
#define PB_System_ProtobufVersionResponse_size 12
|
||||
#define PB_System_RebootRequest_size 2
|
||||
#define PB_System_SetDateTimeRequest_size 24
|
||||
|
||||
|
Reference in New Issue
Block a user