From ccb232b6accfdc2c36bdf4b10b25864d959b9be1 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 7 Feb 2021 09:46:35 +0800 Subject: [PATCH 1/7] make route errors a more general 'message delivery failure' reason in support of https://github.com/meshtastic/Meshtastic-device/issues/677 --- proto | 2 +- src/mesh/DSRRouter.cpp | 8 ++++---- src/mesh/DSRRouter.h | 2 +- src/mesh/generated/mesh.pb.h | 25 +++++++++++++------------ src/mesh/generated/portnums.pb.h | 2 +- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/proto b/proto index c9ad10d7..1813b370 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit c9ad10d7e2f7f465dc477e98d6ec9d3b7059336c +Subproject commit 1813b370ab5336fc3ba453fa92206f4941eda96b diff --git a/src/mesh/DSRRouter.cpp b/src/mesh/DSRRouter.cpp index d8ca542d..ad41afdd 100644 --- a/src/mesh/DSRRouter.cpp +++ b/src/mesh/DSRRouter.cpp @@ -105,7 +105,7 @@ void DSRRouter::sniffReceived(const MeshPacket *p) // packets until ack arrives) // FIXME, if we don't get a route reply at all (or a route error), timeout and generate a routeerror TIMEOUT on our own... break; - case SubPacket_route_error_tag: + case SubPacket_error_reason_tag: removeRoute(p->decoded.dest); // FIXME: if any pending packets were waiting on this route, delete them @@ -131,7 +131,7 @@ void DSRRouter::sniffReceived(const MeshPacket *p) assert(p->decoded.source); // I think this is guaranteed by now // FIXME - what if the current packet _is_ a route error packet? - sendRouteError(p, RouteError_NO_ROUTE); + sendRouteError(p, ErrorReason_NO_ROUTE); } // FIXME, stop local processing of this packet @@ -145,7 +145,7 @@ void DSRRouter::sniffReceived(const MeshPacket *p) if (pending && pending->packet->decoded.source) { // if source not set, this was not a multihop packet, just ignore removeRoute(pending->packet->decoded.dest); // We no longer have a route to the specified node - sendRouteError(p, RouteError_GOT_NAK); + sendRouteError(p, ErrorReason_GOT_NAK); } } } @@ -230,7 +230,7 @@ void DSRRouter::sendNextHop(NodeNum n, const MeshPacket *p) /** * Send a route error packet towards whoever originally sent this message */ -void DSRRouter::sendRouteError(const MeshPacket *p, RouteError err) +void DSRRouter::sendRouteError(const MeshPacket *p, ErrorReason err) { DEBUG_MSG("FIXME not implemented sendRouteError\n"); } diff --git a/src/mesh/DSRRouter.h b/src/mesh/DSRRouter.h index 3bc46157..02c0f277 100644 --- a/src/mesh/DSRRouter.h +++ b/src/mesh/DSRRouter.h @@ -70,7 +70,7 @@ class DSRRouter : public ReliableRouter /** * Send a route error packet towards whoever originally sent this message */ - void sendRouteError(const MeshPacket *p, RouteError err); + void sendRouteError(const MeshPacket *p, ErrorReason err); /** make a copy of p, start discovery, but only if we don't * already a discovery in progress for that node number. Caller has already scheduled this message for retransmission diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index a13d7de5..3f1b24c2 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -11,12 +11,13 @@ #endif /* Enum definitions */ -typedef enum _RouteError { - RouteError_NONE = 0, - RouteError_NO_ROUTE = 1, - RouteError_GOT_NAK = 2, - RouteError_TIMEOUT = 3 -} RouteError; +typedef enum _ErrorReason { + ErrorReason_NONE = 0, + ErrorReason_NO_ROUTE = 1, + ErrorReason_GOT_NAK = 2, + ErrorReason_TIMEOUT = 3, + ErrorReason_NO_INTERFACE = 4 +} ErrorReason; typedef enum _Constants { Constants_Unused = 0, @@ -230,7 +231,7 @@ typedef struct _SubPacket { User user; RouteDiscovery route_request; RouteDiscovery route_reply; - RouteError route_error; + ErrorReason error_reason; }; uint32_t original_id; bool want_response; @@ -288,9 +289,9 @@ typedef struct _ToRadio { /* Helper constants for enums */ -#define _RouteError_MIN RouteError_NONE -#define _RouteError_MAX RouteError_TIMEOUT -#define _RouteError_ARRAYSIZE ((RouteError)(RouteError_TIMEOUT+1)) +#define _ErrorReason_MIN ErrorReason_NONE +#define _ErrorReason_MAX ErrorReason_NO_INTERFACE +#define _ErrorReason_ARRAYSIZE ((ErrorReason)(ErrorReason_NO_INTERFACE+1)) #define _Constants_MIN Constants_Unused #define _Constants_MAX Constants_DATA_PAYLOAD_LEN @@ -450,7 +451,7 @@ extern "C" { #define SubPacket_user_tag 4 #define SubPacket_route_request_tag 6 #define SubPacket_route_reply_tag 7 -#define SubPacket_route_error_tag 13 +#define SubPacket_error_reason_tag 13 #define SubPacket_original_id_tag 2 #define SubPacket_want_response_tag 5 #define SubPacket_dest_tag 9 @@ -517,7 +518,7 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,data,data), 3) \ X(a, STATIC, ONEOF, MESSAGE, (payload,user,user), 4) \ X(a, STATIC, ONEOF, MESSAGE, (payload,route_request,route_request), 6) \ X(a, STATIC, ONEOF, MESSAGE, (payload,route_reply,route_reply), 7) \ -X(a, STATIC, ONEOF, UENUM, (payload,route_error,route_error), 13) \ +X(a, STATIC, ONEOF, UENUM, (payload,error_reason,error_reason), 13) \ X(a, STATIC, SINGULAR, UINT32, original_id, 2) \ X(a, STATIC, SINGULAR, BOOL, want_response, 5) \ X(a, STATIC, SINGULAR, UINT32, dest, 9) \ diff --git a/src/mesh/generated/portnums.pb.h b/src/mesh/generated/portnums.pb.h index 99df1222..15572ca1 100644 --- a/src/mesh/generated/portnums.pb.h +++ b/src/mesh/generated/portnums.pb.h @@ -19,7 +19,7 @@ typedef enum _PortNum { PortNum_REPLY_APP = 32, PortNum_IP_TUNNEL_APP = 33, PortNum_SERIAL_APP = 64, - PortNum_STORE_REQUEST_APP = 65, + PortNum_STORE_FORWARD_APP = 65, PortNum_PRIVATE_APP = 256, PortNum_ATAK_FORWARDER = 257 } PortNum; From 486b03e985f56eb68a60f9b9b53add7c510a4100 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 7 Feb 2021 10:26:11 +0800 Subject: [PATCH 2/7] bug 677. Don't assert fail for missing interfaces, instead return nak packet to clients. --- proto | 2 +- src/main.cpp | 6 ++++ src/mesh/ReliableRouter.cpp | 27 ++--------------- src/mesh/ReliableRouter.h | 4 --- src/mesh/Router.cpp | 59 ++++++++++++++++++++++++++++-------- src/mesh/Router.h | 8 ++++- src/mesh/generated/mesh.pb.h | 7 +++-- 7 files changed, 68 insertions(+), 45 deletions(-) diff --git a/proto b/proto index 1813b370..106f4bfd 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 1813b370ab5336fc3ba453fa92206f4941eda96b +Subproject commit 106f4bfdebe277ab0b86d2b8c950ab78a35b0654 diff --git a/src/main.cpp b/src/main.cpp index aa7b191d..bb3ec482 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -490,6 +490,8 @@ void setup() DEBUG_MSG("Warning: Failed to find RF95 radio\n"); delete rIf; rIf = NULL; + } else { + DEBUG_MSG("Radio init succeeded, using RF95 radio\n"); } } #endif @@ -501,6 +503,8 @@ void setup() DEBUG_MSG("Warning: Failed to find SX1262 radio\n"); delete rIf; rIf = NULL; + } else { + DEBUG_MSG("Radio init succeeded, using SX1262 radio\n"); } } #endif @@ -512,6 +516,8 @@ void setup() DEBUG_MSG("Warning: Failed to find simulated radio\n"); delete rIf; rIf = NULL; + } else { + DEBUG_MSG("Using SIMULATED radio!\n"); } } #endif diff --git a/src/mesh/ReliableRouter.cpp b/src/mesh/ReliableRouter.cpp index 93402c12..6060b1f0 100644 --- a/src/mesh/ReliableRouter.cpp +++ b/src/mesh/ReliableRouter.cpp @@ -34,7 +34,7 @@ bool ReliableRouter::shouldFilterReceived(const MeshPacket *p) // the original sending process. if (stopRetransmission(p->from, p->id)) { DEBUG_MSG("Someone is retransmitting for us, generate implicit ack\n"); - sendAckNak(true, p->from, p->id); + sendAckNak(ErrorReason_NONE, p->from, p->id); } } @@ -60,7 +60,7 @@ void ReliableRouter::sniffReceived(const MeshPacket *p) if (p->to == ourNode) { // ignore ack/nak/want_ack packets that are not address to us (we only handle 0 hop reliability // - not DSR routing) if (p->want_ack) { - sendAckNak(true, p->from, p->id); + sendAckNak(ErrorReason_NONE, p->from, p->id); } // If the payload is valid, look for ack/nak @@ -84,27 +84,6 @@ void ReliableRouter::sniffReceived(const MeshPacket *p) FloodingRouter::sniffReceived(p); } -/** - * Send an ack or a nak packet back towards whoever sent idFrom - */ -void ReliableRouter::sendAckNak(bool isAck, NodeNum to, PacketId idFrom) -{ - auto p = allocForSending(); - p->hop_limit = 0; // Assume just immediate neighbors for now - p->to = to; - DEBUG_MSG("Sending an ack=0x%x,to=0x%x,idFrom=0x%x,id=0x%x\n", isAck, to, idFrom, p->id); - - if (isAck) { - p->decoded.ack.success_id = idFrom; - p->decoded.which_ack = SubPacket_success_id_tag; - } else { - p->decoded.ack.fail_id = idFrom; - p->decoded.which_ack = SubPacket_fail_id_tag; - } - - sendLocal(p); // we sometimes send directly to the local node -} - #define NUM_RETRANSMISSIONS 3 PendingPacket::PendingPacket(MeshPacket *p) @@ -176,7 +155,7 @@ int32_t ReliableRouter::doRetransmissions() if (p.numRetransmissions == 0) { DEBUG_MSG("Reliable send failed, returning a nak fr=0x%x,to=0x%x,id=%d\n", p.packet->from, p.packet->to, p.packet->id); - sendAckNak(false, p.packet->from, p.packet->id); + sendAckNak(ErrorReason_MAX_RETRANSMIT, p.packet->from, p.packet->id); // Note: we don't stop retransmission here, instead the Nak packet gets processed in sniffReceived - which // allows the DSR version to still be able to look at the PendingPacket stopRetransmission(it->first); diff --git a/src/mesh/ReliableRouter.h b/src/mesh/ReliableRouter.h index 91dd248a..62d55538 100644 --- a/src/mesh/ReliableRouter.h +++ b/src/mesh/ReliableRouter.h @@ -109,10 +109,6 @@ class ReliableRouter : public FloodingRouter PendingPacket *startRetransmission(MeshPacket *p); private: - /** - * Send an ack or a nak packet back towards whoever sent idFrom - */ - void sendAckNak(bool isAck, NodeNum to, PacketId idFrom); /** * Stop any retransmissions we are doing of the specified node/packet ID pair diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 458a338f..c3a34552 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -99,6 +99,31 @@ MeshPacket *Router::allocForSending() return p; } +/** + * Send an ack or a nak packet back towards whoever sent idFrom + */ +void Router::sendAckNak(ErrorReason err, NodeNum to, PacketId idFrom) +{ + auto p = allocForSending(); + p->hop_limit = 0; // Assume just immediate neighbors for now + p->to = to; + DEBUG_MSG("Sending an err=%d,to=0x%x,idFrom=0x%x,id=0x%x\n", err, to, idFrom, p->id); + + if (!err) { + p->decoded.ack.success_id = idFrom; + p->decoded.which_ack = SubPacket_success_id_tag; + } else { + p->decoded.ack.fail_id = idFrom; + p->decoded.which_ack = SubPacket_fail_id_tag; + + // Also send back the error reason + p->decoded.which_payload = SubPacket_error_reason_tag; + p->decoded.error_reason = err; + } + + sendLocal(p); // we sometimes send directly to the local node +} + ErrorCode Router::sendLocal(MeshPacket *p) { // No need to deliver externally if the destination is the local node @@ -106,15 +131,24 @@ ErrorCode Router::sendLocal(MeshPacket *p) printPacket("Enqueuing local", p); fromRadioQueue.enqueue(p); return ERRNO_OK; - } + } else if (!iface) { + // We must be sending to remote nodes also, fail if no interface found - // If we are sending a broadcast, we also treat it as if we just received it ourself - // this allows local apps (and PCs) to see broadcasts sourced locally - if (p->to == NODENUM_BROADCAST) { - handleReceived(p); - } + // ERROR! no radio found, report failure back to the client and drop the packet + DEBUG_MSG("Error: No interface, returning NAK and dropping packet.\n"); + sendAckNak(ErrorReason_NO_INTERFACE, p->from, p->id); + packetPool.release(p); - return send(p); + return ERRNO_NO_INTERFACES; + } else { + // If we are sending a broadcast, we also treat it as if we just received it ourself + // this allows local apps (and PCs) to see broadcasts sourced locally + if (p->to == NODENUM_BROADCAST) { + handleReceived(p); + } + + return send(p); + } } /** @@ -154,14 +188,15 @@ ErrorCode Router::send(MeshPacket *p) p->which_payload = MeshPacket_encrypted_tag; } - if (iface) { - // DEBUG_MSG("Sending packet via interface fr=0x%x,to=0x%x,id=%d\n", p->from, p->to, p->id); - return iface->send(p); - } else { + assert(iface); // This should have been detected already in sendLocal (or we just received a packet from outside) + // if (iface) { + // DEBUG_MSG("Sending packet via interface fr=0x%x,to=0x%x,id=%d\n", p->from, p->to, p->id); + return iface->send(p); + /* } else { DEBUG_MSG("Dropping packet - no interfaces - fr=0x%x,to=0x%x,id=%d\n", p->from, p->to, p->id); packetPool.release(p); return ERRNO_NO_INTERFACES; - } + } */ } /** diff --git a/src/mesh/Router.h b/src/mesh/Router.h index 0035f2ac..dfc44dfa 100644 --- a/src/mesh/Router.h +++ b/src/mesh/Router.h @@ -48,7 +48,8 @@ class Router : protected concurrency::OSThread virtual int32_t runOnce(); /** - * Works like send, but if we are sending to the local node, we directly put the message in the receive queue + * Works like send, but if we are sending to the local node, we directly put the message in the receive queue. + * This is the primary method used for sending packets, because it handles both the remote and local cases. * * NOTE: This method will free the provided packet (even if we return an error code) */ @@ -92,6 +93,11 @@ class Router : protected concurrency::OSThread */ bool perhapsDecode(MeshPacket *p); + /** + * Send an ack or a nak packet back towards whoever sent idFrom + */ + void sendAckNak(ErrorReason err, NodeNum to, PacketId idFrom); + private: /** * Called from loop() diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 3f1b24c2..6bf3a1c0 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -16,7 +16,8 @@ typedef enum _ErrorReason { ErrorReason_NO_ROUTE = 1, ErrorReason_GOT_NAK = 2, ErrorReason_TIMEOUT = 3, - ErrorReason_NO_INTERFACE = 4 + ErrorReason_NO_INTERFACE = 4, + ErrorReason_MAX_RETRANSMIT = 5 } ErrorReason; typedef enum _Constants { @@ -290,8 +291,8 @@ typedef struct _ToRadio { /* Helper constants for enums */ #define _ErrorReason_MIN ErrorReason_NONE -#define _ErrorReason_MAX ErrorReason_NO_INTERFACE -#define _ErrorReason_ARRAYSIZE ((ErrorReason)(ErrorReason_NO_INTERFACE+1)) +#define _ErrorReason_MAX ErrorReason_MAX_RETRANSMIT +#define _ErrorReason_ARRAYSIZE ((ErrorReason)(ErrorReason_MAX_RETRANSMIT+1)) #define _Constants_MIN Constants_Unused #define _Constants_MAX Constants_DATA_PAYLOAD_LEN From 55349ea570c9c2c587e238014c3d0e36592a2dc6 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 7 Feb 2021 10:27:04 +0800 Subject: [PATCH 3/7] 1.1.42 --- version.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.properties b/version.properties index dd592ccf..5ff3c45f 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 1 minor = 1 -build = 34 +build = 42 From 86553a4fc9a9a2f6973b6669c3a54cbb03a8376d Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 7 Feb 2021 10:44:31 +0800 Subject: [PATCH 4/7] add libs needed for linux build on CI server --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3f0d994d..1f51272a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,5 +22,8 @@ jobs: - name: Install extra python tools run: | pip install -U adafruit-nrfutil + - name: Install libs needed for linux build + run: | + sudo apt install -y libpsocksxx-dev - name: Build run: platformio run -e tbeam -e heltec -e lora-relay-v1 -e linux From ccf3450864596c647d294845339ac97cea9b6677 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Sun, 7 Feb 2021 10:49:14 +0800 Subject: [PATCH 5/7] make CI build steps more atomic for easier reporting --- .github/workflows/main.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1f51272a..5f17d917 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,5 +25,12 @@ jobs: - name: Install libs needed for linux build run: | sudo apt install -y libpsocksxx-dev - - name: Build - run: platformio run -e tbeam -e heltec -e lora-relay-v1 -e linux + - name: Build for tbeam + run: platformio run -e tbeam + - name: Build for heltec + run: platformio run -e heltec + - name: Build for lora-relay-v1 + run: platformio run -e lora-relay-v1 + - name: Build for linux + run: platformio run -e linux + From 58bb7169a0f87d3c9e4bc9c0068f3b82b62d438c Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Mon, 8 Feb 2021 10:15:02 +0800 Subject: [PATCH 6/7] use nodenum as the default nodeid --- src/mesh/NodeDB.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index ea79e6cc..dc27276a 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -265,16 +265,15 @@ void NodeDB::installDefaultDeviceState() // Init our blank owner info to reasonable defaults getMacAddr(ourMacAddr); - sprintf(owner.id, "!%02x%02x%02x%02x%02x%02x", ourMacAddr[0], ourMacAddr[1], ourMacAddr[2], ourMacAddr[3], ourMacAddr[4], - ourMacAddr[5]); - memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr)); // Set default owner name - pickNewNodeNum(); // Note: we will repick later, just in case the settings are corrupted, but we need a valid - // owner.short_name now + pickNewNodeNum(); // based on macaddr now sprintf(owner.long_name, "Unknown %02x%02x", ourMacAddr[4], ourMacAddr[5]); sprintf(owner.short_name, "?%02X", (unsigned)(myNodeInfo.my_node_num & 0xff)); + sprintf(owner.id, "!%08x", getNodeNum()); // Default node ID now based on nodenum + memcpy(owner.macaddr, ourMacAddr, sizeof(owner.macaddr)); + // Restore region if possible if (oldRegionCode != RegionCode_Unset) radioConfig.preferences.region = oldRegionCode; From 2fa38c7dc4c45cec68eac167cdf278c3de093453 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Mon, 8 Feb 2021 17:57:45 +0800 Subject: [PATCH 7/7] update protos --- platformio.ini | 4 +- proto | 2 +- src/mesh/generated/deviceonly.pb.h | 2 +- src/mesh/generated/mesh.pb.h | 127 ++++++++++++++++------------- src/mesh/generated/portnums.pb.h | 1 + 5 files changed, 76 insertions(+), 60 deletions(-) diff --git a/platformio.ini b/platformio.ini index 9e3b123d..9a0e9f6c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,13 +9,13 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -;default_envs = tbeam +default_envs = tbeam ;default_envs = tbeam0.7 ;default_envs = heltec ;default_envs = tlora-v1 ;default_envs = tlora-v2 ;default_envs = lora-relay-v1 # nrf board -default_envs = linux # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here +;default_envs = linux # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here [common] ; common is not currently used diff --git a/proto b/proto index 106f4bfd..25998410 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 106f4bfdebe277ab0b86d2b8c950ab78a35b0654 +Subproject commit 25998410668a1ff1b092512439ec0e7089f91ce9 diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index a6388af9..fb503be4 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -80,7 +80,7 @@ extern const pb_msgdesc_t DeviceState_msg; #define DeviceState_fields &DeviceState_msg /* Maximum encoded size of messages (where known) */ -#define DeviceState_size 6239 +#define DeviceState_size 6262 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 6bf3a1c0..5968850a 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -193,6 +193,11 @@ typedef struct _RadioConfig_UserPreferences { bool ext_notification_plugin_active; bool ext_notification_plugin_alert_message; bool ext_notification_plugin_alert_bell; + bool range_test_plugin_enabled; + uint32_t range_test_plugin_sender; + bool range_test_plugin_save; + bool store_forward_plugin_enabled; + uint32_t store_forward_plugin_records; } RadioConfig_UserPreferences; typedef struct _RouteDiscovery { @@ -225,7 +230,7 @@ typedef struct _RadioConfig { } RadioConfig; typedef struct _SubPacket { - pb_size_t which_payload; + pb_size_t which_payloadVariant; union { Position position; Data data; @@ -233,15 +238,15 @@ typedef struct _SubPacket { RouteDiscovery route_request; RouteDiscovery route_reply; ErrorReason error_reason; - }; + } payloadVariant; uint32_t original_id; bool want_response; uint32_t dest; - pb_size_t which_ack; + pb_size_t which_ackVariant; union { uint32_t success_id; uint32_t fail_id; - } ack; + } ackVariant; uint32_t source; } SubPacket; @@ -249,11 +254,11 @@ typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t; typedef struct _MeshPacket { uint32_t from; uint32_t to; - pb_size_t which_payload; + pb_size_t which_payloadVariant; union { SubPacket decoded; MeshPacket_encrypted_t encrypted; - }; + } payloadVariant; uint32_t channel_index; uint32_t id; float rx_snr; @@ -264,7 +269,7 @@ typedef struct _MeshPacket { typedef struct _FromRadio { uint32_t num; - pb_size_t which_variant; + pb_size_t which_payloadVariant; union { MeshPacket packet; MyNodeInfo my_info; @@ -274,18 +279,18 @@ typedef struct _FromRadio { uint32_t config_complete_id; bool rebooted; ChannelSettings channel; - } variant; + } payloadVariant; } FromRadio; typedef struct _ToRadio { - pb_size_t which_variant; + pb_size_t which_payloadVariant; union { MeshPacket packet; uint32_t want_config_id; RadioConfig set_radio; User set_owner; ChannelSettings set_channel; - } variant; + } payloadVariant; } ToRadio; @@ -340,7 +345,7 @@ extern "C" { #define MeshPacket_init_default {0, 0, 0, {SubPacket_init_default}, 0, 0, 0, 0, 0, 0} #define ChannelSettings_init_default {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0} #define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default, false, ChannelSettings_init_default} -#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_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} #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} #define LogRecord_init_default {"", 0, "", _LogRecord_Level_MIN} @@ -354,7 +359,7 @@ extern "C" { #define MeshPacket_init_zero {0, 0, 0, {SubPacket_init_zero}, 0, 0, 0, 0, 0, 0} #define ChannelSettings_init_zero {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, "", 0, 0, 0, 0, 0, 0, 0} #define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero, false, ChannelSettings_init_zero} -#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_MIN, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, _LocationSharing_MIN, _GpsOperation_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} #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} #define LogRecord_init_zero {"", 0, "", _LogRecord_Level_MIN} @@ -435,6 +440,11 @@ extern "C" { #define RadioConfig_UserPreferences_ext_notification_plugin_active_tag 129 #define RadioConfig_UserPreferences_ext_notification_plugin_alert_message_tag 130 #define RadioConfig_UserPreferences_ext_notification_plugin_alert_bell_tag 131 +#define RadioConfig_UserPreferences_range_test_plugin_enabled_tag 132 +#define RadioConfig_UserPreferences_range_test_plugin_sender_tag 133 +#define RadioConfig_UserPreferences_range_test_plugin_save_tag 134 +#define RadioConfig_UserPreferences_store_forward_plugin_enabled_tag 136 +#define RadioConfig_UserPreferences_store_forward_plugin_records_tag 137 #define RouteDiscovery_route_tag 2 #define User_id_tag 1 #define User_long_name_tag 2 @@ -514,31 +524,31 @@ X(a, STATIC, REPEATED, INT32, route, 2) #define RouteDiscovery_DEFAULT NULL #define SubPacket_FIELDLIST(X, a) \ -X(a, STATIC, ONEOF, MESSAGE, (payload,position,position), 1) \ -X(a, STATIC, ONEOF, MESSAGE, (payload,data,data), 3) \ -X(a, STATIC, ONEOF, MESSAGE, (payload,user,user), 4) \ -X(a, STATIC, ONEOF, MESSAGE, (payload,route_request,route_request), 6) \ -X(a, STATIC, ONEOF, MESSAGE, (payload,route_reply,route_reply), 7) \ -X(a, STATIC, ONEOF, UENUM, (payload,error_reason,error_reason), 13) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,position,payloadVariant.position), 1) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,data,payloadVariant.data), 3) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,user,payloadVariant.user), 4) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,route_request,payloadVariant.route_request), 6) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,route_reply,payloadVariant.route_reply), 7) \ +X(a, STATIC, ONEOF, UENUM, (payloadVariant,error_reason,payloadVariant.error_reason), 13) \ X(a, STATIC, SINGULAR, UINT32, original_id, 2) \ X(a, STATIC, SINGULAR, BOOL, want_response, 5) \ X(a, STATIC, SINGULAR, UINT32, dest, 9) \ -X(a, STATIC, ONEOF, UINT32, (ack,success_id,ack.success_id), 10) \ -X(a, STATIC, ONEOF, UINT32, (ack,fail_id,ack.fail_id), 11) \ +X(a, STATIC, ONEOF, UINT32, (ackVariant,success_id,ackVariant.success_id), 10) \ +X(a, STATIC, ONEOF, UINT32, (ackVariant,fail_id,ackVariant.fail_id), 11) \ X(a, STATIC, SINGULAR, UINT32, source, 12) #define SubPacket_CALLBACK NULL #define SubPacket_DEFAULT NULL -#define SubPacket_payload_position_MSGTYPE Position -#define SubPacket_payload_data_MSGTYPE Data -#define SubPacket_payload_user_MSGTYPE User -#define SubPacket_payload_route_request_MSGTYPE RouteDiscovery -#define SubPacket_payload_route_reply_MSGTYPE RouteDiscovery +#define SubPacket_payloadVariant_position_MSGTYPE Position +#define SubPacket_payloadVariant_data_MSGTYPE Data +#define SubPacket_payloadVariant_user_MSGTYPE User +#define SubPacket_payloadVariant_route_request_MSGTYPE RouteDiscovery +#define SubPacket_payloadVariant_route_reply_MSGTYPE RouteDiscovery #define MeshPacket_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, from, 1) \ X(a, STATIC, SINGULAR, UINT32, to, 2) \ -X(a, STATIC, ONEOF, MESSAGE, (payload,decoded,decoded), 3) \ -X(a, STATIC, ONEOF, BYTES, (payload,encrypted,encrypted), 8) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,decoded,payloadVariant.decoded), 3) \ +X(a, STATIC, ONEOF, BYTES, (payloadVariant,encrypted,payloadVariant.encrypted), 8) \ X(a, STATIC, SINGULAR, UINT32, channel_index, 4) \ X(a, STATIC, SINGULAR, UINT32, id, 6) \ X(a, STATIC, SINGULAR, FLOAT, rx_snr, 7) \ @@ -547,7 +557,7 @@ X(a, STATIC, SINGULAR, UINT32, hop_limit, 10) \ X(a, STATIC, SINGULAR, BOOL, want_ack, 11) #define MeshPacket_CALLBACK NULL #define MeshPacket_DEFAULT NULL -#define MeshPacket_payload_decoded_MSGTYPE SubPacket +#define MeshPacket_payloadVariant_decoded_MSGTYPE SubPacket #define ChannelSettings_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, INT32, tx_power, 1) \ @@ -609,7 +619,12 @@ X(a, STATIC, SINGULAR, UINT32, ext_notification_plugin_output_ms, 127) \ X(a, STATIC, SINGULAR, UINT32, ext_notification_plugin_output, 128) \ X(a, STATIC, SINGULAR, BOOL, ext_notification_plugin_active, 129) \ X(a, STATIC, SINGULAR, BOOL, ext_notification_plugin_alert_message, 130) \ -X(a, STATIC, SINGULAR, BOOL, ext_notification_plugin_alert_bell, 131) +X(a, STATIC, SINGULAR, BOOL, ext_notification_plugin_alert_bell, 131) \ +X(a, STATIC, SINGULAR, BOOL, range_test_plugin_enabled, 132) \ +X(a, STATIC, SINGULAR, UINT32, range_test_plugin_sender, 133) \ +X(a, STATIC, SINGULAR, BOOL, range_test_plugin_save, 134) \ +X(a, STATIC, SINGULAR, BOOL, store_forward_plugin_enabled, 136) \ +X(a, STATIC, SINGULAR, UINT32, store_forward_plugin_records, 137) #define RadioConfig_UserPreferences_CALLBACK NULL #define RadioConfig_UserPreferences_DEFAULT NULL @@ -652,35 +667,35 @@ X(a, STATIC, SINGULAR, UENUM, level, 4) #define FromRadio_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, UINT32, num, 1) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,packet,variant.packet), 2) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,my_info,variant.my_info), 3) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,node_info,variant.node_info), 4) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,radio,variant.radio), 6) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,log_record,variant.log_record), 7) \ -X(a, STATIC, ONEOF, UINT32, (variant,config_complete_id,variant.config_complete_id), 8) \ -X(a, STATIC, ONEOF, BOOL, (variant,rebooted,variant.rebooted), 9) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,channel,variant.channel), 10) +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,payloadVariant.packet), 2) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,my_info,payloadVariant.my_info), 3) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,node_info,payloadVariant.node_info), 4) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,radio,payloadVariant.radio), 6) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,log_record,payloadVariant.log_record), 7) \ +X(a, STATIC, ONEOF, UINT32, (payloadVariant,config_complete_id,payloadVariant.config_complete_id), 8) \ +X(a, STATIC, ONEOF, BOOL, (payloadVariant,rebooted,payloadVariant.rebooted), 9) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,channel,payloadVariant.channel), 10) #define FromRadio_CALLBACK NULL #define FromRadio_DEFAULT NULL -#define FromRadio_variant_packet_MSGTYPE MeshPacket -#define FromRadio_variant_my_info_MSGTYPE MyNodeInfo -#define FromRadio_variant_node_info_MSGTYPE NodeInfo -#define FromRadio_variant_radio_MSGTYPE RadioConfig -#define FromRadio_variant_log_record_MSGTYPE LogRecord -#define FromRadio_variant_channel_MSGTYPE ChannelSettings +#define FromRadio_payloadVariant_packet_MSGTYPE MeshPacket +#define FromRadio_payloadVariant_my_info_MSGTYPE MyNodeInfo +#define FromRadio_payloadVariant_node_info_MSGTYPE NodeInfo +#define FromRadio_payloadVariant_radio_MSGTYPE RadioConfig +#define FromRadio_payloadVariant_log_record_MSGTYPE LogRecord +#define FromRadio_payloadVariant_channel_MSGTYPE ChannelSettings #define ToRadio_FIELDLIST(X, a) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,packet,variant.packet), 1) \ -X(a, STATIC, ONEOF, UINT32, (variant,want_config_id,variant.want_config_id), 100) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,set_radio,variant.set_radio), 101) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,set_owner,variant.set_owner), 102) \ -X(a, STATIC, ONEOF, MESSAGE, (variant,set_channel,variant.set_channel), 103) +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,packet,payloadVariant.packet), 1) \ +X(a, STATIC, ONEOF, UINT32, (payloadVariant,want_config_id,payloadVariant.want_config_id), 100) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,set_radio,payloadVariant.set_radio), 101) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,set_owner,payloadVariant.set_owner), 102) \ +X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,set_channel,payloadVariant.set_channel), 103) #define ToRadio_CALLBACK NULL #define ToRadio_DEFAULT NULL -#define ToRadio_variant_packet_MSGTYPE MeshPacket -#define ToRadio_variant_set_radio_MSGTYPE RadioConfig -#define ToRadio_variant_set_owner_MSGTYPE User -#define ToRadio_variant_set_channel_MSGTYPE ChannelSettings +#define ToRadio_payloadVariant_packet_MSGTYPE MeshPacket +#define ToRadio_payloadVariant_set_radio_MSGTYPE RadioConfig +#define ToRadio_payloadVariant_set_owner_MSGTYPE User +#define ToRadio_payloadVariant_set_channel_MSGTYPE ChannelSettings extern const pb_msgdesc_t Position_msg; extern const pb_msgdesc_t Data_msg; @@ -721,13 +736,13 @@ extern const pb_msgdesc_t ToRadio_msg; #define SubPacket_size 275 #define MeshPacket_size 320 #define ChannelSettings_size 95 -#define RadioConfig_size 382 -#define RadioConfig_UserPreferences_size 282 +#define RadioConfig_size 405 +#define RadioConfig_UserPreferences_size 305 #define NodeInfo_size 132 #define MyNodeInfo_size 106 #define LogRecord_size 81 -#define FromRadio_size 391 -#define ToRadio_size 386 +#define FromRadio_size 414 +#define ToRadio_size 409 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/portnums.pb.h b/src/mesh/generated/portnums.pb.h index 15572ca1..2133ecaa 100644 --- a/src/mesh/generated/portnums.pb.h +++ b/src/mesh/generated/portnums.pb.h @@ -20,6 +20,7 @@ typedef enum _PortNum { PortNum_IP_TUNNEL_APP = 33, PortNum_SERIAL_APP = 64, PortNum_STORE_FORWARD_APP = 65, + PortNum_RANGE_TEST_APP = 66, PortNum_PRIVATE_APP = 256, PortNum_ATAK_FORWARDER = 257 } PortNum;