From 2ad37e2126d9e808361bfa950919c74379947c04 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Wed, 8 Dec 2021 17:13:34 -0800 Subject: [PATCH 1/5] updating proto submodule to latest --- proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto b/proto index a05411df..f9fed7a6 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit a05411df398d67aee668c366233ddfb88307698a +Subproject commit f9fed7a630bb47505ce2645ab875859b5e554ab2 From 61bc0e09e72caef9d17cbc5e184926ec1920143e Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Wed, 8 Dec 2021 18:39:12 -0800 Subject: [PATCH 2/5] updating proto submodule to latest --- proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto b/proto index f9fed7a6..48d57bbe 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit f9fed7a630bb47505ce2645ab875859b5e554ab2 +Subproject commit 48d57bbeeeac612e465bf21cf5b7e3c6cc73828a From a96dee5beb5f55eaba5dc50461d94b88847363f2 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Wed, 8 Dec 2021 23:15:08 -0800 Subject: [PATCH 3/5] updating proto submodule to latest --- proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto b/proto index 48d57bbe..c5903933 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 48d57bbeeeac612e465bf21cf5b7e3c6cc73828a +Subproject commit c59039333578cb339932697961cebd947f807268 From 1156a3406e9633def9d526cce3a9b384b6942eae Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Thu, 9 Dec 2021 11:23:24 -0800 Subject: [PATCH 4/5] updating proto submodule to latest --- proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto b/proto index c5903933..10e6857b 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit c59039333578cb339932697961cebd947f807268 +Subproject commit 10e6857b1bd4a03ec16ec5cbaadf4f28293ab9a5 From 3d4e4bfa5010bdf07e4daa345a2d613e178ab978 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Thu, 9 Dec 2021 11:47:42 -0800 Subject: [PATCH 5/5] Update generated protos & has_wifi #979 https://github.com/meshtastic/Meshtastic-device/issues/979 --- src/mesh/NodeDB.cpp | 4 + src/mesh/generated/admin.pb.h | 9 ++- src/mesh/generated/deviceonly.pb.h | 2 +- src/mesh/generated/mesh.pb.h | 13 +-- src/mesh/generated/storeforward.pb.c | 3 + src/mesh/generated/storeforward.pb.h | 114 +++++++++++++++++---------- 6 files changed, 95 insertions(+), 50 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index 6f1d26f6..c6f872b8 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -245,6 +245,10 @@ void NodeDB::init() preferences.end(); DEBUG_MSG("Number of Device Reboots: %d\n", myNodeInfo.reboot_count); + /* The ESP32 has a wifi radio. This will need to be modified at some point so + * the test isn't so simplistic. + */ + myNodeInfo.has_wifi = true; #endif resetRadioConfig(); // If bogus settings got saved, then fix them diff --git a/src/mesh/generated/admin.pb.h b/src/mesh/generated/admin.pb.h index 550a00b9..670978a0 100644 --- a/src/mesh/generated/admin.pb.h +++ b/src/mesh/generated/admin.pb.h @@ -5,8 +5,8 @@ #define PB_ADMIN_PB_H_INCLUDED #include #include "channel.pb.h" -#include "mesh.pb.h" #include "radioconfig.pb.h" +#include "mesh.pb.h" #if PB_PROTO_HEADER_VERSION != 40 #error Regenerate this file with the current version of nanopb generator. @@ -23,6 +23,8 @@ typedef struct _AdminMessage { RadioConfig get_radio_response; uint32_t get_channel_request; Channel get_channel_response; + bool get_owner_request; + User get_owner_response; bool confirm_set_channel; bool confirm_set_radio; bool exit_simulator; @@ -47,6 +49,8 @@ extern "C" { #define AdminMessage_get_radio_response_tag 5 #define AdminMessage_get_channel_request_tag 6 #define AdminMessage_get_channel_response_tag 7 +#define AdminMessage_get_owner_request_tag 8 +#define AdminMessage_get_owner_response_tag 9 #define AdminMessage_confirm_set_channel_tag 32 #define AdminMessage_confirm_set_radio_tag 33 #define AdminMessage_exit_simulator_tag 34 @@ -61,6 +65,8 @@ X(a, STATIC, ONEOF, BOOL, (variant,get_radio_request,get_radio_request) X(a, STATIC, ONEOF, MESSAGE, (variant,get_radio_response,get_radio_response), 5) \ X(a, STATIC, ONEOF, UINT32, (variant,get_channel_request,get_channel_request), 6) \ X(a, STATIC, ONEOF, MESSAGE, (variant,get_channel_response,get_channel_response), 7) \ +X(a, STATIC, ONEOF, BOOL, (variant,get_owner_request,get_owner_request), 8) \ +X(a, STATIC, ONEOF, MESSAGE, (variant,get_owner_response,get_owner_response), 9) \ 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) \ @@ -72,6 +78,7 @@ X(a, STATIC, ONEOF, INT32, (variant,reboot_seconds,reboot_seconds), 35) #define AdminMessage_variant_set_channel_MSGTYPE Channel #define AdminMessage_variant_get_radio_response_MSGTYPE RadioConfig #define AdminMessage_variant_get_channel_response_MSGTYPE Channel +#define AdminMessage_variant_get_owner_response_MSGTYPE User extern const pb_msgdesc_t AdminMessage_msg; diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index 46fdcac7..c87d9d81 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 9936 +#define DeviceState_size 9939 #define ChannelFile_size 832 #ifdef __cplusplus diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 8defe625..21be09fd 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -157,6 +157,7 @@ typedef struct _MyNodeInfo { uint32_t air_period_tx[24]; pb_size_t air_period_rx_count; uint32_t air_period_rx[24]; + bool has_wifi; } MyNodeInfo; typedef struct _Position { @@ -320,7 +321,7 @@ extern "C" { #define Data_init_default {_PortNum_MIN, {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} #define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0} -#define MyNodeInfo_init_default {0, 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}} +#define MyNodeInfo_init_default {0, 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} #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}} @@ -332,7 +333,7 @@ extern "C" { #define Data_init_zero {_PortNum_MIN, {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} #define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0} -#define MyNodeInfo_init_zero {0, 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}} +#define MyNodeInfo_init_zero {0, 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} #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}} @@ -365,6 +366,7 @@ extern "C" { #define MyNodeInfo_max_channels_tag 15 #define MyNodeInfo_air_period_tx_tag 16 #define MyNodeInfo_air_period_rx_tag 17 +#define MyNodeInfo_has_wifi_tag 18 #define Position_latitude_i_tag 1 #define Position_longitude_i_tag 2 #define Position_altitude_tag 3 @@ -543,7 +545,8 @@ X(a, STATIC, SINGULAR, UINT32, message_timeout_msec, 13) \ X(a, STATIC, SINGULAR, UINT32, min_app_version, 14) \ X(a, STATIC, SINGULAR, UINT32, max_channels, 15) \ X(a, STATIC, REPEATED, UINT32, air_period_tx, 16) \ -X(a, STATIC, REPEATED, UINT32, air_period_rx, 17) +X(a, STATIC, REPEATED, UINT32, air_period_rx, 17) \ +X(a, STATIC, SINGULAR, BOOL, has_wifi, 18) #define MyNodeInfo_CALLBACK NULL #define MyNodeInfo_DEFAULT NULL @@ -621,9 +624,9 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg; #define Data_size 260 #define MeshPacket_size 309 #define NodeInfo_size 270 -#define MyNodeInfo_size 442 +#define MyNodeInfo_size 445 #define LogRecord_size 81 -#define FromRadio_size 451 +#define FromRadio_size 454 #define ToRadio_size 312 #define ToRadio_PeerInfo_size 8 diff --git a/src/mesh/generated/storeforward.pb.c b/src/mesh/generated/storeforward.pb.c index 5cca6d04..51f7c3b9 100644 --- a/src/mesh/generated/storeforward.pb.c +++ b/src/mesh/generated/storeforward.pb.c @@ -15,5 +15,8 @@ PB_BIND(StoreAndForward_Statistics, StoreAndForward_Statistics, AUTO) PB_BIND(StoreAndForward_History, StoreAndForward_History, AUTO) +PB_BIND(StoreAndForward_Heartbeat, StoreAndForward_Heartbeat, AUTO) + + diff --git a/src/mesh/generated/storeforward.pb.h b/src/mesh/generated/storeforward.pb.h index 76ca4187..9c346cd9 100644 --- a/src/mesh/generated/storeforward.pb.h +++ b/src/mesh/generated/storeforward.pb.h @@ -17,29 +17,37 @@ typedef enum _StoreAndForward_RequestResponse { StoreAndForward_RequestResponse_ROUTER_PING = 3, StoreAndForward_RequestResponse_ROUTER_PONG = 4, StoreAndForward_RequestResponse_ROUTER_BUSY = 5, + StoreAndForward_RequestResponse_ROUTER_HISTORY = 6, StoreAndForward_RequestResponse_CLIENT_ERROR = 101, StoreAndForward_RequestResponse_CLIENT_HISTORY = 102, StoreAndForward_RequestResponse_CLIENT_STATS = 103, StoreAndForward_RequestResponse_CLIENT_PING = 104, - StoreAndForward_RequestResponse_CLIENT_PONG = 105 + StoreAndForward_RequestResponse_CLIENT_PONG = 105, + StoreAndForward_RequestResponse_CLIENT_ABORT = 106 } StoreAndForward_RequestResponse; /* Struct definitions */ +typedef struct _StoreAndForward_Heartbeat { + uint32_t period; + uint32_t secondary; +} StoreAndForward_Heartbeat; + typedef struct _StoreAndForward_History { - uint32_t HistoryMessages; - uint32_t Window; + uint32_t history_messages; + uint32_t window; + uint32_t last_request; } StoreAndForward_History; typedef struct _StoreAndForward_Statistics { - uint32_t MessagesTotal; - uint32_t MessagesSaved; - uint32_t MessagesMax; - uint32_t UpTime; - uint32_t Requests; - uint32_t RequestsHistory; - bool Heartbeat; - uint32_t ReturnMax; - uint32_t ReturnWindow; + uint32_t messages_total; + uint32_t messages_saved; + uint32_t messages_max; + uint32_t up_time; + uint32_t requests; + uint32_t requests_history; + bool heartbeat; + uint32_t return_max; + uint32_t return_window; } StoreAndForward_Statistics; typedef struct _StoreAndForward { @@ -48,13 +56,15 @@ typedef struct _StoreAndForward { StoreAndForward_Statistics stats; bool has_history; StoreAndForward_History history; + bool has_heartbeat; + StoreAndForward_Heartbeat heartbeat; } StoreAndForward; /* Helper constants for enums */ #define _StoreAndForward_RequestResponse_MIN StoreAndForward_RequestResponse_UNSET -#define _StoreAndForward_RequestResponse_MAX StoreAndForward_RequestResponse_CLIENT_PONG -#define _StoreAndForward_RequestResponse_ARRAYSIZE ((StoreAndForward_RequestResponse)(StoreAndForward_RequestResponse_CLIENT_PONG+1)) +#define _StoreAndForward_RequestResponse_MAX StoreAndForward_RequestResponse_CLIENT_ABORT +#define _StoreAndForward_RequestResponse_ARRAYSIZE ((StoreAndForward_RequestResponse)(StoreAndForward_RequestResponse_CLIENT_ABORT+1)) #ifdef __cplusplus @@ -62,71 +72,89 @@ extern "C" { #endif /* Initializer values for message structs */ -#define StoreAndForward_init_default {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_default, false, StoreAndForward_History_init_default} +#define StoreAndForward_init_default {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_default, false, StoreAndForward_History_init_default, false, StoreAndForward_Heartbeat_init_default} #define StoreAndForward_Statistics_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define StoreAndForward_History_init_default {0, 0} -#define StoreAndForward_init_zero {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_zero, false, StoreAndForward_History_init_zero} +#define StoreAndForward_History_init_default {0, 0, 0} +#define StoreAndForward_Heartbeat_init_default {0, 0} +#define StoreAndForward_init_zero {_StoreAndForward_RequestResponse_MIN, false, StoreAndForward_Statistics_init_zero, false, StoreAndForward_History_init_zero, false, StoreAndForward_Heartbeat_init_zero} #define StoreAndForward_Statistics_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0} -#define StoreAndForward_History_init_zero {0, 0} +#define StoreAndForward_History_init_zero {0, 0, 0} +#define StoreAndForward_Heartbeat_init_zero {0, 0} /* Field tags (for use in manual encoding/decoding) */ -#define StoreAndForward_History_HistoryMessages_tag 1 -#define StoreAndForward_History_Window_tag 2 -#define StoreAndForward_Statistics_MessagesTotal_tag 1 -#define StoreAndForward_Statistics_MessagesSaved_tag 2 -#define StoreAndForward_Statistics_MessagesMax_tag 3 -#define StoreAndForward_Statistics_UpTime_tag 4 -#define StoreAndForward_Statistics_Requests_tag 5 -#define StoreAndForward_Statistics_RequestsHistory_tag 6 -#define StoreAndForward_Statistics_Heartbeat_tag 7 -#define StoreAndForward_Statistics_ReturnMax_tag 8 -#define StoreAndForward_Statistics_ReturnWindow_tag 9 +#define StoreAndForward_Heartbeat_period_tag 1 +#define StoreAndForward_Heartbeat_secondary_tag 2 +#define StoreAndForward_History_history_messages_tag 1 +#define StoreAndForward_History_window_tag 2 +#define StoreAndForward_History_last_request_tag 3 +#define StoreAndForward_Statistics_messages_total_tag 1 +#define StoreAndForward_Statistics_messages_saved_tag 2 +#define StoreAndForward_Statistics_messages_max_tag 3 +#define StoreAndForward_Statistics_up_time_tag 4 +#define StoreAndForward_Statistics_requests_tag 5 +#define StoreAndForward_Statistics_requests_history_tag 6 +#define StoreAndForward_Statistics_heartbeat_tag 7 +#define StoreAndForward_Statistics_return_max_tag 8 +#define StoreAndForward_Statistics_return_window_tag 9 #define StoreAndForward_rr_tag 1 #define StoreAndForward_stats_tag 2 #define StoreAndForward_history_tag 3 +#define StoreAndForward_heartbeat_tag 4 /* Struct field encoding specification for nanopb */ #define StoreAndForward_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UENUM, rr, 1) \ X(a, STATIC, OPTIONAL, MESSAGE, stats, 2) \ -X(a, STATIC, OPTIONAL, MESSAGE, history, 3) +X(a, STATIC, OPTIONAL, MESSAGE, history, 3) \ +X(a, STATIC, OPTIONAL, MESSAGE, heartbeat, 4) #define StoreAndForward_CALLBACK NULL #define StoreAndForward_DEFAULT NULL #define StoreAndForward_stats_MSGTYPE StoreAndForward_Statistics #define StoreAndForward_history_MSGTYPE StoreAndForward_History +#define StoreAndForward_heartbeat_MSGTYPE StoreAndForward_Heartbeat #define StoreAndForward_Statistics_FIELDLIST(X, a) \ -X(a, STATIC, SINGULAR, UINT32, MessagesTotal, 1) \ -X(a, STATIC, SINGULAR, UINT32, MessagesSaved, 2) \ -X(a, STATIC, SINGULAR, UINT32, MessagesMax, 3) \ -X(a, STATIC, SINGULAR, UINT32, UpTime, 4) \ -X(a, STATIC, SINGULAR, UINT32, Requests, 5) \ -X(a, STATIC, SINGULAR, UINT32, RequestsHistory, 6) \ -X(a, STATIC, SINGULAR, BOOL, Heartbeat, 7) \ -X(a, STATIC, SINGULAR, UINT32, ReturnMax, 8) \ -X(a, STATIC, SINGULAR, UINT32, ReturnWindow, 9) +X(a, STATIC, SINGULAR, UINT32, messages_total, 1) \ +X(a, STATIC, SINGULAR, UINT32, messages_saved, 2) \ +X(a, STATIC, SINGULAR, UINT32, messages_max, 3) \ +X(a, STATIC, SINGULAR, UINT32, up_time, 4) \ +X(a, STATIC, SINGULAR, UINT32, requests, 5) \ +X(a, STATIC, SINGULAR, UINT32, requests_history, 6) \ +X(a, STATIC, SINGULAR, BOOL, heartbeat, 7) \ +X(a, STATIC, SINGULAR, UINT32, return_max, 8) \ +X(a, STATIC, SINGULAR, UINT32, return_window, 9) #define StoreAndForward_Statistics_CALLBACK NULL #define StoreAndForward_Statistics_DEFAULT NULL #define StoreAndForward_History_FIELDLIST(X, a) \ -X(a, STATIC, SINGULAR, UINT32, HistoryMessages, 1) \ -X(a, STATIC, SINGULAR, UINT32, Window, 2) +X(a, STATIC, SINGULAR, UINT32, history_messages, 1) \ +X(a, STATIC, SINGULAR, UINT32, window, 2) \ +X(a, STATIC, SINGULAR, UINT32, last_request, 3) #define StoreAndForward_History_CALLBACK NULL #define StoreAndForward_History_DEFAULT NULL +#define StoreAndForward_Heartbeat_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT32, period, 1) \ +X(a, STATIC, SINGULAR, UINT32, secondary, 2) +#define StoreAndForward_Heartbeat_CALLBACK NULL +#define StoreAndForward_Heartbeat_DEFAULT NULL + extern const pb_msgdesc_t StoreAndForward_msg; extern const pb_msgdesc_t StoreAndForward_Statistics_msg; extern const pb_msgdesc_t StoreAndForward_History_msg; +extern const pb_msgdesc_t StoreAndForward_Heartbeat_msg; /* Defines for backwards compatibility with code written before nanopb-0.4.0 */ #define StoreAndForward_fields &StoreAndForward_msg #define StoreAndForward_Statistics_fields &StoreAndForward_Statistics_msg #define StoreAndForward_History_fields &StoreAndForward_History_msg +#define StoreAndForward_Heartbeat_fields &StoreAndForward_Heartbeat_msg /* Maximum encoded size of messages (where known) */ -#define StoreAndForward_size 68 +#define StoreAndForward_size 88 #define StoreAndForward_Statistics_size 50 -#define StoreAndForward_History_size 12 +#define StoreAndForward_History_size 18 +#define StoreAndForward_Heartbeat_size 12 #ifdef __cplusplus } /* extern "C" */