From 56d3b15ce871d6fdf95f138737c4d6aa5f898452 Mon Sep 17 00:00:00 2001 From: uhuruhashimoto Date: Sun, 5 Mar 2023 22:35:03 -0500 Subject: [PATCH 1/9] nbrinfo protobuf --- meshtastic/neighborinfo.options | 4 +++ meshtastic/neighborinfo.proto | 48 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 meshtastic/neighborinfo.options create mode 100644 meshtastic/neighborinfo.proto diff --git a/meshtastic/neighborinfo.options b/meshtastic/neighborinfo.options new file mode 100644 index 0000000..30691ad --- /dev/null +++ b/meshtastic/neighborinfo.options @@ -0,0 +1,4 @@ +# options for nanopb +# https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options + +*NeighborInfo.neighbors max_count:10 \ No newline at end of file diff --git a/meshtastic/neighborinfo.proto b/meshtastic/neighborinfo.proto new file mode 100644 index 0000000..0b01521 --- /dev/null +++ b/meshtastic/neighborinfo.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; + +package meshtastic; + +option java_package = "com.geeksville.mesh"; +option java_outer_classname = "NeighborInfoProtos"; +option go_package = "github.com/meshtastic/go/generated"; +option csharp_namespace = "Meshtastic.Protobufs"; +option swift_prefix = ""; + +/* +* Full info on edges for a single node +*/ +message NeighborInfo { + /* + * The node ID of the node sending info on its neighbors + */ + uint32 node_id = 1; + /* + * Time at packet transmission (in millis, Unix epoch) + */ + fixed32 tx_time = 2; + + /* + * The list of neighbors + */ + repeated Neighbor neighbors = 4; +} + +/* +* A single edge in the mesh +*/ +message Neighbor { + /* + * Node ID of neighbor + */ + uint32 node_id = 1; + + /* + * SNR of last heard message + */ + float snr = 2; + + /* + * Time of last heard message (in millis, Unix epoch) + */ + fixed32 rx_time = 3; +} \ No newline at end of file From 834db2e04a796909626c5ca31be07fb5e6378e5f Mon Sep 17 00:00:00 2001 From: uhuruhashimoto Date: Sun, 5 Mar 2023 22:38:14 -0500 Subject: [PATCH 2/9] node db changes in deviceonly --- meshtastic/deviceonly.options | 3 ++- meshtastic/deviceonly.proto | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/meshtastic/deviceonly.options b/meshtastic/deviceonly.options index fe51ce9..71ceaa0 100644 --- a/meshtastic/deviceonly.options +++ b/meshtastic/deviceonly.options @@ -2,7 +2,8 @@ # https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options # FIXME pick a higher number someday? or do dynamic alloc in nanopb? -*DeviceState.node_db max_count:80 +*DeviceState.node_db max_count:40 +*DeviceState.node_db_neighbors max_count: 40 # FIXME - max_count is actually 32 but we save/load this as one long string of preencoded MeshPacket bytes - not a big array in RAM *DeviceState.receive_queue max_count:1 diff --git a/meshtastic/deviceonly.proto b/meshtastic/deviceonly.proto index 3ce9ab3..c54a2b9 100644 --- a/meshtastic/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -11,6 +11,7 @@ option swift_prefix = ""; import "meshtastic/channel.proto"; import "meshtastic/localonly.proto"; import "meshtastic/mesh.proto"; +import "meshtastic/neighborinfo.proto"; /* * This message is never sent over the wire, but it is used for serializing DB @@ -66,6 +67,12 @@ message DeviceState { */ bool did_gps_reset = 11; + /* + * Sender information used by NeighborInfo Module to get edge info on the mesh. + * This is stored in each node's nodeDB so we'll have a SNR per edge when we sniff packets. + * This field should disabled (always zeroed) unless user opts in. + */ + repeated Neighbor node_db_neighbors = 12; } /* From 9181274d8a1db1733b13d1c1828b5b1c5a8e8202 Mon Sep 17 00:00:00 2001 From: uhuruhashimoto Date: Sun, 5 Mar 2023 22:40:34 -0500 Subject: [PATCH 3/9] added portnum for neighborinfo app --- meshtastic/portnums.proto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meshtastic/portnums.proto b/meshtastic/portnums.proto index 9c94a1b..984eb5d 100644 --- a/meshtastic/portnums.proto +++ b/meshtastic/portnums.proto @@ -142,6 +142,11 @@ enum PortNum { */ TRACEROUTE_APP = 70; + /* + * Aggregates edge info for the network by sending out a list of each node's neighbors + */ + NEIGHBORINFO_APP = 71; + /* * Private applications should use portnums >= 256. * To simplify initial development and testing you can use "PRIVATE_APP" From 7f0c12f4036fdf0bdbcf35849125a293cf316770 Mon Sep 17 00:00:00 2001 From: uhuruhashimoto Date: Sun, 5 Mar 2023 22:42:20 -0500 Subject: [PATCH 4/9] added last_sent_by_id field to neighborinfo protobuf --- meshtastic/neighborinfo.proto | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meshtastic/neighborinfo.proto b/meshtastic/neighborinfo.proto index 0b01521..31c922d 100644 --- a/meshtastic/neighborinfo.proto +++ b/meshtastic/neighborinfo.proto @@ -17,9 +17,13 @@ message NeighborInfo { */ uint32 node_id = 1; /* + * The node ID of the node sending info on its neighbors + */ + uint32 last_sent_by_id = 2; + /* * Time at packet transmission (in millis, Unix epoch) */ - fixed32 tx_time = 2; + fixed32 tx_time = 3; /* * The list of neighbors From 4aaa9fd28ed0c5bf171f5f968a3f5afc9ee7c8c7 Mon Sep 17 00:00:00 2001 From: uhuruhashimoto Date: Mon, 6 Mar 2023 15:08:24 -0500 Subject: [PATCH 5/9] moved nbrinfo into the mesh module --- meshtastic/deviceonly.proto | 1 - meshtastic/mesh.options | 4 ++- meshtastic/mesh.proto | 43 +++++++++++++++++++++++++++ meshtastic/neighborinfo.options | 4 --- meshtastic/neighborinfo.proto | 52 --------------------------------- 5 files changed, 46 insertions(+), 58 deletions(-) delete mode 100644 meshtastic/neighborinfo.options delete mode 100644 meshtastic/neighborinfo.proto diff --git a/meshtastic/deviceonly.proto b/meshtastic/deviceonly.proto index c54a2b9..2bab282 100644 --- a/meshtastic/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -11,7 +11,6 @@ option swift_prefix = ""; import "meshtastic/channel.proto"; import "meshtastic/localonly.proto"; import "meshtastic/mesh.proto"; -import "meshtastic/neighborinfo.proto"; /* * This message is never sent over the wire, but it is used for serializing DB diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index 35c753b..378e4d3 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -47,4 +47,6 @@ *Compressed.data max_size:237 *Waypoint.name max_size:30 -*Waypoint.description max_size:100 \ No newline at end of file +*Waypoint.description max_size:100 + +*NeighborInfo.neighbors max_count:10 \ No newline at end of file diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index d4bcd6b..0b10243 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1366,3 +1366,46 @@ message Compressed { */ bytes data = 2; } + +/* +* Full info on edges for a single node +*/ +message NeighborInfo { + /* + * The node ID of the node sending info on its neighbors + */ + uint32 node_id = 1; + /* + * The node ID of the node sending info on its neighbors + */ + uint32 last_sent_by_id = 2; + /* + * Time at packet transmission (in millis, Unix epoch) + */ + fixed32 tx_time = 3; + + /* + * The list of neighbors + */ + repeated Neighbor neighbors = 4; +} + +/* +* A single edge in the mesh +*/ +message Neighbor { + /* + * Node ID of neighbor + */ + uint32 node_id = 1; + + /* + * SNR of last heard message + */ + float snr = 2; + + /* + * Time of last heard message (in millis, Unix epoch) + */ + fixed32 rx_time = 3; +} diff --git a/meshtastic/neighborinfo.options b/meshtastic/neighborinfo.options deleted file mode 100644 index 30691ad..0000000 --- a/meshtastic/neighborinfo.options +++ /dev/null @@ -1,4 +0,0 @@ -# options for nanopb -# https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options - -*NeighborInfo.neighbors max_count:10 \ No newline at end of file diff --git a/meshtastic/neighborinfo.proto b/meshtastic/neighborinfo.proto deleted file mode 100644 index 31c922d..0000000 --- a/meshtastic/neighborinfo.proto +++ /dev/null @@ -1,52 +0,0 @@ -syntax = "proto3"; - -package meshtastic; - -option java_package = "com.geeksville.mesh"; -option java_outer_classname = "NeighborInfoProtos"; -option go_package = "github.com/meshtastic/go/generated"; -option csharp_namespace = "Meshtastic.Protobufs"; -option swift_prefix = ""; - -/* -* Full info on edges for a single node -*/ -message NeighborInfo { - /* - * The node ID of the node sending info on its neighbors - */ - uint32 node_id = 1; - /* - * The node ID of the node sending info on its neighbors - */ - uint32 last_sent_by_id = 2; - /* - * Time at packet transmission (in millis, Unix epoch) - */ - fixed32 tx_time = 3; - - /* - * The list of neighbors - */ - repeated Neighbor neighbors = 4; -} - -/* -* A single edge in the mesh -*/ -message Neighbor { - /* - * Node ID of neighbor - */ - uint32 node_id = 1; - - /* - * SNR of last heard message - */ - float snr = 2; - - /* - * Time of last heard message (in millis, Unix epoch) - */ - fixed32 rx_time = 3; -} \ No newline at end of file From 49761b94a8ffb2b26ba1a6ed2b3affb05270518e Mon Sep 17 00:00:00 2001 From: uhuruhashimoto Date: Mon, 10 Apr 2023 23:00:29 -0400 Subject: [PATCH 6/9] merge resolution --- meshtastic/mesh.options | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index 3a10eff..c28b91c 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -51,8 +51,6 @@ *Waypoint.name max_size:30 *Waypoint.description max_size:100 -<<<<<<< HEAD *NeighborInfo.neighbors max_count:10 -======= + *DeviceMetadata.firmware_version max_size:18 ->>>>>>> 3e5ab67ff6659476df66bde6bbbae3c520460db9 From 2b0cd260716a0c29bcf59aff4a9c4c637a6f45f6 Mon Sep 17 00:00:00 2001 From: uhuruhashimoto Date: Tue, 11 Apr 2023 10:30:50 -0400 Subject: [PATCH 7/9] changes to nodeDB size and a comment --- meshtastic/deviceonly.options | 8 ++++++-- meshtastic/mesh.proto | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/meshtastic/deviceonly.options b/meshtastic/deviceonly.options index 71ceaa0..aa33cc2 100644 --- a/meshtastic/deviceonly.options +++ b/meshtastic/deviceonly.options @@ -2,8 +2,12 @@ # https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options # FIXME pick a higher number someday? or do dynamic alloc in nanopb? -*DeviceState.node_db max_count:40 -*DeviceState.node_db_neighbors max_count: 40 +# As of April 2023, the size of a NodeInfo packet is approx. 130 bytes. We previously +# capped storage at 80 such packets. The size of a Neighbor is 12 bytes, meaning we can fit +# 10 for every NodeInfo. Thus, our footprint for storing 20 Neighbors in the DB is a little under +# 2 NodeInfo. +*DeviceState.node_db max_count:78 +*DeviceState.node_db_neighbors max_count:20 # FIXME - max_count is actually 32 but we save/load this as one long string of preencoded MeshPacket bytes - not a big array in RAM *DeviceState.receive_queue max_count:1 diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index 3768d22..9a2ccdb 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1396,7 +1396,7 @@ message NeighborInfo { */ uint32 node_id = 1; /* - * The node ID of the node sending info on its neighbors + * Field to pass neighbor info for the next sending cycle */ uint32 last_sent_by_id = 2; /* From f6d15a195e86d6ecc07a3b565a1efd96464d94ce Mon Sep 17 00:00:00 2001 From: uhuruhashimoto Date: Fri, 14 Apr 2023 17:33:21 -0400 Subject: [PATCH 8/9] removed tx and rx time and nodedb changes --- meshtastic/deviceonly.options | 7 +------ meshtastic/deviceonly.proto | 7 ------- meshtastic/mesh.proto | 14 ++------------ 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/meshtastic/deviceonly.options b/meshtastic/deviceonly.options index aa33cc2..fe51ce9 100644 --- a/meshtastic/deviceonly.options +++ b/meshtastic/deviceonly.options @@ -2,12 +2,7 @@ # https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options # FIXME pick a higher number someday? or do dynamic alloc in nanopb? -# As of April 2023, the size of a NodeInfo packet is approx. 130 bytes. We previously -# capped storage at 80 such packets. The size of a Neighbor is 12 bytes, meaning we can fit -# 10 for every NodeInfo. Thus, our footprint for storing 20 Neighbors in the DB is a little under -# 2 NodeInfo. -*DeviceState.node_db max_count:78 -*DeviceState.node_db_neighbors max_count:20 +*DeviceState.node_db max_count:80 # FIXME - max_count is actually 32 but we save/load this as one long string of preencoded MeshPacket bytes - not a big array in RAM *DeviceState.receive_queue max_count:1 diff --git a/meshtastic/deviceonly.proto b/meshtastic/deviceonly.proto index d8456cf..d798013 100644 --- a/meshtastic/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -65,13 +65,6 @@ message DeviceState { * Some GPS receivers seem to have bogus settings from the factory, so we always do one factory reset. */ bool did_gps_reset = 11; - - /* - * Sender information used by NeighborInfo Module to get edge info on the mesh. - * This is stored in each node's nodeDB so we'll have a SNR per edge when we sniff packets. - * This field should disabled (always zeroed) unless user opts in. - */ - repeated Neighbor node_db_neighbors = 12; } /* diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index 9a2ccdb..eadc0a6 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1400,14 +1400,9 @@ message NeighborInfo { */ uint32 last_sent_by_id = 2; /* - * Time at packet transmission (in millis, Unix epoch) + * The list of out edges from this node */ - fixed32 tx_time = 3; - - /* - * The list of neighbors - */ - repeated Neighbor neighbors = 4; + repeated Neighbor neighbors = 3; } /* @@ -1423,11 +1418,6 @@ message Neighbor { * SNR of last heard message */ float snr = 2; - - /* - * Time of last heard message (in millis, Unix epoch) - */ - fixed32 rx_time = 3; } /* From 890190585a5e99ecb53ab0f27a0f384ff931017a Mon Sep 17 00:00:00 2001 From: uhuruhashimoto Date: Fri, 14 Apr 2023 17:35:54 -0400 Subject: [PATCH 9/9] a space --- meshtastic/deviceonly.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/meshtastic/deviceonly.proto b/meshtastic/deviceonly.proto index d798013..0b1e6a4 100644 --- a/meshtastic/deviceonly.proto +++ b/meshtastic/deviceonly.proto @@ -65,6 +65,7 @@ message DeviceState { * Some GPS receivers seem to have bogus settings from the factory, so we always do one factory reset. */ bool did_gps_reset = 11; + } /*