From 3a1f20821edb8b9208e493a81febdb7094fdae19 Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Mon, 2 May 2022 08:35:31 +1000 Subject: [PATCH] Remove team and provision set_config --- proto | 2 +- src/mesh/generated/admin.pb.h | 8 ++- src/mesh/generated/deviceonly.pb.h | 2 +- src/mesh/generated/mesh.pb.h | 79 ++++++------------------------ src/modules/AdminModule.cpp | 5 -- 5 files changed, 24 insertions(+), 72 deletions(-) diff --git a/proto b/proto index a3c79085..8778b419 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit a3c790850d536eb11d898bd40fd7d58977703fac +Subproject commit 8778b41906c4b1d0bd6053823f41cd4135160a8f diff --git a/src/mesh/generated/admin.pb.h b/src/mesh/generated/admin.pb.h index c4c2a716..9491eb9e 100644 --- a/src/mesh/generated/admin.pb.h +++ b/src/mesh/generated/admin.pb.h @@ -52,6 +52,7 @@ typedef struct _AdminMessage { User get_owner_response; AdminMessage_ConfigType get_config_request; Config get_config_response; + Config set_config; bool confirm_set_channel; bool confirm_set_radio; bool exit_simulator; @@ -99,6 +100,7 @@ extern "C" { #define AdminMessage_get_owner_response_tag 9 #define AdminMessage_get_config_request_tag 10 #define AdminMessage_get_config_response_tag 11 +#define AdminMessage_set_config_tag 12 #define AdminMessage_confirm_set_channel_tag 32 #define AdminMessage_confirm_set_radio_tag 33 #define AdminMessage_exit_simulator_tag 34 @@ -130,6 +132,7 @@ X(a, STATIC, ONEOF, BOOL, (variant,get_owner_request,get_owner_request) X(a, STATIC, ONEOF, MESSAGE, (variant,get_owner_response,get_owner_response), 9) \ X(a, STATIC, ONEOF, UENUM, (variant,get_config_request,get_config_request), 10) \ X(a, STATIC, ONEOF, MESSAGE, (variant,get_config_response,get_config_response), 11) \ +X(a, STATIC, ONEOF, MESSAGE, (variant,set_config,set_config), 12) \ X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_channel,confirm_set_channel), 32) \ X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_radio,confirm_set_radio), 33) \ X(a, STATIC, ONEOF, BOOL, (variant,exit_simulator,exit_simulator), 34) \ @@ -156,6 +159,7 @@ X(a, STATIC, ONEOF, INT32, (variant,shutdown_seconds,shutdown_seconds), #define AdminMessage_variant_get_channel_response_MSGTYPE Channel #define AdminMessage_variant_get_owner_response_MSGTYPE User #define AdminMessage_variant_get_config_response_MSGTYPE Config +#define AdminMessage_variant_set_config_MSGTYPE Config extern const pb_msgdesc_t AdminMessage_msg; @@ -163,9 +167,9 @@ extern const pb_msgdesc_t AdminMessage_msg; #define AdminMessage_fields &AdminMessage_msg /* Maximum encoded size of messages (where known) */ -#if defined(Config_size) +#if defined(Config_size) && defined(Config_size) #define AdminMessage_size (0 + sizeof(union AdminMessage_variant_size_union)) -union AdminMessage_variant_size_union {char f11[(6 + Config_size)]; char f0[551];}; +union AdminMessage_variant_size_union {char f0[551]; char f11[(6 + Config_size)]; char f12[(6 + Config_size)];}; #endif #ifdef __cplusplus diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index a8df04ea..d2d400f9 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -159,7 +159,7 @@ extern const pb_msgdesc_t OEMStore_msg; /* Maximum encoded size of messages (where known) */ #define ChannelFile_size 832 -#define DeviceState_size 19327 +#define DeviceState_size 19197 #define OEMStore_size 2106 #ifdef __cplusplus diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 8ce6fc80..e76eb83f 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -69,41 +69,6 @@ typedef enum _HardwareModel { HardwareModel_PRIVATE_HW = 255 } HardwareModel; -/* The team colors are based on the names of "friendly teams" in ATAK: - https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/atak/ATAK/app/src/main/assets/filters/team_filters.xml */ -typedef enum _Team { - /* the default (unset) is "achromatic" (unaffiliated) */ - Team_CLEAR = 0, - /* TODO: REPLACE */ - Team_CYAN = 1, - /* TODO: REPLACE */ - Team_WHITE = 2, - /* TODO: REPLACE */ - Team_YELLOW = 3, - /* TODO: REPLACE */ - Team_ORANGE = 4, - /* TODO: REPLACE */ - Team_MAGENTA = 5, - /* TODO: REPLACE */ - Team_RED = 6, - /* TODO: REPLACE */ - Team_MAROON = 7, - /* TODO: REPLACE */ - Team_PURPLE = 8, - /* TODO: REPLACE */ - Team_DARK_BLUE = 9, - /* TODO: REPLACE */ - Team_BLUE = 10, - /* TODO: REPLACE */ - Team_TEAL = 11, - /* TODO: REPLACE */ - Team_GREEN = 12, - /* TODO: REPLACE */ - Team_DARK_GREEN = 13, - /* TODO: REPLACE */ - Team_BROWN = 14 -} Team; - /* Shared constants between device and phone */ typedef enum _Constants { /* First enum must be zero, and we are just using this enum to @@ -164,18 +129,17 @@ typedef enum _Position_LocSource { Position_LocSource_LOCSRC_GPS_EXTERNAL = 3 } Position_LocSource; -/* The team colors are based on the names of "friendly teams" in ATAK: - https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/atak/ATAK/app/src/main/assets/filters/team_filters.xml */ +/* Shared constants between device and phone */ typedef enum _Position_AltSource { - /* the default (unset) is "achromatic" (unaffiliated) */ + /* First enum must be zero, and we are just using this enum to + pass int constants between two very different environments */ Position_AltSource_ALTSRC_UNSPECIFIED = 0, - /* TODO: REPLACE */ + /* From mesh.options + note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is + outside of this envelope */ Position_AltSource_ALTSRC_MANUAL_ENTRY = 1, - /* TODO: REPLACE */ Position_AltSource_ALTSRC_GPS_INTERNAL = 2, - /* TODO: REPLACE */ Position_AltSource_ALTSRC_GPS_EXTERNAL = 3, - /* TODO: REPLACE */ Position_AltSource_ALTSRC_BAROMETRIC = 4 } Position_AltSource; @@ -232,14 +196,15 @@ typedef enum _MeshPacket_Priority { MeshPacket_Priority_MAX = 127 } MeshPacket_Priority; -/* The team colors are based on the names of "friendly teams" in ATAK: - https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/atak/ATAK/app/src/main/assets/filters/team_filters.xml */ +/* Shared constants between device and phone */ typedef enum _MeshPacket_Delayed { - /* the default (unset) is "achromatic" (unaffiliated) */ + /* First enum must be zero, and we are just using this enum to + pass int constants between two very different environments */ MeshPacket_Delayed_NO_DELAY = 0, - /* TODO: REPLACE */ + /* From mesh.options + note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is + outside of this envelope */ MeshPacket_Delayed_DELAYED_BROADCAST = 1, - /* TODO: REPLACE */ MeshPacket_Delayed_DELAYED_DIRECT = 2 } MeshPacket_Delayed; @@ -480,12 +445,6 @@ typedef struct _User { If this user is a licensed operator, set this flag. Also, "long_name" should be their licence number. */ bool is_licensed; - /* Participants in the same network can self-group into different teams. - Short-term this can be used to visually differentiate them on the map; - in the longer term it could also help users to semi-automatically - select or ignore messages according to team affiliation. - In total, 14 teams are defined (encoded in 4 bits) */ - Team team; /* Transmit power at antenna connector, in decibel-milliwatt An optional self-reported value useful in network planning, discovery and positioning - along with ant_gain_dbi and ant_azimuth below */ @@ -697,10 +656,6 @@ typedef struct _ToRadio { #define _HardwareModel_MAX HardwareModel_PRIVATE_HW #define _HardwareModel_ARRAYSIZE ((HardwareModel)(HardwareModel_PRIVATE_HW+1)) -#define _Team_MIN Team_CLEAR -#define _Team_MAX Team_BROWN -#define _Team_ARRAYSIZE ((Team)(Team_BROWN+1)) - #define _Constants_MIN Constants_Unused #define _Constants_MAX Constants_DATA_PAYLOAD_LEN #define _Constants_ARRAYSIZE ((Constants)(Constants_DATA_PAYLOAD_LEN+1)) @@ -740,7 +695,7 @@ extern "C" { /* Initializer values for message structs */ #define Position_init_default {0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -#define User_init_default {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0} +#define User_init_default {"", "", "", {0}, _HardwareModel_MIN, 0, 0, 0, 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, 0, 0, 0, false, Location_init_default} @@ -753,7 +708,7 @@ extern "C" { #define ToRadio_init_default {0, {MeshPacket_init_default}} #define ToRadio_PeerInfo_init_default {0, 0} #define Position_init_zero {0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -#define User_init_zero {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0} +#define User_init_zero {"", "", "", {0}, _HardwareModel_MIN, 0, 0, 0, 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, 0, 0, 0, false, Location_init_zero} @@ -824,7 +779,6 @@ extern "C" { #define User_macaddr_tag 4 #define User_hw_model_tag 6 #define User_is_licensed_tag 7 -#define User_team_tag 8 #define User_tx_power_dbm_tag 10 #define User_ant_gain_dbi_tag 11 #define User_ant_azimuth_tag 12 @@ -906,7 +860,6 @@ 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, BOOL, is_licensed, 7) \ -X(a, STATIC, SINGULAR, UENUM, team, 8) \ X(a, STATIC, SINGULAR, UINT32, tx_power_dbm, 10) \ X(a, STATIC, SINGULAR, UINT32, ant_gain_dbi, 11) \ X(a, STATIC, SINGULAR, UINT32, ant_azimuth, 12) @@ -1078,13 +1031,13 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg; #define LogRecord_size 81 #define MeshPacket_size 347 #define MyNodeInfo_size 210 -#define NodeInfo_size 283 +#define NodeInfo_size 281 #define Position_size 142 #define RouteDiscovery_size 40 #define Routing_size 42 #define ToRadio_PeerInfo_size 8 #define ToRadio_size 350 -#define User_size 97 +#define User_size 95 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 9d5e161c..67215e79 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -277,11 +277,6 @@ void AdminModule::handleSetOwner(const User &o) owner.is_licensed = o.is_licensed; } - if ((!changed || o.team) && (owner.team != o.team)) { - changed = 1; - owner.team = o.team; - } - if (changed) // If nothing really changed, don't broadcast on the network or write to flash service.reloadOwner(); }