From 5e87ee338d121e57402d15e1c840703fafe65e73 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sat, 10 Apr 2021 11:39:13 +0800 Subject: [PATCH] add is_licensed for ham users --- proto | 2 +- src/mesh/generated/deviceonly.pb.h | 2 +- src/mesh/generated/mesh.pb.h | 13 ++++++++----- src/plugins/AdminPlugin.cpp | 4 ++++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/proto b/proto index 3252ed0f1..858d816b8 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 3252ed0f1357d55233f2d5cb50acf20dbb9160ed +Subproject commit 858d816b8c18911fd4dc2aee3fa421fd67325631 diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index fa5de7b93..432572825 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -125,7 +125,7 @@ extern const pb_msgdesc_t ChannelFile_msg; /* Maximum encoded size of messages (where known) */ #define LegacyRadioConfig_size 4 #define LegacyRadioConfig_LegacyPreferences_size 2 -#define DeviceState_size 5118 +#define DeviceState_size 5184 #define ChannelFile_size 832 #ifdef __cplusplus diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 4f30ade8b..93bb63cdf 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -135,6 +135,7 @@ typedef struct _User { char short_name[5]; pb_byte_t macaddr[6]; HardwareModel hw_model; + bool is_licensed; } User; typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t; @@ -230,7 +231,7 @@ extern "C" { /* Initializer values for message structs */ #define Position_init_default {0, 0, 0, 0, 0} -#define User_init_default {"", "", "", {0}, _HardwareModel_MIN} +#define User_init_default {"", "", "", {0}, _HardwareModel_MIN, 0} #define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}} #define Routing_init_default {0, {RouteDiscovery_init_default}} #define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0} @@ -241,7 +242,7 @@ extern "C" { #define FromRadio_init_default {0, 0, {MyNodeInfo_init_default}} #define ToRadio_init_default {0, {MeshPacket_init_default}} #define Position_init_zero {0, 0, 0, 0, 0} -#define User_init_zero {"", "", "", {0}, _HardwareModel_MIN} +#define User_init_zero {"", "", "", {0}, _HardwareModel_MIN, 0} #define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}} #define Routing_init_zero {0, {RouteDiscovery_init_zero}} #define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0} @@ -287,6 +288,7 @@ extern "C" { #define User_short_name_tag 3 #define User_macaddr_tag 4 #define User_hw_model_tag 6 +#define User_is_licensed_tag 7 #define MeshPacket_from_tag 1 #define MeshPacket_to_tag 2 #define MeshPacket_channel_tag 3 @@ -333,7 +335,8 @@ X(a, STATIC, SINGULAR, STRING, id, 1) \ X(a, STATIC, SINGULAR, STRING, long_name, 2) \ X(a, STATIC, SINGULAR, STRING, short_name, 3) \ X(a, STATIC, SINGULAR, FIXED_LENGTH_BYTES, macaddr, 4) \ -X(a, STATIC, SINGULAR, UENUM, hw_model, 6) +X(a, STATIC, SINGULAR, UENUM, hw_model, 6) \ +X(a, STATIC, SINGULAR, BOOL, is_licensed, 7) #define User_CALLBACK NULL #define User_DEFAULT NULL @@ -464,12 +467,12 @@ extern const pb_msgdesc_t ToRadio_msg; /* Maximum encoded size of messages (where known) */ #define Position_size 37 -#define User_size 74 +#define User_size 76 #define RouteDiscovery_size 40 #define Routing_size 42 #define Data_size 260 #define MeshPacket_size 309 -#define NodeInfo_size 131 +#define NodeInfo_size 133 #define MyNodeInfo_size 95 #define LogRecord_size 81 #define FromRadio_size 318 diff --git a/src/plugins/AdminPlugin.cpp b/src/plugins/AdminPlugin.cpp index 87989937b..9ec305ec7 100644 --- a/src/plugins/AdminPlugin.cpp +++ b/src/plugins/AdminPlugin.cpp @@ -115,6 +115,10 @@ void AdminPlugin::handleSetOwner(const User &o) changed |= strcmp(owner.id, o.id); strcpy(owner.id, o.id); } + if (owner.is_licensed != o.is_licensed) { + changed = true; + owner.is_licensed = o.is_licensed; + } if (changed) // If nothing really changed, don't broadcast on the network or write to flash service.reloadOwner();