From 4d8c0c11dc472b282f5bd323e54d5061e52fc958 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Mon, 28 Feb 2022 22:44:51 -0800 Subject: [PATCH] Added router to mynodeinfo --- src/mesh/FloodingRouter.h | 6 ++++++ src/mesh/generated/deviceonly.pb.h | 2 +- src/mesh/generated/mesh.pb.h | 33 ++++++++++++++++++++++-------- src/mesh/generated/portnums.pb.h | 1 - 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/mesh/FloodingRouter.h b/src/mesh/FloodingRouter.h index 387b4576b..2fae67666 100644 --- a/src/mesh/FloodingRouter.h +++ b/src/mesh/FloodingRouter.h @@ -52,6 +52,12 @@ class FloodingRouter : public Router, protected PacketHistory */ virtual bool shouldFilterReceived(MeshPacket *p) override; + /** + * Are we in range of a router? + * @return true if we're in range of a router + */ + virtual bool rangeOfRouter(const MeshPacket *p); + /** * Look for broadcasts we need to rebroadcast */ diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index c6d468adc..75dd95bef 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -87,7 +87,7 @@ extern const pb_msgdesc_t ChannelFile_msg; #define ChannelFile_fields &ChannelFile_msg /* Maximum encoded size of messages (where known) */ -#define DeviceState_size 9973 +#define DeviceState_size 10109 #define ChannelFile_size 832 #ifdef __cplusplus diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 8e98195ed..1bc2d32ac 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -169,6 +169,12 @@ typedef struct _MyNodeInfo { bool has_wifi; float channel_utilization; float air_util_tx; + pb_size_t router_count; + uint32_t router[4]; + pb_size_t router_snr_count; + float router_snr[4]; + pb_size_t router_sec_count; + uint16_t router_sec[4]; } MyNodeInfo; typedef struct _Position { @@ -176,6 +182,7 @@ typedef struct _Position { int32_t longitude_i; int32_t altitude; int32_t battery_level; + bool router_heartbeat; uint32_t time; Position_LocSource location_source; Position_AltSource altitude_source; @@ -330,26 +337,26 @@ extern "C" { #endif /* Initializer values for message structs */ -#define Position_init_default {0, 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 Position_init_default {0, 0, 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 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} #define MeshPacket_init_default {0, 0, 0, 0, {Data_init_default}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN} #define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0} -#define MyNodeInfo_init_default {0, 0, "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0} +#define MyNodeInfo_init_default {0, 0, "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, {0, 0, 0, 0}, 0, {0, 0, 0, 0}, 0, {0, 0, 0, 0}} #define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN} #define FromRadio_init_default {0, 0, {MyNodeInfo_init_default}} #define ToRadio_init_default {0, {MeshPacket_init_default}} #define ToRadio_PeerInfo_init_default {0, 0} -#define Position_init_zero {0, 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 Position_init_zero {0, 0, 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 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} #define MeshPacket_init_zero {0, 0, 0, 0, {Data_init_zero}, 0, 0, 0, 0, 0, _MeshPacket_Priority_MIN, 0, _MeshPacket_Delayed_MIN} #define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0} -#define MyNodeInfo_init_zero {0, 0, "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0} +#define MyNodeInfo_init_zero {0, 0, "", "", _CriticalErrorCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, {0, 0, 0, 0}, 0, {0, 0, 0, 0}, 0, {0, 0, 0, 0}} #define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN} #define FromRadio_init_zero {0, 0, {MyNodeInfo_init_zero}} #define ToRadio_init_zero {0, {MeshPacket_init_zero}} @@ -385,10 +392,14 @@ extern "C" { #define MyNodeInfo_has_wifi_tag 18 #define MyNodeInfo_channel_utilization_tag 19 #define MyNodeInfo_air_util_tx_tag 20 +#define MyNodeInfo_router_tag 21 +#define MyNodeInfo_router_snr_tag 22 +#define MyNodeInfo_router_sec_tag 23 #define Position_latitude_i_tag 1 #define Position_longitude_i_tag 2 #define Position_altitude_tag 3 #define Position_battery_level_tag 4 +#define Position_router_heartbeat_tag 5 #define Position_time_tag 9 #define Position_location_source_tag 10 #define Position_altitude_source_tag 11 @@ -460,6 +471,7 @@ X(a, STATIC, SINGULAR, SFIXED32, latitude_i, 1) \ X(a, STATIC, SINGULAR, SFIXED32, longitude_i, 2) \ X(a, STATIC, SINGULAR, INT32, altitude, 3) \ X(a, STATIC, SINGULAR, INT32, battery_level, 4) \ +X(a, STATIC, SINGULAR, BOOL, router_heartbeat, 5) \ X(a, STATIC, SINGULAR, FIXED32, time, 9) \ X(a, STATIC, SINGULAR, UENUM, location_source, 10) \ X(a, STATIC, SINGULAR, UENUM, altitude_source, 11) \ @@ -568,7 +580,10 @@ X(a, STATIC, REPEATED, UINT32, air_period_tx, 16) \ X(a, STATIC, REPEATED, UINT32, air_period_rx, 17) \ X(a, STATIC, SINGULAR, BOOL, has_wifi, 18) \ X(a, STATIC, SINGULAR, FLOAT, channel_utilization, 19) \ -X(a, STATIC, SINGULAR, FLOAT, air_util_tx, 20) +X(a, STATIC, SINGULAR, FLOAT, air_util_tx, 20) \ +X(a, STATIC, REPEATED, UINT32, router, 21) \ +X(a, STATIC, REPEATED, FLOAT, router_snr, 22) \ +X(a, STATIC, REPEATED, UINT32, router_sec, 23) #define MyNodeInfo_CALLBACK NULL #define MyNodeInfo_DEFAULT NULL @@ -639,16 +654,16 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg; #define ToRadio_PeerInfo_fields &ToRadio_PeerInfo_msg /* Maximum encoded size of messages (where known) */ -#define Position_size 153 +#define Position_size 155 #define User_size 97 #define RouteDiscovery_size 40 #define Routing_size 42 #define Data_size 267 #define MeshPacket_size 318 -#define NodeInfo_size 271 -#define MyNodeInfo_size 434 +#define NodeInfo_size 273 +#define MyNodeInfo_size 506 #define LogRecord_size 81 -#define FromRadio_size 443 +#define FromRadio_size 515 #define ToRadio_size 321 #define ToRadio_PeerInfo_size 8 diff --git a/src/mesh/generated/portnums.pb.h b/src/mesh/generated/portnums.pb.h index 9b70f80ce..0ba48d592 100644 --- a/src/mesh/generated/portnums.pb.h +++ b/src/mesh/generated/portnums.pb.h @@ -20,7 +20,6 @@ typedef enum _PortNum { PortNum_ADMIN_APP = 6, PortNum_REPLY_APP = 32, PortNum_IP_TUNNEL_APP = 33, - PortNum_ROUTER_APP = 34, PortNum_SERIAL_APP = 64, PortNum_STORE_FORWARD_APP = 65, PortNum_RANGE_TEST_APP = 66,