diff --git a/proto_defs/gen_proto.sh b/proto_defs/gen_proto.sh index f6bafb59e3..31aad60572 100755 --- a/proto_defs/gen_proto.sh +++ b/proto_defs/gen_proto.sh @@ -27,9 +27,6 @@ source "$PROTO_DEFS_DIR/.venv/bin/activate" # Install dependencies pip3 install protobuf -# Compile common definitions -gen_proto "${SHARED_DIR}/common/ledger.proto" - # Compile control request definitions gen_proto "${SHARED_DIR}/control/extensions.proto" gen_proto "${SHARED_DIR}/control/common.proto" diff --git a/proto_defs/internal/ledger.proto b/proto_defs/internal/ledger.proto index 3e11d53820..de5cbd9a2b 100644 --- a/proto_defs/internal/ledger.proto +++ b/proto_defs/internal/ledger.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package particle.firmware; -import "common/ledger.proto"; +import "cloud/ledger.proto"; import "nanopb.proto"; /** @@ -10,8 +10,8 @@ import "nanopb.proto"; */ message LedgerInfo { string name = 1 [(nanopb).max_length = 32]; ///< Ledger name. - particle.ledger.LedgerScope scope = 2; ///< Ledger scope. - particle.ledger.SyncDirection sync_direction = 3; ///< Sync direction. + cloud.ledger.Scope scope = 2; ///< Ledger scope. + cloud.ledger.SyncDirection sync_direction = 3; ///< Sync direction. /** * Time the ledger was last updated, in milliseconds since the Unix epoch. * diff --git a/proto_defs/shared b/proto_defs/shared index 4371060823..ed36af512c 160000 --- a/proto_defs/shared +++ b/proto_defs/shared @@ -1 +1 @@ -Subproject commit 4371060823803c186223585d8164439352d041ba +Subproject commit ed36af512c65b52f9197773ef02011fd416af79d diff --git a/proto_defs/src/cloud/cloud.pb.c b/proto_defs/src/cloud/cloud.pb.c index f0e819c244..1b01c3430f 100644 --- a/proto_defs/src/cloud/cloud.pb.c +++ b/proto_defs/src/cloud/cloud.pb.c @@ -6,6 +6,12 @@ #error Regenerate this file with the current version of nanopb generator. #endif +PB_BIND(particle_cloud_Request, particle_cloud_Request, AUTO) + + +PB_BIND(particle_cloud_Response, particle_cloud_Response, AUTO) + + PB_BIND(particle_cloud_ServerMovedPermanentlyRequest, particle_cloud_ServerMovedPermanentlyRequest, AUTO) @@ -13,3 +19,5 @@ PB_BIND(particle_cloud_ServerMovedPermanentlyResponse, particle_cloud_ServerMove + + diff --git a/proto_defs/src/cloud/cloud.pb.h b/proto_defs/src/cloud/cloud.pb.h index c22a72813f..b635698aa8 100644 --- a/proto_defs/src/cloud/cloud.pb.h +++ b/proto_defs/src/cloud/cloud.pb.h @@ -4,11 +4,28 @@ #ifndef PB_PARTICLE_CLOUD_CLOUD_CLOUD_PB_H_INCLUDED #define PB_PARTICLE_CLOUD_CLOUD_CLOUD_PB_H_INCLUDED #include +#include "ledger.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif +/* Enum definitions */ +typedef enum _particle_cloud_Request_Type { + particle_cloud_Request_Type_INVALID = 0, + particle_cloud_Request_Type_LEDGER_GET_INFO = 1, + particle_cloud_Request_Type_LEDGER_SET_DATA = 2, + particle_cloud_Request_Type_LEDGER_GET_DATA = 3, + particle_cloud_Request_Type_LEDGER_SUBSCRIBE = 4, + particle_cloud_Request_Type_LEDGER_NOTIFY_UPDATE = 5 +} particle_cloud_Request_Type; + +typedef enum _particle_cloud_Response_Result { + particle_cloud_Response_Result_OK = 0, + particle_cloud_Response_Result_LEDGER_NOT_FOUND = 1, + particle_cloud_Response_Result_INVALID_SYNC_DIRECTION = 2 +} particle_cloud_Response_Result; + /* Struct definitions */ /* * A response for a ServerMovedPermanentlyRequest. */ @@ -16,6 +33,42 @@ typedef struct _particle_cloud_ServerMovedPermanentlyResponse { char dummy_field; } particle_cloud_ServerMovedPermanentlyResponse; +/* * + Request message. */ +typedef struct _particle_cloud_Request { + particle_cloud_Request_Type type; /* /< Request type. */ + pb_size_t which_data; + union { + particle_cloud_ledger_GetInfoRequest ledger_get_info; + particle_cloud_ledger_SetDataRequest ledger_set_data; + particle_cloud_ledger_GetDataRequest ledger_get_data; + particle_cloud_ledger_SubscribeRequest ledger_subscribe; + particle_cloud_ledger_NotifyUpdateRequest ledger_notify_update; + } data; +} particle_cloud_Request; + +/* * + Response message. */ +typedef struct _particle_cloud_Response { + /* * + Result code. + + Possible result codes are defined by the `Result` enum. If the response is sent by the device, + the result code may be negative in which case it indicates a Device OS system error: + + https://github.com/particle-iot/device-os/blob/develop/services/inc/system_error.h */ + int32_t result; + pb_callback_t message; /* /< Diagnostic message. */ + pb_size_t which_data; + union { + particle_cloud_ledger_GetInfoResponse ledger_get_info; + particle_cloud_ledger_SetDataResponse ledger_set_data; + particle_cloud_ledger_GetDataResponse ledger_get_data; + particle_cloud_ledger_SubscribeResponse ledger_subscribe; + particle_cloud_ledger_NotifyUpdateResponse ledger_notify_update; + } data; +} particle_cloud_Response; + /* * A request sent to the device to notify it that it must disconnect from the current server and use another server for further connections to the Cloud. */ @@ -38,23 +91,81 @@ typedef struct _particle_cloud_ServerMovedPermanentlyRequest { } particle_cloud_ServerMovedPermanentlyRequest; +/* Helper constants for enums */ +#define _particle_cloud_Request_Type_MIN particle_cloud_Request_Type_INVALID +#define _particle_cloud_Request_Type_MAX particle_cloud_Request_Type_LEDGER_NOTIFY_UPDATE +#define _particle_cloud_Request_Type_ARRAYSIZE ((particle_cloud_Request_Type)(particle_cloud_Request_Type_LEDGER_NOTIFY_UPDATE+1)) + +#define _particle_cloud_Response_Result_MIN particle_cloud_Response_Result_OK +#define _particle_cloud_Response_Result_MAX particle_cloud_Response_Result_INVALID_SYNC_DIRECTION +#define _particle_cloud_Response_Result_ARRAYSIZE ((particle_cloud_Response_Result)(particle_cloud_Response_Result_INVALID_SYNC_DIRECTION+1)) + + #ifdef __cplusplus extern "C" { #endif /* Initializer values for message structs */ +#define particle_cloud_Request_init_default {_particle_cloud_Request_Type_MIN, 0, {particle_cloud_ledger_GetInfoRequest_init_default}} +#define particle_cloud_Response_init_default {0, {{NULL}, NULL}, 0, {particle_cloud_ledger_GetInfoResponse_init_default}} #define particle_cloud_ServerMovedPermanentlyRequest_init_default {{{NULL}, NULL}, 0, {{NULL}, NULL}, {{NULL}, NULL}} #define particle_cloud_ServerMovedPermanentlyResponse_init_default {0} +#define particle_cloud_Request_init_zero {_particle_cloud_Request_Type_MIN, 0, {particle_cloud_ledger_GetInfoRequest_init_zero}} +#define particle_cloud_Response_init_zero {0, {{NULL}, NULL}, 0, {particle_cloud_ledger_GetInfoResponse_init_zero}} #define particle_cloud_ServerMovedPermanentlyRequest_init_zero {{{NULL}, NULL}, 0, {{NULL}, NULL}, {{NULL}, NULL}} #define particle_cloud_ServerMovedPermanentlyResponse_init_zero {0} /* Field tags (for use in manual encoding/decoding) */ +#define particle_cloud_Request_type_tag 1 +#define particle_cloud_Request_ledger_get_info_tag 2 +#define particle_cloud_Request_ledger_set_data_tag 3 +#define particle_cloud_Request_ledger_get_data_tag 4 +#define particle_cloud_Request_ledger_subscribe_tag 5 +#define particle_cloud_Request_ledger_notify_update_tag 6 +#define particle_cloud_Response_result_tag 1 +#define particle_cloud_Response_message_tag 2 +#define particle_cloud_Response_ledger_get_info_tag 3 +#define particle_cloud_Response_ledger_set_data_tag 4 +#define particle_cloud_Response_ledger_get_data_tag 5 +#define particle_cloud_Response_ledger_subscribe_tag 6 +#define particle_cloud_Response_ledger_notify_update_tag 7 #define particle_cloud_ServerMovedPermanentlyRequest_server_addr_tag 1 #define particle_cloud_ServerMovedPermanentlyRequest_server_port_tag 2 #define particle_cloud_ServerMovedPermanentlyRequest_server_pub_key_tag 3 #define particle_cloud_ServerMovedPermanentlyRequest_sign_tag 4 /* Struct field encoding specification for nanopb */ +#define particle_cloud_Request_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UENUM, type, 1) \ +X(a, STATIC, ONEOF, MESSAGE, (data,ledger_get_info,data.ledger_get_info), 2) \ +X(a, STATIC, ONEOF, MESSAGE, (data,ledger_set_data,data.ledger_set_data), 3) \ +X(a, STATIC, ONEOF, MESSAGE, (data,ledger_get_data,data.ledger_get_data), 4) \ +X(a, STATIC, ONEOF, MESSAGE, (data,ledger_subscribe,data.ledger_subscribe), 5) \ +X(a, STATIC, ONEOF, MESSAGE, (data,ledger_notify_update,data.ledger_notify_update), 6) +#define particle_cloud_Request_CALLBACK NULL +#define particle_cloud_Request_DEFAULT NULL +#define particle_cloud_Request_data_ledger_get_info_MSGTYPE particle_cloud_ledger_GetInfoRequest +#define particle_cloud_Request_data_ledger_set_data_MSGTYPE particle_cloud_ledger_SetDataRequest +#define particle_cloud_Request_data_ledger_get_data_MSGTYPE particle_cloud_ledger_GetDataRequest +#define particle_cloud_Request_data_ledger_subscribe_MSGTYPE particle_cloud_ledger_SubscribeRequest +#define particle_cloud_Request_data_ledger_notify_update_MSGTYPE particle_cloud_ledger_NotifyUpdateRequest + +#define particle_cloud_Response_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, SINT32, result, 1) \ +X(a, CALLBACK, OPTIONAL, STRING, message, 2) \ +X(a, STATIC, ONEOF, MESSAGE, (data,ledger_get_info,data.ledger_get_info), 3) \ +X(a, STATIC, ONEOF, MESSAGE, (data,ledger_set_data,data.ledger_set_data), 4) \ +X(a, STATIC, ONEOF, MESSAGE, (data,ledger_get_data,data.ledger_get_data), 5) \ +X(a, STATIC, ONEOF, MESSAGE, (data,ledger_subscribe,data.ledger_subscribe), 6) \ +X(a, STATIC, ONEOF, MESSAGE, (data,ledger_notify_update,data.ledger_notify_update), 7) +#define particle_cloud_Response_CALLBACK pb_default_field_callback +#define particle_cloud_Response_DEFAULT NULL +#define particle_cloud_Response_data_ledger_get_info_MSGTYPE particle_cloud_ledger_GetInfoResponse +#define particle_cloud_Response_data_ledger_set_data_MSGTYPE particle_cloud_ledger_SetDataResponse +#define particle_cloud_Response_data_ledger_get_data_MSGTYPE particle_cloud_ledger_GetDataResponse +#define particle_cloud_Response_data_ledger_subscribe_MSGTYPE particle_cloud_ledger_SubscribeResponse +#define particle_cloud_Response_data_ledger_notify_update_MSGTYPE particle_cloud_ledger_NotifyUpdateResponse + #define particle_cloud_ServerMovedPermanentlyRequest_FIELDLIST(X, a) \ X(a, CALLBACK, SINGULAR, STRING, server_addr, 1) \ X(a, STATIC, SINGULAR, UINT32, server_port, 2) \ @@ -68,15 +179,24 @@ X(a, CALLBACK, SINGULAR, BYTES, sign, 4) #define particle_cloud_ServerMovedPermanentlyResponse_CALLBACK NULL #define particle_cloud_ServerMovedPermanentlyResponse_DEFAULT NULL +extern const pb_msgdesc_t particle_cloud_Request_msg; +extern const pb_msgdesc_t particle_cloud_Response_msg; extern const pb_msgdesc_t particle_cloud_ServerMovedPermanentlyRequest_msg; extern const pb_msgdesc_t particle_cloud_ServerMovedPermanentlyResponse_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ +#define particle_cloud_Request_fields &particle_cloud_Request_msg +#define particle_cloud_Response_fields &particle_cloud_Response_msg #define particle_cloud_ServerMovedPermanentlyRequest_fields &particle_cloud_ServerMovedPermanentlyRequest_msg #define particle_cloud_ServerMovedPermanentlyResponse_fields &particle_cloud_ServerMovedPermanentlyResponse_msg /* Maximum encoded size of messages (where known) */ +/* particle_cloud_Response_size depends on runtime parameters */ /* particle_cloud_ServerMovedPermanentlyRequest_size depends on runtime parameters */ +#if defined(particle_cloud_ledger_GetInfoRequest_size) && defined(particle_cloud_ledger_SetDataRequest_size) && defined(particle_cloud_ledger_SubscribeRequest_size) +#define particle_cloud_Request_size (2 + sizeof(union particle_cloud_Request_data_size_union)) +union particle_cloud_Request_data_size_union {char f2[(6 + particle_cloud_ledger_GetInfoRequest_size)]; char f3[(6 + particle_cloud_ledger_SetDataRequest_size)]; char f5[(6 + particle_cloud_ledger_SubscribeRequest_size)]; char f0[45];}; +#endif #define particle_cloud_ServerMovedPermanentlyResponse_size 0 #ifdef __cplusplus diff --git a/proto_defs/src/cloud/ledger.pb.c b/proto_defs/src/cloud/ledger.pb.c index 57488b466f..bf38eda05a 100644 --- a/proto_defs/src/cloud/ledger.pb.c +++ b/proto_defs/src/cloud/ledger.pb.c @@ -6,59 +6,40 @@ #error Regenerate this file with the current version of nanopb generator. #endif -PB_BIND(particle_cloud_LedgerRequest, particle_cloud_LedgerRequest, AUTO) +PB_BIND(particle_cloud_ledger_GetInfoRequest, particle_cloud_ledger_GetInfoRequest, AUTO) -PB_BIND(particle_cloud_LedgerRequest_ListLedgers, particle_cloud_LedgerRequest_ListLedgers, AUTO) +PB_BIND(particle_cloud_ledger_GetInfoResponse, particle_cloud_ledger_GetInfoResponse, AUTO) -PB_BIND(particle_cloud_LedgerRequest_GetPage, particle_cloud_LedgerRequest_GetPage, AUTO) +PB_BIND(particle_cloud_ledger_GetInfoResponse_Ledger, particle_cloud_ledger_GetInfoResponse_Ledger, AUTO) -PB_BIND(particle_cloud_LedgerRequest_SyncPage, particle_cloud_LedgerRequest_SyncPage, AUTO) +PB_BIND(particle_cloud_ledger_SetDataRequest, particle_cloud_ledger_SetDataRequest, AUTO) -PB_BIND(particle_cloud_LedgerRequest_Subscribe, particle_cloud_LedgerRequest_Subscribe, AUTO) +PB_BIND(particle_cloud_ledger_SetDataResponse, particle_cloud_ledger_SetDataResponse, AUTO) -PB_BIND(particle_cloud_LedgerRequest_Subscribe_LedgerPages, particle_cloud_LedgerRequest_Subscribe_LedgerPages, AUTO) +PB_BIND(particle_cloud_ledger_GetDataRequest, particle_cloud_ledger_GetDataRequest, AUTO) -PB_BIND(particle_cloud_LedgerRequest_Unsubscribe, particle_cloud_LedgerRequest_Unsubscribe, AUTO) +PB_BIND(particle_cloud_ledger_GetDataResponse, particle_cloud_ledger_GetDataResponse, AUTO) -PB_BIND(particle_cloud_LedgerRequest_Unsubscribe_LedgerPages, particle_cloud_LedgerRequest_Unsubscribe_LedgerPages, AUTO) +PB_BIND(particle_cloud_ledger_SubscribeRequest, particle_cloud_ledger_SubscribeRequest, AUTO) -PB_BIND(particle_cloud_LedgerRequest_NotifyPageChanged, particle_cloud_LedgerRequest_NotifyPageChanged, AUTO) +PB_BIND(particle_cloud_ledger_SubscribeResponse, particle_cloud_ledger_SubscribeResponse, AUTO) -PB_BIND(particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages, particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages, AUTO) +PB_BIND(particle_cloud_ledger_SubscribeResponse_Ledger, particle_cloud_ledger_SubscribeResponse_Ledger, AUTO) -PB_BIND(particle_cloud_LedgerResponse, particle_cloud_LedgerResponse, AUTO) +PB_BIND(particle_cloud_ledger_NotifyUpdateRequest, particle_cloud_ledger_NotifyUpdateRequest, AUTO) -PB_BIND(particle_cloud_LedgerResponse_ListLedgers, particle_cloud_LedgerResponse_ListLedgers, AUTO) - - -PB_BIND(particle_cloud_LedgerResponse_ListLedgers_Ledger, particle_cloud_LedgerResponse_ListLedgers_Ledger, AUTO) - - -PB_BIND(particle_cloud_LedgerResponse_GetPage, particle_cloud_LedgerResponse_GetPage, AUTO) - - -PB_BIND(particle_cloud_LedgerResponse_SyncPage, particle_cloud_LedgerResponse_SyncPage, AUTO) - - -PB_BIND(particle_cloud_LedgerResponse_Subscribe, particle_cloud_LedgerResponse_Subscribe, AUTO) - - -PB_BIND(particle_cloud_LedgerResponse_Unsubscribe, particle_cloud_LedgerResponse_Unsubscribe, AUTO) - - -PB_BIND(particle_cloud_LedgerResponse_NotifyPageChanged, particle_cloud_LedgerResponse_NotifyPageChanged, AUTO) - +PB_BIND(particle_cloud_ledger_NotifyUpdateResponse, particle_cloud_ledger_NotifyUpdateResponse, AUTO) diff --git a/proto_defs/src/cloud/ledger.pb.h b/proto_defs/src/cloud/ledger.pb.h index 91eebfd913..15ed40dd3e 100644 --- a/proto_defs/src/cloud/ledger.pb.h +++ b/proto_defs/src/cloud/ledger.pb.h @@ -1,168 +1,154 @@ /* Automatically generated nanopb header */ /* Generated by nanopb-0.4.5 */ -#ifndef PB_PARTICLE_CLOUD_CLOUD_LEDGER_PB_H_INCLUDED -#define PB_PARTICLE_CLOUD_CLOUD_LEDGER_PB_H_INCLUDED +#ifndef PB_PARTICLE_CLOUD_LEDGER_CLOUD_LEDGER_PB_H_INCLUDED +#define PB_PARTICLE_CLOUD_LEDGER_CLOUD_LEDGER_PB_H_INCLUDED #include -#include "common/ledger.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. #endif /* Enum definitions */ -typedef enum _particle_cloud_LedgerRequest_Type { - particle_cloud_LedgerRequest_Type_INVALID_TYPE = 0, - particle_cloud_LedgerRequest_Type_LIST_LEDGERS = 1, - particle_cloud_LedgerRequest_Type_GET_PAGE = 2, - particle_cloud_LedgerRequest_Type_SYNC_PAGE = 3, - particle_cloud_LedgerRequest_Type_SUBSCRIBE = 4, - particle_cloud_LedgerRequest_Type_UNSUBSCRIBE = 5, - particle_cloud_LedgerRequest_Type_NOTIFY_PAGE_CHANGED = 6 -} particle_cloud_LedgerRequest_Type; - -typedef enum _particle_cloud_LedgerRequest_SyncPage_Strategy { - particle_cloud_LedgerRequest_SyncPage_Strategy_INVALID_STRATEGY = 0, - particle_cloud_LedgerRequest_SyncPage_Strategy_PREFER_DEVICE_CHANGES = 1, - particle_cloud_LedgerRequest_SyncPage_Strategy_PREFER_SERVER_CHANGES = 2 -} particle_cloud_LedgerRequest_SyncPage_Strategy; - -typedef enum _particle_cloud_LedgerResponse_Result { - particle_cloud_LedgerResponse_Result_OK = 0, - particle_cloud_LedgerResponse_Result_LEDGER_NOT_FOUND = 1 -} particle_cloud_LedgerResponse_Result; +/* * + Ledger scope. */ +typedef enum _particle_cloud_ledger_Scope { + particle_cloud_ledger_Scope_SCOPE_UNKNOWN = 0, /* /< Unknown scope. */ + particle_cloud_ledger_Scope_SCOPE_DEVICE = 1, /* /< Device scope. */ + particle_cloud_ledger_Scope_SCOPE_PRODUCT = 2, /* /< Product scope. */ + particle_cloud_ledger_Scope_SCOPE_OWNER = 3 /* /< Owner scope. */ +} particle_cloud_ledger_Scope; + +/* * + Sync direction. */ +typedef enum _particle_cloud_ledger_SyncDirection { + particle_cloud_ledger_SyncDirection_SYNC_DIRECTION_UNKNOWN = 0, /* /< Unknown direction. */ + particle_cloud_ledger_SyncDirection_SYNC_DIRECTION_DEVICE_TO_CLOUD = 1, /* /< Device to cloud. */ + particle_cloud_ledger_SyncDirection_SYNC_DIRECTION_CLOUD_TO_DEVICE = 2 /* /< Cloud to device. */ +} particle_cloud_ledger_SyncDirection; /* Struct definitions */ /* * - Ledger response. */ -typedef struct _particle_cloud_LedgerRequest_ListLedgers { - pb_callback_t scopes; /* /< Result code. */ -} particle_cloud_LedgerRequest_ListLedgers; + Get the ledger info. + + This request is sent by the device. */ +typedef struct _particle_cloud_ledger_GetInfoRequest { + /* * + Names of the ledgers for which to request the info. */ + pb_callback_t ledgers; +} particle_cloud_ledger_GetInfoRequest; -typedef struct _particle_cloud_LedgerRequest_NotifyPageChanged { - pb_callback_t ledger_pages; -} particle_cloud_LedgerRequest_NotifyPageChanged; +/* * + Response for `GetInfoRequest`. */ +typedef struct _particle_cloud_ledger_GetInfoResponse { + /* * + Ledger info. -typedef struct _particle_cloud_LedgerResponse_ListLedgers { + If the request contained an unknown ledger name or the requested ledger is inaccessible by the + device, the info about the respective ledger would be omitted. */ pb_callback_t ledgers; -} particle_cloud_LedgerResponse_ListLedgers; +} particle_cloud_ledger_GetInfoResponse; -typedef struct _particle_cloud_LedgerResponse_NotifyPageChanged { +typedef struct _particle_cloud_ledger_NotifyUpdateResponse { char dummy_field; -} particle_cloud_LedgerResponse_NotifyPageChanged; +} particle_cloud_ledger_NotifyUpdateResponse; -typedef struct _particle_cloud_LedgerResponse_Subscribe { - char dummy_field; -} particle_cloud_LedgerResponse_Subscribe; +/* * + Get the contents of a remote cloud-to-device ledger. -typedef struct _particle_cloud_LedgerResponse_Unsubscribe { + This request is sent by the device. */ +typedef struct _particle_cloud_ledger_SetDataResponse { char dummy_field; -} particle_cloud_LedgerResponse_Unsubscribe; - -typedef struct _particle_cloud_LedgerRequest_GetPage { - pb_callback_t ledger_name; - particle_ledger_LedgerScope scope; - pb_callback_t page_name; -} particle_cloud_LedgerRequest_GetPage; - -typedef struct _particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages { - pb_callback_t ledger_name; - particle_ledger_LedgerScope scope; - pb_callback_t page_names; -} particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages; - -typedef struct _particle_cloud_LedgerRequest_Subscribe { - pb_callback_t ledger_pages; - bool resubscribe; -} particle_cloud_LedgerRequest_Subscribe; - -typedef struct _particle_cloud_LedgerRequest_Subscribe_LedgerPages { - pb_callback_t ledger_name; - particle_ledger_LedgerScope scope; - pb_callback_t page_names; -} particle_cloud_LedgerRequest_Subscribe_LedgerPages; - -typedef struct _particle_cloud_LedgerRequest_SyncPage { - pb_callback_t ledger_name; - particle_ledger_LedgerScope scope; - pb_callback_t page_name; - bool has_updated_at; - uint64_t updated_at; - bool has_strategy; - particle_cloud_LedgerRequest_SyncPage_Strategy strategy; - pb_callback_t data; -} particle_cloud_LedgerRequest_SyncPage; +} particle_cloud_ledger_SetDataResponse; + +/* * + Response for `SubscribeRequest`. */ +typedef struct _particle_cloud_ledger_SubscribeRequest { + /* * + Ledger info. */ + pb_callback_t ledgers; +} particle_cloud_ledger_SubscribeRequest; + +/* * + Notify the device that a cloud-to-device ledger was updated. + + This request is sent by the server. */ +typedef struct _particle_cloud_ledger_SubscribeResponse { + pb_callback_t ledgers; /* /< Ledger name. */ +} particle_cloud_ledger_SubscribeResponse; -typedef struct _particle_cloud_LedgerRequest_Unsubscribe { - pb_callback_t ledger_pages; - bool unsubscribe_all; -} particle_cloud_LedgerRequest_Unsubscribe; +/* * + Response for `GetDataRequest`. */ +typedef struct _particle_cloud_ledger_GetDataRequest { + /* * + Contents of the ledger. + + If not specified, the device has the most recent version of the ledger data. */ + char name[33]; + /* * + Time the ledger was last updated, in milliseconds since the Unix epoch. */ + bool has_last_updated; + uint64_t last_updated; +} particle_cloud_ledger_GetDataRequest; + +/* * + Subscribe to notifications about updates made to one or multiple cloud-to-device ledgers. -typedef struct _particle_cloud_LedgerRequest_Unsubscribe_LedgerPages { - pb_callback_t ledger_name; - particle_ledger_LedgerScope scope; - pb_callback_t page_names; -} particle_cloud_LedgerRequest_Unsubscribe_LedgerPages; + Subscriptions listed in this request will replace all the subscriptions currently registered on + the server. -typedef struct _particle_cloud_LedgerResponse_GetPage { + This request is sent by the device. */ +typedef struct _particle_cloud_ledger_GetDataResponse { + /* * + Names of the ledgers to subscribe to. */ pb_callback_t data; - bool has_updated_at; - uint64_t updated_at; -} particle_cloud_LedgerResponse_GetPage; + uint64_t last_updated; +} particle_cloud_ledger_GetDataResponse; + +/* * + Update the contents of a remote device-to-cloud ledger. + + This request is sent by the device. */ +typedef struct _particle_cloud_ledger_GetInfoResponse_Ledger { + char name[33]; /* /< Ledger name. */ + particle_cloud_ledger_Scope scope; /* /< Contents of the ledger. */ + /* * + Time the ledger was last updated, in milliseconds since the Unix epoch. -typedef struct _particle_cloud_LedgerResponse_ListLedgers_Ledger { - pb_callback_t name; - particle_ledger_LedgerScope scope; -} particle_cloud_LedgerResponse_ListLedgers_Ledger; + If 0, the time is unknown. */ + particle_cloud_ledger_SyncDirection sync_direction; + uint64_t last_updated; +} particle_cloud_ledger_GetInfoResponse_Ledger; -typedef struct _particle_cloud_LedgerResponse_SyncPage { +typedef struct _particle_cloud_ledger_NotifyUpdateRequest { + char name[33]; + uint64_t last_updated; +} particle_cloud_ledger_NotifyUpdateRequest; + +/* * + Response for `SetDataRequest`. */ +typedef struct _particle_cloud_ledger_SetDataRequest { + char name[33]; pb_callback_t data; - uint64_t updated_at; -} particle_cloud_LedgerResponse_SyncPage; + uint64_t last_updated; +} particle_cloud_ledger_SetDataRequest; /* * - Ledger request. */ -typedef struct _particle_cloud_LedgerRequest { - bool has_type; - particle_cloud_LedgerRequest_Type type; /* /< Request type. Must be set if none of the request-specific fields are set. */ - pb_size_t which_request; - union { - particle_cloud_LedgerRequest_ListLedgers list_ledgers; - particle_cloud_LedgerRequest_GetPage get_page; - particle_cloud_LedgerRequest_SyncPage sync_page; - particle_cloud_LedgerRequest_Subscribe subscribe; - particle_cloud_LedgerRequest_Unsubscribe unsubscribe; - particle_cloud_LedgerRequest_NotifyPageChanged notify_page_changed; - } request; -} particle_cloud_LedgerRequest; - -typedef struct _particle_cloud_LedgerResponse { - particle_cloud_LedgerResponse_Result result; - pb_callback_t error_message; - pb_size_t which_response; - union { - particle_cloud_LedgerResponse_ListLedgers list_ledgers; - particle_cloud_LedgerResponse_GetPage get_page; - particle_cloud_LedgerResponse_SyncPage sync_page; - particle_cloud_LedgerResponse_Subscribe subscribe; - particle_cloud_LedgerResponse_Unsubscribe unsubscribe; - particle_cloud_LedgerResponse_NotifyPageChanged notify_page_changed; - } response; -} particle_cloud_LedgerResponse; + Response for `NotifyUpdateRequest`. */ +typedef struct _particle_cloud_ledger_SubscribeResponse_Ledger { + char name[33]; + uint64_t last_updated; +} particle_cloud_ledger_SubscribeResponse_Ledger; /* Helper constants for enums */ -#define _particle_cloud_LedgerRequest_Type_MIN particle_cloud_LedgerRequest_Type_INVALID_TYPE -#define _particle_cloud_LedgerRequest_Type_MAX particle_cloud_LedgerRequest_Type_NOTIFY_PAGE_CHANGED -#define _particle_cloud_LedgerRequest_Type_ARRAYSIZE ((particle_cloud_LedgerRequest_Type)(particle_cloud_LedgerRequest_Type_NOTIFY_PAGE_CHANGED+1)) +#define _particle_cloud_ledger_Scope_MIN particle_cloud_ledger_Scope_SCOPE_UNKNOWN +#define _particle_cloud_ledger_Scope_MAX particle_cloud_ledger_Scope_SCOPE_OWNER +#define _particle_cloud_ledger_Scope_ARRAYSIZE ((particle_cloud_ledger_Scope)(particle_cloud_ledger_Scope_SCOPE_OWNER+1)) -#define _particle_cloud_LedgerRequest_SyncPage_Strategy_MIN particle_cloud_LedgerRequest_SyncPage_Strategy_INVALID_STRATEGY -#define _particle_cloud_LedgerRequest_SyncPage_Strategy_MAX particle_cloud_LedgerRequest_SyncPage_Strategy_PREFER_SERVER_CHANGES -#define _particle_cloud_LedgerRequest_SyncPage_Strategy_ARRAYSIZE ((particle_cloud_LedgerRequest_SyncPage_Strategy)(particle_cloud_LedgerRequest_SyncPage_Strategy_PREFER_SERVER_CHANGES+1)) - -#define _particle_cloud_LedgerResponse_Result_MIN particle_cloud_LedgerResponse_Result_OK -#define _particle_cloud_LedgerResponse_Result_MAX particle_cloud_LedgerResponse_Result_LEDGER_NOT_FOUND -#define _particle_cloud_LedgerResponse_Result_ARRAYSIZE ((particle_cloud_LedgerResponse_Result)(particle_cloud_LedgerResponse_Result_LEDGER_NOT_FOUND+1)) +#define _particle_cloud_ledger_SyncDirection_MIN particle_cloud_ledger_SyncDirection_SYNC_DIRECTION_UNKNOWN +#define _particle_cloud_ledger_SyncDirection_MAX particle_cloud_ledger_SyncDirection_SYNC_DIRECTION_CLOUD_TO_DEVICE +#define _particle_cloud_ledger_SyncDirection_ARRAYSIZE ((particle_cloud_ledger_SyncDirection)(particle_cloud_ledger_SyncDirection_SYNC_DIRECTION_CLOUD_TO_DEVICE+1)) #ifdef __cplusplus @@ -170,287 +156,164 @@ extern "C" { #endif /* Initializer values for message structs */ -#define particle_cloud_LedgerRequest_init_default {false, _particle_cloud_LedgerRequest_Type_MIN, 0, {particle_cloud_LedgerRequest_ListLedgers_init_default}} -#define particle_cloud_LedgerRequest_ListLedgers_init_default {{{NULL}, NULL}} -#define particle_cloud_LedgerRequest_GetPage_init_default {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN, {{NULL}, NULL}} -#define particle_cloud_LedgerRequest_SyncPage_init_default {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN, {{NULL}, NULL}, false, 0, false, _particle_cloud_LedgerRequest_SyncPage_Strategy_MIN, {{NULL}, NULL}} -#define particle_cloud_LedgerRequest_Subscribe_init_default {{{NULL}, NULL}, 0} -#define particle_cloud_LedgerRequest_Subscribe_LedgerPages_init_default {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN, {{NULL}, NULL}} -#define particle_cloud_LedgerRequest_Unsubscribe_init_default {{{NULL}, NULL}, 0} -#define particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_init_default {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN, {{NULL}, NULL}} -#define particle_cloud_LedgerRequest_NotifyPageChanged_init_default {{{NULL}, NULL}} -#define particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_init_default {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN, {{NULL}, NULL}} -#define particle_cloud_LedgerResponse_init_default {_particle_cloud_LedgerResponse_Result_MIN, {{NULL}, NULL}, 0, {particle_cloud_LedgerResponse_ListLedgers_init_default}} -#define particle_cloud_LedgerResponse_ListLedgers_init_default {{{NULL}, NULL}} -#define particle_cloud_LedgerResponse_ListLedgers_Ledger_init_default {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN} -#define particle_cloud_LedgerResponse_GetPage_init_default {{{NULL}, NULL}, false, 0} -#define particle_cloud_LedgerResponse_SyncPage_init_default {{{NULL}, NULL}, 0} -#define particle_cloud_LedgerResponse_Subscribe_init_default {0} -#define particle_cloud_LedgerResponse_Unsubscribe_init_default {0} -#define particle_cloud_LedgerResponse_NotifyPageChanged_init_default {0} -#define particle_cloud_LedgerRequest_init_zero {false, _particle_cloud_LedgerRequest_Type_MIN, 0, {particle_cloud_LedgerRequest_ListLedgers_init_zero}} -#define particle_cloud_LedgerRequest_ListLedgers_init_zero {{{NULL}, NULL}} -#define particle_cloud_LedgerRequest_GetPage_init_zero {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN, {{NULL}, NULL}} -#define particle_cloud_LedgerRequest_SyncPage_init_zero {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN, {{NULL}, NULL}, false, 0, false, _particle_cloud_LedgerRequest_SyncPage_Strategy_MIN, {{NULL}, NULL}} -#define particle_cloud_LedgerRequest_Subscribe_init_zero {{{NULL}, NULL}, 0} -#define particle_cloud_LedgerRequest_Subscribe_LedgerPages_init_zero {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN, {{NULL}, NULL}} -#define particle_cloud_LedgerRequest_Unsubscribe_init_zero {{{NULL}, NULL}, 0} -#define particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_init_zero {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN, {{NULL}, NULL}} -#define particle_cloud_LedgerRequest_NotifyPageChanged_init_zero {{{NULL}, NULL}} -#define particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_init_zero {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN, {{NULL}, NULL}} -#define particle_cloud_LedgerResponse_init_zero {_particle_cloud_LedgerResponse_Result_MIN, {{NULL}, NULL}, 0, {particle_cloud_LedgerResponse_ListLedgers_init_zero}} -#define particle_cloud_LedgerResponse_ListLedgers_init_zero {{{NULL}, NULL}} -#define particle_cloud_LedgerResponse_ListLedgers_Ledger_init_zero {{{NULL}, NULL}, _particle_ledger_LedgerScope_MIN} -#define particle_cloud_LedgerResponse_GetPage_init_zero {{{NULL}, NULL}, false, 0} -#define particle_cloud_LedgerResponse_SyncPage_init_zero {{{NULL}, NULL}, 0} -#define particle_cloud_LedgerResponse_Subscribe_init_zero {0} -#define particle_cloud_LedgerResponse_Unsubscribe_init_zero {0} -#define particle_cloud_LedgerResponse_NotifyPageChanged_init_zero {0} +#define particle_cloud_ledger_GetInfoRequest_init_default {{{NULL}, NULL}} +#define particle_cloud_ledger_GetInfoResponse_init_default {{{NULL}, NULL}} +#define particle_cloud_ledger_GetInfoResponse_Ledger_init_default {"", _particle_cloud_ledger_Scope_MIN, _particle_cloud_ledger_SyncDirection_MIN, 0} +#define particle_cloud_ledger_SetDataRequest_init_default {"", {{NULL}, NULL}, 0} +#define particle_cloud_ledger_SetDataResponse_init_default {0} +#define particle_cloud_ledger_GetDataRequest_init_default {"", false, 0} +#define particle_cloud_ledger_GetDataResponse_init_default {{{NULL}, NULL}, 0} +#define particle_cloud_ledger_SubscribeRequest_init_default {{{NULL}, NULL}} +#define particle_cloud_ledger_SubscribeResponse_init_default {{{NULL}, NULL}} +#define particle_cloud_ledger_SubscribeResponse_Ledger_init_default {"", 0} +#define particle_cloud_ledger_NotifyUpdateRequest_init_default {"", 0} +#define particle_cloud_ledger_NotifyUpdateResponse_init_default {0} +#define particle_cloud_ledger_GetInfoRequest_init_zero {{{NULL}, NULL}} +#define particle_cloud_ledger_GetInfoResponse_init_zero {{{NULL}, NULL}} +#define particle_cloud_ledger_GetInfoResponse_Ledger_init_zero {"", _particle_cloud_ledger_Scope_MIN, _particle_cloud_ledger_SyncDirection_MIN, 0} +#define particle_cloud_ledger_SetDataRequest_init_zero {"", {{NULL}, NULL}, 0} +#define particle_cloud_ledger_SetDataResponse_init_zero {0} +#define particle_cloud_ledger_GetDataRequest_init_zero {"", false, 0} +#define particle_cloud_ledger_GetDataResponse_init_zero {{{NULL}, NULL}, 0} +#define particle_cloud_ledger_SubscribeRequest_init_zero {{{NULL}, NULL}} +#define particle_cloud_ledger_SubscribeResponse_init_zero {{{NULL}, NULL}} +#define particle_cloud_ledger_SubscribeResponse_Ledger_init_zero {"", 0} +#define particle_cloud_ledger_NotifyUpdateRequest_init_zero {"", 0} +#define particle_cloud_ledger_NotifyUpdateResponse_init_zero {0} /* Field tags (for use in manual encoding/decoding) */ -#define particle_cloud_LedgerRequest_ListLedgers_scopes_tag 1 -#define particle_cloud_LedgerRequest_NotifyPageChanged_ledger_pages_tag 1 -#define particle_cloud_LedgerResponse_ListLedgers_ledgers_tag 1 -#define particle_cloud_LedgerRequest_GetPage_ledger_name_tag 1 -#define particle_cloud_LedgerRequest_GetPage_scope_tag 2 -#define particle_cloud_LedgerRequest_GetPage_page_name_tag 3 -#define particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_ledger_name_tag 1 -#define particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_scope_tag 2 -#define particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_page_names_tag 3 -#define particle_cloud_LedgerRequest_Subscribe_ledger_pages_tag 1 -#define particle_cloud_LedgerRequest_Subscribe_resubscribe_tag 2 -#define particle_cloud_LedgerRequest_Subscribe_LedgerPages_ledger_name_tag 1 -#define particle_cloud_LedgerRequest_Subscribe_LedgerPages_scope_tag 2 -#define particle_cloud_LedgerRequest_Subscribe_LedgerPages_page_names_tag 3 -#define particle_cloud_LedgerRequest_SyncPage_ledger_name_tag 1 -#define particle_cloud_LedgerRequest_SyncPage_scope_tag 2 -#define particle_cloud_LedgerRequest_SyncPage_page_name_tag 3 -#define particle_cloud_LedgerRequest_SyncPage_updated_at_tag 4 -#define particle_cloud_LedgerRequest_SyncPage_strategy_tag 5 -#define particle_cloud_LedgerRequest_SyncPage_data_tag 6 -#define particle_cloud_LedgerRequest_Unsubscribe_ledger_pages_tag 1 -#define particle_cloud_LedgerRequest_Unsubscribe_unsubscribe_all_tag 2 -#define particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_ledger_name_tag 1 -#define particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_scope_tag 2 -#define particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_page_names_tag 3 -#define particle_cloud_LedgerResponse_GetPage_data_tag 1 -#define particle_cloud_LedgerResponse_GetPage_updated_at_tag 2 -#define particle_cloud_LedgerResponse_ListLedgers_Ledger_name_tag 1 -#define particle_cloud_LedgerResponse_ListLedgers_Ledger_scope_tag 2 -#define particle_cloud_LedgerResponse_SyncPage_data_tag 1 -#define particle_cloud_LedgerResponse_SyncPage_updated_at_tag 2 -#define particle_cloud_LedgerRequest_type_tag 1 -#define particle_cloud_LedgerRequest_list_ledgers_tag 2 -#define particle_cloud_LedgerRequest_get_page_tag 3 -#define particle_cloud_LedgerRequest_sync_page_tag 4 -#define particle_cloud_LedgerRequest_subscribe_tag 5 -#define particle_cloud_LedgerRequest_unsubscribe_tag 6 -#define particle_cloud_LedgerRequest_notify_page_changed_tag 7 -#define particle_cloud_LedgerResponse_result_tag 1 -#define particle_cloud_LedgerResponse_error_message_tag 2 -#define particle_cloud_LedgerResponse_list_ledgers_tag 3 -#define particle_cloud_LedgerResponse_get_page_tag 4 -#define particle_cloud_LedgerResponse_sync_page_tag 5 -#define particle_cloud_LedgerResponse_subscribe_tag 6 -#define particle_cloud_LedgerResponse_unsubscribe_tag 7 -#define particle_cloud_LedgerResponse_notify_page_changed_tag 8 +#define particle_cloud_ledger_GetInfoRequest_ledgers_tag 1 +#define particle_cloud_ledger_GetInfoResponse_ledgers_tag 1 +#define particle_cloud_ledger_SubscribeRequest_ledgers_tag 1 +#define particle_cloud_ledger_SubscribeResponse_ledgers_tag 1 +#define particle_cloud_ledger_GetDataRequest_name_tag 1 +#define particle_cloud_ledger_GetDataRequest_last_updated_tag 2 +#define particle_cloud_ledger_GetDataResponse_data_tag 1 +#define particle_cloud_ledger_GetDataResponse_last_updated_tag 2 +#define particle_cloud_ledger_GetInfoResponse_Ledger_name_tag 1 +#define particle_cloud_ledger_GetInfoResponse_Ledger_scope_tag 2 +#define particle_cloud_ledger_GetInfoResponse_Ledger_sync_direction_tag 3 +#define particle_cloud_ledger_GetInfoResponse_Ledger_last_updated_tag 4 +#define particle_cloud_ledger_NotifyUpdateRequest_name_tag 1 +#define particle_cloud_ledger_NotifyUpdateRequest_last_updated_tag 2 +#define particle_cloud_ledger_SetDataRequest_name_tag 1 +#define particle_cloud_ledger_SetDataRequest_data_tag 2 +#define particle_cloud_ledger_SetDataRequest_last_updated_tag 3 +#define particle_cloud_ledger_SubscribeResponse_Ledger_name_tag 1 +#define particle_cloud_ledger_SubscribeResponse_Ledger_last_updated_tag 2 /* Struct field encoding specification for nanopb */ -#define particle_cloud_LedgerRequest_FIELDLIST(X, a) \ -X(a, STATIC, OPTIONAL, UENUM, type, 1) \ -X(a, STATIC, ONEOF, MESSAGE, (request,list_ledgers,request.list_ledgers), 2) \ -X(a, STATIC, ONEOF, MESSAGE, (request,get_page,request.get_page), 3) \ -X(a, STATIC, ONEOF, MESSAGE, (request,sync_page,request.sync_page), 4) \ -X(a, STATIC, ONEOF, MESSAGE, (request,subscribe,request.subscribe), 5) \ -X(a, STATIC, ONEOF, MESSAGE, (request,unsubscribe,request.unsubscribe), 6) \ -X(a, STATIC, ONEOF, MESSAGE, (request,notify_page_changed,request.notify_page_changed), 7) -#define particle_cloud_LedgerRequest_CALLBACK NULL -#define particle_cloud_LedgerRequest_DEFAULT NULL -#define particle_cloud_LedgerRequest_request_list_ledgers_MSGTYPE particle_cloud_LedgerRequest_ListLedgers -#define particle_cloud_LedgerRequest_request_get_page_MSGTYPE particle_cloud_LedgerRequest_GetPage -#define particle_cloud_LedgerRequest_request_sync_page_MSGTYPE particle_cloud_LedgerRequest_SyncPage -#define particle_cloud_LedgerRequest_request_subscribe_MSGTYPE particle_cloud_LedgerRequest_Subscribe -#define particle_cloud_LedgerRequest_request_unsubscribe_MSGTYPE particle_cloud_LedgerRequest_Unsubscribe -#define particle_cloud_LedgerRequest_request_notify_page_changed_MSGTYPE particle_cloud_LedgerRequest_NotifyPageChanged - -#define particle_cloud_LedgerRequest_ListLedgers_FIELDLIST(X, a) \ -X(a, CALLBACK, REPEATED, UENUM, scopes, 1) -#define particle_cloud_LedgerRequest_ListLedgers_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerRequest_ListLedgers_DEFAULT NULL - -#define particle_cloud_LedgerRequest_GetPage_FIELDLIST(X, a) \ -X(a, CALLBACK, SINGULAR, STRING, ledger_name, 1) \ -X(a, STATIC, SINGULAR, UENUM, scope, 2) \ -X(a, CALLBACK, SINGULAR, STRING, page_name, 3) -#define particle_cloud_LedgerRequest_GetPage_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerRequest_GetPage_DEFAULT NULL +#define particle_cloud_ledger_GetInfoRequest_FIELDLIST(X, a) \ +X(a, CALLBACK, REPEATED, STRING, ledgers, 1) +#define particle_cloud_ledger_GetInfoRequest_CALLBACK pb_default_field_callback +#define particle_cloud_ledger_GetInfoRequest_DEFAULT NULL -#define particle_cloud_LedgerRequest_SyncPage_FIELDLIST(X, a) \ -X(a, CALLBACK, SINGULAR, STRING, ledger_name, 1) \ -X(a, STATIC, SINGULAR, UENUM, scope, 2) \ -X(a, CALLBACK, SINGULAR, STRING, page_name, 3) \ -X(a, STATIC, OPTIONAL, FIXED64, updated_at, 4) \ -X(a, STATIC, OPTIONAL, UENUM, strategy, 5) \ -X(a, CALLBACK, OPTIONAL, BYTES, data, 6) -#define particle_cloud_LedgerRequest_SyncPage_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerRequest_SyncPage_DEFAULT NULL - -#define particle_cloud_LedgerRequest_Subscribe_FIELDLIST(X, a) \ -X(a, CALLBACK, REPEATED, MESSAGE, ledger_pages, 1) \ -X(a, STATIC, SINGULAR, BOOL, resubscribe, 2) -#define particle_cloud_LedgerRequest_Subscribe_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerRequest_Subscribe_DEFAULT NULL -#define particle_cloud_LedgerRequest_Subscribe_ledger_pages_MSGTYPE particle_cloud_LedgerRequest_Subscribe_LedgerPages - -#define particle_cloud_LedgerRequest_Subscribe_LedgerPages_FIELDLIST(X, a) \ -X(a, CALLBACK, SINGULAR, STRING, ledger_name, 1) \ -X(a, STATIC, SINGULAR, UENUM, scope, 2) \ -X(a, CALLBACK, REPEATED, STRING, page_names, 3) -#define particle_cloud_LedgerRequest_Subscribe_LedgerPages_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerRequest_Subscribe_LedgerPages_DEFAULT NULL - -#define particle_cloud_LedgerRequest_Unsubscribe_FIELDLIST(X, a) \ -X(a, CALLBACK, REPEATED, MESSAGE, ledger_pages, 1) \ -X(a, STATIC, SINGULAR, BOOL, unsubscribe_all, 2) -#define particle_cloud_LedgerRequest_Unsubscribe_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerRequest_Unsubscribe_DEFAULT NULL -#define particle_cloud_LedgerRequest_Unsubscribe_ledger_pages_MSGTYPE particle_cloud_LedgerRequest_Unsubscribe_LedgerPages - -#define particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_FIELDLIST(X, a) \ -X(a, CALLBACK, SINGULAR, STRING, ledger_name, 1) \ -X(a, STATIC, SINGULAR, UENUM, scope, 2) \ -X(a, CALLBACK, REPEATED, STRING, page_names, 3) -#define particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_DEFAULT NULL - -#define particle_cloud_LedgerRequest_NotifyPageChanged_FIELDLIST(X, a) \ -X(a, CALLBACK, REPEATED, MESSAGE, ledger_pages, 1) -#define particle_cloud_LedgerRequest_NotifyPageChanged_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerRequest_NotifyPageChanged_DEFAULT NULL -#define particle_cloud_LedgerRequest_NotifyPageChanged_ledger_pages_MSGTYPE particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages - -#define particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_FIELDLIST(X, a) \ -X(a, CALLBACK, SINGULAR, STRING, ledger_name, 1) \ +#define particle_cloud_ledger_GetInfoResponse_FIELDLIST(X, a) \ +X(a, CALLBACK, REPEATED, MESSAGE, ledgers, 1) +#define particle_cloud_ledger_GetInfoResponse_CALLBACK pb_default_field_callback +#define particle_cloud_ledger_GetInfoResponse_DEFAULT NULL +#define particle_cloud_ledger_GetInfoResponse_ledgers_MSGTYPE particle_cloud_ledger_GetInfoResponse_Ledger + +#define particle_cloud_ledger_GetInfoResponse_Ledger_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, STRING, name, 1) \ X(a, STATIC, SINGULAR, UENUM, scope, 2) \ -X(a, CALLBACK, REPEATED, STRING, page_names, 3) -#define particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_DEFAULT NULL - -#define particle_cloud_LedgerResponse_FIELDLIST(X, a) \ -X(a, STATIC, SINGULAR, UENUM, result, 1) \ -X(a, CALLBACK, OPTIONAL, STRING, error_message, 2) \ -X(a, STATIC, ONEOF, MESSAGE, (response,list_ledgers,response.list_ledgers), 3) \ -X(a, STATIC, ONEOF, MESSAGE, (response,get_page,response.get_page), 4) \ -X(a, STATIC, ONEOF, MESSAGE, (response,sync_page,response.sync_page), 5) \ -X(a, STATIC, ONEOF, MESSAGE, (response,subscribe,response.subscribe), 6) \ -X(a, STATIC, ONEOF, MESSAGE, (response,unsubscribe,response.unsubscribe), 7) \ -X(a, STATIC, ONEOF, MESSAGE, (response,notify_page_changed,response.notify_page_changed), 8) -#define particle_cloud_LedgerResponse_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerResponse_DEFAULT NULL -#define particle_cloud_LedgerResponse_response_list_ledgers_MSGTYPE particle_cloud_LedgerResponse_ListLedgers -#define particle_cloud_LedgerResponse_response_get_page_MSGTYPE particle_cloud_LedgerResponse_GetPage -#define particle_cloud_LedgerResponse_response_sync_page_MSGTYPE particle_cloud_LedgerResponse_SyncPage -#define particle_cloud_LedgerResponse_response_subscribe_MSGTYPE particle_cloud_LedgerResponse_Subscribe -#define particle_cloud_LedgerResponse_response_unsubscribe_MSGTYPE particle_cloud_LedgerResponse_Unsubscribe -#define particle_cloud_LedgerResponse_response_notify_page_changed_MSGTYPE particle_cloud_LedgerResponse_NotifyPageChanged - -#define particle_cloud_LedgerResponse_ListLedgers_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UENUM, sync_direction, 3) \ +X(a, STATIC, SINGULAR, FIXED64, last_updated, 4) +#define particle_cloud_ledger_GetInfoResponse_Ledger_CALLBACK NULL +#define particle_cloud_ledger_GetInfoResponse_Ledger_DEFAULT NULL + +#define particle_cloud_ledger_SetDataRequest_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, STRING, name, 1) \ +X(a, CALLBACK, SINGULAR, BYTES, data, 2) \ +X(a, STATIC, SINGULAR, FIXED64, last_updated, 3) +#define particle_cloud_ledger_SetDataRequest_CALLBACK pb_default_field_callback +#define particle_cloud_ledger_SetDataRequest_DEFAULT NULL + +#define particle_cloud_ledger_SetDataResponse_FIELDLIST(X, a) \ + +#define particle_cloud_ledger_SetDataResponse_CALLBACK NULL +#define particle_cloud_ledger_SetDataResponse_DEFAULT NULL + +#define particle_cloud_ledger_GetDataRequest_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, STRING, name, 1) \ +X(a, STATIC, OPTIONAL, FIXED64, last_updated, 2) +#define particle_cloud_ledger_GetDataRequest_CALLBACK NULL +#define particle_cloud_ledger_GetDataRequest_DEFAULT NULL + +#define particle_cloud_ledger_GetDataResponse_FIELDLIST(X, a) \ +X(a, CALLBACK, OPTIONAL, BYTES, data, 1) \ +X(a, STATIC, SINGULAR, FIXED64, last_updated, 2) +#define particle_cloud_ledger_GetDataResponse_CALLBACK pb_default_field_callback +#define particle_cloud_ledger_GetDataResponse_DEFAULT NULL + +#define particle_cloud_ledger_SubscribeRequest_FIELDLIST(X, a) \ +X(a, CALLBACK, REPEATED, STRING, ledgers, 1) +#define particle_cloud_ledger_SubscribeRequest_CALLBACK pb_default_field_callback +#define particle_cloud_ledger_SubscribeRequest_DEFAULT NULL + +#define particle_cloud_ledger_SubscribeResponse_FIELDLIST(X, a) \ X(a, CALLBACK, REPEATED, MESSAGE, ledgers, 1) -#define particle_cloud_LedgerResponse_ListLedgers_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerResponse_ListLedgers_DEFAULT NULL -#define particle_cloud_LedgerResponse_ListLedgers_ledgers_MSGTYPE particle_cloud_LedgerResponse_ListLedgers_Ledger - -#define particle_cloud_LedgerResponse_ListLedgers_Ledger_FIELDLIST(X, a) \ -X(a, CALLBACK, SINGULAR, STRING, name, 1) \ -X(a, STATIC, SINGULAR, UENUM, scope, 2) -#define particle_cloud_LedgerResponse_ListLedgers_Ledger_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerResponse_ListLedgers_Ledger_DEFAULT NULL - -#define particle_cloud_LedgerResponse_GetPage_FIELDLIST(X, a) \ -X(a, CALLBACK, SINGULAR, BYTES, data, 1) \ -X(a, STATIC, OPTIONAL, FIXED64, updated_at, 2) -#define particle_cloud_LedgerResponse_GetPage_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerResponse_GetPage_DEFAULT NULL - -#define particle_cloud_LedgerResponse_SyncPage_FIELDLIST(X, a) \ -X(a, CALLBACK, SINGULAR, BYTES, data, 1) \ -X(a, STATIC, SINGULAR, FIXED64, updated_at, 2) -#define particle_cloud_LedgerResponse_SyncPage_CALLBACK pb_default_field_callback -#define particle_cloud_LedgerResponse_SyncPage_DEFAULT NULL - -#define particle_cloud_LedgerResponse_Subscribe_FIELDLIST(X, a) \ - -#define particle_cloud_LedgerResponse_Subscribe_CALLBACK NULL -#define particle_cloud_LedgerResponse_Subscribe_DEFAULT NULL - -#define particle_cloud_LedgerResponse_Unsubscribe_FIELDLIST(X, a) \ - -#define particle_cloud_LedgerResponse_Unsubscribe_CALLBACK NULL -#define particle_cloud_LedgerResponse_Unsubscribe_DEFAULT NULL - -#define particle_cloud_LedgerResponse_NotifyPageChanged_FIELDLIST(X, a) \ - -#define particle_cloud_LedgerResponse_NotifyPageChanged_CALLBACK NULL -#define particle_cloud_LedgerResponse_NotifyPageChanged_DEFAULT NULL - -extern const pb_msgdesc_t particle_cloud_LedgerRequest_msg; -extern const pb_msgdesc_t particle_cloud_LedgerRequest_ListLedgers_msg; -extern const pb_msgdesc_t particle_cloud_LedgerRequest_GetPage_msg; -extern const pb_msgdesc_t particle_cloud_LedgerRequest_SyncPage_msg; -extern const pb_msgdesc_t particle_cloud_LedgerRequest_Subscribe_msg; -extern const pb_msgdesc_t particle_cloud_LedgerRequest_Subscribe_LedgerPages_msg; -extern const pb_msgdesc_t particle_cloud_LedgerRequest_Unsubscribe_msg; -extern const pb_msgdesc_t particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_msg; -extern const pb_msgdesc_t particle_cloud_LedgerRequest_NotifyPageChanged_msg; -extern const pb_msgdesc_t particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_msg; -extern const pb_msgdesc_t particle_cloud_LedgerResponse_msg; -extern const pb_msgdesc_t particle_cloud_LedgerResponse_ListLedgers_msg; -extern const pb_msgdesc_t particle_cloud_LedgerResponse_ListLedgers_Ledger_msg; -extern const pb_msgdesc_t particle_cloud_LedgerResponse_GetPage_msg; -extern const pb_msgdesc_t particle_cloud_LedgerResponse_SyncPage_msg; -extern const pb_msgdesc_t particle_cloud_LedgerResponse_Subscribe_msg; -extern const pb_msgdesc_t particle_cloud_LedgerResponse_Unsubscribe_msg; -extern const pb_msgdesc_t particle_cloud_LedgerResponse_NotifyPageChanged_msg; +#define particle_cloud_ledger_SubscribeResponse_CALLBACK pb_default_field_callback +#define particle_cloud_ledger_SubscribeResponse_DEFAULT NULL +#define particle_cloud_ledger_SubscribeResponse_ledgers_MSGTYPE particle_cloud_ledger_SubscribeResponse_Ledger + +#define particle_cloud_ledger_SubscribeResponse_Ledger_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, STRING, name, 1) \ +X(a, STATIC, SINGULAR, FIXED64, last_updated, 2) +#define particle_cloud_ledger_SubscribeResponse_Ledger_CALLBACK NULL +#define particle_cloud_ledger_SubscribeResponse_Ledger_DEFAULT NULL + +#define particle_cloud_ledger_NotifyUpdateRequest_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, STRING, name, 1) \ +X(a, STATIC, SINGULAR, FIXED64, last_updated, 2) +#define particle_cloud_ledger_NotifyUpdateRequest_CALLBACK NULL +#define particle_cloud_ledger_NotifyUpdateRequest_DEFAULT NULL + +#define particle_cloud_ledger_NotifyUpdateResponse_FIELDLIST(X, a) \ + +#define particle_cloud_ledger_NotifyUpdateResponse_CALLBACK NULL +#define particle_cloud_ledger_NotifyUpdateResponse_DEFAULT NULL + +extern const pb_msgdesc_t particle_cloud_ledger_GetInfoRequest_msg; +extern const pb_msgdesc_t particle_cloud_ledger_GetInfoResponse_msg; +extern const pb_msgdesc_t particle_cloud_ledger_GetInfoResponse_Ledger_msg; +extern const pb_msgdesc_t particle_cloud_ledger_SetDataRequest_msg; +extern const pb_msgdesc_t particle_cloud_ledger_SetDataResponse_msg; +extern const pb_msgdesc_t particle_cloud_ledger_GetDataRequest_msg; +extern const pb_msgdesc_t particle_cloud_ledger_GetDataResponse_msg; +extern const pb_msgdesc_t particle_cloud_ledger_SubscribeRequest_msg; +extern const pb_msgdesc_t particle_cloud_ledger_SubscribeResponse_msg; +extern const pb_msgdesc_t particle_cloud_ledger_SubscribeResponse_Ledger_msg; +extern const pb_msgdesc_t particle_cloud_ledger_NotifyUpdateRequest_msg; +extern const pb_msgdesc_t particle_cloud_ledger_NotifyUpdateResponse_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define particle_cloud_LedgerRequest_fields &particle_cloud_LedgerRequest_msg -#define particle_cloud_LedgerRequest_ListLedgers_fields &particle_cloud_LedgerRequest_ListLedgers_msg -#define particle_cloud_LedgerRequest_GetPage_fields &particle_cloud_LedgerRequest_GetPage_msg -#define particle_cloud_LedgerRequest_SyncPage_fields &particle_cloud_LedgerRequest_SyncPage_msg -#define particle_cloud_LedgerRequest_Subscribe_fields &particle_cloud_LedgerRequest_Subscribe_msg -#define particle_cloud_LedgerRequest_Subscribe_LedgerPages_fields &particle_cloud_LedgerRequest_Subscribe_LedgerPages_msg -#define particle_cloud_LedgerRequest_Unsubscribe_fields &particle_cloud_LedgerRequest_Unsubscribe_msg -#define particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_fields &particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_msg -#define particle_cloud_LedgerRequest_NotifyPageChanged_fields &particle_cloud_LedgerRequest_NotifyPageChanged_msg -#define particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_fields &particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_msg -#define particle_cloud_LedgerResponse_fields &particle_cloud_LedgerResponse_msg -#define particle_cloud_LedgerResponse_ListLedgers_fields &particle_cloud_LedgerResponse_ListLedgers_msg -#define particle_cloud_LedgerResponse_ListLedgers_Ledger_fields &particle_cloud_LedgerResponse_ListLedgers_Ledger_msg -#define particle_cloud_LedgerResponse_GetPage_fields &particle_cloud_LedgerResponse_GetPage_msg -#define particle_cloud_LedgerResponse_SyncPage_fields &particle_cloud_LedgerResponse_SyncPage_msg -#define particle_cloud_LedgerResponse_Subscribe_fields &particle_cloud_LedgerResponse_Subscribe_msg -#define particle_cloud_LedgerResponse_Unsubscribe_fields &particle_cloud_LedgerResponse_Unsubscribe_msg -#define particle_cloud_LedgerResponse_NotifyPageChanged_fields &particle_cloud_LedgerResponse_NotifyPageChanged_msg +#define particle_cloud_ledger_GetInfoRequest_fields &particle_cloud_ledger_GetInfoRequest_msg +#define particle_cloud_ledger_GetInfoResponse_fields &particle_cloud_ledger_GetInfoResponse_msg +#define particle_cloud_ledger_GetInfoResponse_Ledger_fields &particle_cloud_ledger_GetInfoResponse_Ledger_msg +#define particle_cloud_ledger_SetDataRequest_fields &particle_cloud_ledger_SetDataRequest_msg +#define particle_cloud_ledger_SetDataResponse_fields &particle_cloud_ledger_SetDataResponse_msg +#define particle_cloud_ledger_GetDataRequest_fields &particle_cloud_ledger_GetDataRequest_msg +#define particle_cloud_ledger_GetDataResponse_fields &particle_cloud_ledger_GetDataResponse_msg +#define particle_cloud_ledger_SubscribeRequest_fields &particle_cloud_ledger_SubscribeRequest_msg +#define particle_cloud_ledger_SubscribeResponse_fields &particle_cloud_ledger_SubscribeResponse_msg +#define particle_cloud_ledger_SubscribeResponse_Ledger_fields &particle_cloud_ledger_SubscribeResponse_Ledger_msg +#define particle_cloud_ledger_NotifyUpdateRequest_fields &particle_cloud_ledger_NotifyUpdateRequest_msg +#define particle_cloud_ledger_NotifyUpdateResponse_fields &particle_cloud_ledger_NotifyUpdateResponse_msg /* Maximum encoded size of messages (where known) */ -/* particle_cloud_LedgerRequest_size depends on runtime parameters */ -/* particle_cloud_LedgerRequest_ListLedgers_size depends on runtime parameters */ -/* particle_cloud_LedgerRequest_GetPage_size depends on runtime parameters */ -/* particle_cloud_LedgerRequest_SyncPage_size depends on runtime parameters */ -/* particle_cloud_LedgerRequest_Subscribe_size depends on runtime parameters */ -/* particle_cloud_LedgerRequest_Subscribe_LedgerPages_size depends on runtime parameters */ -/* particle_cloud_LedgerRequest_Unsubscribe_size depends on runtime parameters */ -/* particle_cloud_LedgerRequest_Unsubscribe_LedgerPages_size depends on runtime parameters */ -/* particle_cloud_LedgerRequest_NotifyPageChanged_size depends on runtime parameters */ -/* particle_cloud_LedgerRequest_NotifyPageChanged_LedgerPages_size depends on runtime parameters */ -/* particle_cloud_LedgerResponse_size depends on runtime parameters */ -/* particle_cloud_LedgerResponse_ListLedgers_size depends on runtime parameters */ -/* particle_cloud_LedgerResponse_ListLedgers_Ledger_size depends on runtime parameters */ -/* particle_cloud_LedgerResponse_GetPage_size depends on runtime parameters */ -/* particle_cloud_LedgerResponse_SyncPage_size depends on runtime parameters */ -#define particle_cloud_LedgerResponse_NotifyPageChanged_size 0 -#define particle_cloud_LedgerResponse_Subscribe_size 0 -#define particle_cloud_LedgerResponse_Unsubscribe_size 0 +/* particle_cloud_ledger_GetInfoRequest_size depends on runtime parameters */ +/* particle_cloud_ledger_GetInfoResponse_size depends on runtime parameters */ +/* particle_cloud_ledger_SetDataRequest_size depends on runtime parameters */ +/* particle_cloud_ledger_GetDataResponse_size depends on runtime parameters */ +/* particle_cloud_ledger_SubscribeRequest_size depends on runtime parameters */ +/* particle_cloud_ledger_SubscribeResponse_size depends on runtime parameters */ +#define particle_cloud_ledger_GetDataRequest_size 43 +#define particle_cloud_ledger_GetInfoResponse_Ledger_size 47 +#define particle_cloud_ledger_NotifyUpdateRequest_size 43 +#define particle_cloud_ledger_NotifyUpdateResponse_size 0 +#define particle_cloud_ledger_SetDataResponse_size 0 +#define particle_cloud_ledger_SubscribeResponse_Ledger_size 43 #ifdef __cplusplus } /* extern "C" */ diff --git a/proto_defs/src/common/ledger.pb.c b/proto_defs/src/common/ledger.pb.c deleted file mode 100644 index aa4ef295e6..0000000000 --- a/proto_defs/src/common/ledger.pb.c +++ /dev/null @@ -1,11 +0,0 @@ -/* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.5 */ - -#include "common/ledger.pb.h" -#if PB_PROTO_HEADER_VERSION != 40 -#error Regenerate this file with the current version of nanopb generator. -#endif - - - - diff --git a/proto_defs/src/common/ledger.pb.h b/proto_defs/src/common/ledger.pb.h deleted file mode 100644 index ea629718d9..0000000000 --- a/proto_defs/src/common/ledger.pb.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.5 */ - -#ifndef PB_PARTICLE_LEDGER_COMMON_LEDGER_PB_H_INCLUDED -#define PB_PARTICLE_LEDGER_COMMON_LEDGER_PB_H_INCLUDED -#include - -#if PB_PROTO_HEADER_VERSION != 40 -#error Regenerate this file with the current version of nanopb generator. -#endif - -/* Enum definitions */ -/* * - Ledger scope. */ -typedef enum _particle_ledger_LedgerScope { - particle_ledger_LedgerScope_LEDGER_SCOPE_UNKNOWN = 0, /* /< Unknown scope. */ - particle_ledger_LedgerScope_LEDGER_SCOPE_DEVICE = 1, /* /< Device scope. */ - particle_ledger_LedgerScope_LEDGER_SCOPE_PRODUCT = 2, /* /< Product scope. */ - particle_ledger_LedgerScope_LEDGER_SCOPE_OWNER = 3 /* /< Owner scope. */ -} particle_ledger_LedgerScope; - -/* * - Sync direction. */ -typedef enum _particle_ledger_SyncDirection { - particle_ledger_SyncDirection_SYNC_DIRECTION_UNKNOWN = 0, /* /< Unknown direction. */ - particle_ledger_SyncDirection_SYNC_DIRECTION_DEVICE_TO_CLOUD = 1, /* /< Device to cloud. */ - particle_ledger_SyncDirection_SYNC_DIRECTION_CLOUD_TO_DEVICE = 2 /* /< Cloud to device. */ -} particle_ledger_SyncDirection; - -/* Helper constants for enums */ -#define _particle_ledger_LedgerScope_MIN particle_ledger_LedgerScope_LEDGER_SCOPE_UNKNOWN -#define _particle_ledger_LedgerScope_MAX particle_ledger_LedgerScope_LEDGER_SCOPE_OWNER -#define _particle_ledger_LedgerScope_ARRAYSIZE ((particle_ledger_LedgerScope)(particle_ledger_LedgerScope_LEDGER_SCOPE_OWNER+1)) - -#define _particle_ledger_SyncDirection_MIN particle_ledger_SyncDirection_SYNC_DIRECTION_UNKNOWN -#define _particle_ledger_SyncDirection_MAX particle_ledger_SyncDirection_SYNC_DIRECTION_CLOUD_TO_DEVICE -#define _particle_ledger_SyncDirection_ARRAYSIZE ((particle_ledger_SyncDirection)(particle_ledger_SyncDirection_SYNC_DIRECTION_CLOUD_TO_DEVICE+1)) - - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/proto_defs/src/ledger.pb.h b/proto_defs/src/ledger.pb.h index 8c5b36b64b..6ed3808028 100644 --- a/proto_defs/src/ledger.pb.h +++ b/proto_defs/src/ledger.pb.h @@ -4,7 +4,7 @@ #ifndef PB_PARTICLE_FIRMWARE_LEDGER_PB_H_INCLUDED #define PB_PARTICLE_FIRMWARE_LEDGER_PB_H_INCLUDED #include -#include "common/ledger.pb.h" +#include "cloud/ledger.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -15,15 +15,15 @@ Ledger info. */ typedef struct _particle_firmware_LedgerInfo { char name[33]; /* /< Ledger name. */ - particle_ledger_LedgerScope scope; /* /< Ledger scope. */ - particle_ledger_SyncDirection sync_direction; /* /< Sync direction. */ + particle_cloud_ledger_Scope scope; /* /< Ledger scope. */ + particle_cloud_ledger_SyncDirection sync_direction; /* /< Sync direction. */ /* * - Last time the ledger was updated, in milliseconds since the Unix epoch. + Time the ledger was last updated, in milliseconds since the Unix epoch. If 0, the time is unknown. */ uint64_t last_updated; /* * - Last time the ledger was synchronized with the Cloud, in milliseconds since the Unix epoch. + Time the ledger was last synchronized with the Cloud, in milliseconds since the Unix epoch. If 0, the ledger has never been synchronized. */ uint64_t last_synced; @@ -36,8 +36,8 @@ extern "C" { #endif /* Initializer values for message structs */ -#define particle_firmware_LedgerInfo_init_default {"", _particle_ledger_LedgerScope_MIN, _particle_ledger_SyncDirection_MIN, 0, 0, 0} -#define particle_firmware_LedgerInfo_init_zero {"", _particle_ledger_LedgerScope_MIN, _particle_ledger_SyncDirection_MIN, 0, 0, 0} +#define particle_firmware_LedgerInfo_init_default {"", _particle_cloud_ledger_Scope_MIN, _particle_cloud_ledger_SyncDirection_MIN, 0, 0, 0} +#define particle_firmware_LedgerInfo_init_zero {"", _particle_cloud_ledger_Scope_MIN, _particle_cloud_ledger_SyncDirection_MIN, 0, 0, 0} /* Field tags (for use in manual encoding/decoding) */ #define particle_firmware_LedgerInfo_name_tag 1 diff --git a/system/src/system_ledger_internal.cpp b/system/src/system_ledger_internal.cpp index 9fe95437aa..2b2a05e13f 100644 --- a/system/src/system_ledger_internal.cpp +++ b/system/src/system_ledger_internal.cpp @@ -35,18 +35,16 @@ #include "scope_guard.h" #include "check.h" -#include "common/ledger.pb.h" // Common definitions #include "cloud/ledger.pb.h" // Cloud protocol definitions #include "ledger.pb.h" // Internal definitions -#define PB_LEDGER(_name) particle_ledger_##_name -#define PB_CLOUD(_name) particle_cloud_##_name +#define PB_LEDGER(_name) particle_cloud_ledger_##_name #define PB_INTERNAL(_name) particle_firmware_##_name -static_assert(LEDGER_SCOPE_UNKNOWN == (int)PB_LEDGER(LedgerScope_LEDGER_SCOPE_UNKNOWN) && - LEDGER_SCOPE_DEVICE == (int)PB_LEDGER(LedgerScope_LEDGER_SCOPE_DEVICE) && - LEDGER_SCOPE_PRODUCT == (int)PB_LEDGER(LedgerScope_LEDGER_SCOPE_PRODUCT) && - LEDGER_SCOPE_OWNER == (int)PB_LEDGER(LedgerScope_LEDGER_SCOPE_OWNER)); +static_assert(LEDGER_SCOPE_UNKNOWN == (int)PB_LEDGER(Scope_SCOPE_UNKNOWN) && + LEDGER_SCOPE_DEVICE == (int)PB_LEDGER(Scope_SCOPE_DEVICE) && + LEDGER_SCOPE_PRODUCT == (int)PB_LEDGER(Scope_SCOPE_PRODUCT) && + LEDGER_SCOPE_OWNER == (int)PB_LEDGER(Scope_SCOPE_OWNER)); static_assert(LEDGER_SYNC_DIRECTION_UNKNOWN == (int)PB_LEDGER(SyncDirection_SYNC_DIRECTION_UNKNOWN) && LEDGER_SYNC_DIRECTION_DEVICE_TO_CLOUD == (int)PB_LEDGER(SyncDirection_SYNC_DIRECTION_DEVICE_TO_CLOUD) && @@ -169,7 +167,7 @@ int writeLedgerInfo(lfs_t* fs, lfs_file_t* file, const char* ledgerName, const L if (n >= sizeof(pbInfo.name)) { return SYSTEM_ERROR_INTERNAL; // The name is longer than specified in ledger.proto } - pbInfo.scope = static_cast(info.scope()); + pbInfo.scope = static_cast(info.scope()); pbInfo.sync_direction = static_cast(info.syncDirection()); pbInfo.last_updated = info.lastUpdated(); pbInfo.last_synced = info.lastSynced();