From bc3ecd97e381b724c1a28acce0d12c688de73ba3 Mon Sep 17 00:00:00 2001 From: geeksville Date: Tue, 12 May 2020 13:34:44 -0700 Subject: [PATCH] Updates to keep ToRadio/FromRadio packets smaller than 512 bytes --- mesh.options | 2 ++ mesh.proto | 66 +++++++++++++++++++++++++++++----------------------- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/mesh.options b/mesh.options index d8e2c81..7740c14 100644 --- a/mesh.options +++ b/mesh.options @@ -36,6 +36,8 @@ *MeshPacket.encrypted max_size:256 *MeshPacket.payload anonymous_oneof:true +*SubPacket.payload anonymous_oneof:true + # MyMessage.name max_size:40 # or fixed_length or fixed_count, or max_count diff --git a/mesh.proto b/mesh.proto index aedc6a0..e96f78b 100644 --- a/mesh.proto +++ b/mesh.proto @@ -170,31 +170,13 @@ message RouteDiscovery { // inside a radio packet (because from/to are broken out by the comms library) message SubPacket { - // Typically only one of the following fields are populated, but there is no - // restriction wrt that - Position position = 1; - Data data = 3; - User user = 4; + // Only one of the following fields can be populated at a time + oneof payload { - /// Not normally used, but for testing a sender can request that recipient - /// responds in kind (i.e. if it received a position, it should unicast back - /// its position). - // Note: that if you set this on a broadcast you will receive many replies. - // FIXME - unify (i.e. remove) this with the new reliable messaging at the - // MeshPacket level - bool want_response = 5; + Position position = 1; + Data data = 3; + User user = 4; - /** - This packet is a requested acknoledgement indicating that we have received - the specified message ID. This packet type can be used both for immediate (0 - hops) messages or can be routed through multiple hops if dest is set. - - Note: As an optimization, recipients can _also_ populate other fields in the - ack if they think the recipient would appreciate that extra state. - */ - uint32 ack_id = 10; - - oneof route { /** A route request going from the requester */ @@ -206,13 +188,29 @@ message SubPacket { RouteDiscovery reply = 7; } - /** - If unset treated as zero (no fowarding, send to adjacent nodes only) - if 1, allow hopping through one node, etc... + /// Not normally used, but for testing a sender can request that recipient + /// responds in kind (i.e. if it received a position, it should unicast back + /// its position). + // Note: that if you set this on a broadcast you will receive many replies. + // FIXME - unify (i.e. remove) this with the new reliable messaging at the + // MeshPacket level + bool want_response = 5; - For our usecase real world topologies probably have a max of about 3. - */ - // uint32 hop_limit = 8; + oneof ack { + /** + This packet is a requested acknoledgement indicating that we have received + the specified message ID. This packet type can be used both for immediate + (0 hops) messages or can be routed through multiple hops if dest is set. + + Note: As an optimization, recipients can _also_ populate a field in payload + if they think the recipient would appreciate that extra state. + */ + uint32 success_id = 10; + + /** This is a nak, we failed to deliver this message. + */ + uint32 fail_id = 11; + } /** The address of the destination node. @@ -285,6 +283,16 @@ message MeshPacket { /// SNR /// of this packet. Used to collect statistics on current link waulity. float rx_snr = 7; + + /** + If unset treated as zero (no fowarding, send to adjacent nodes only) + if 1, allow hopping through one node, etc... + + For our usecase real world topologies probably have a max of about 3. + + This field is normally placed into a a couple of bits in the header. + */ + uint32 hop_limit = 10; } /// Shared constants between device and phone