sforkowany z mirror/meshtastic-firmware
refactor so I can track and ignore recent packets of any type
rodzic
c12fb69ca2
commit
86ae69d360
|
@ -11,6 +11,7 @@ Items to complete before the first beta release.
|
||||||
|
|
||||||
- Use 32 bits for message IDs
|
- Use 32 bits for message IDs
|
||||||
- Use fixed32 for node IDs
|
- Use fixed32 for node IDs
|
||||||
|
- Remove the "want node" node number arbitration process
|
||||||
- Don't store position packets in the to phone fifo if we are disconnected. The phone will get that info for 'free' when it
|
- Don't store position packets in the to phone fifo if we are disconnected. The phone will get that info for 'free' when it
|
||||||
fetches the fresh nodedb.
|
fetches the fresh nodedb.
|
||||||
- Use the RFM95 sequencer to stay in idle mode most of the time, then automatically go to receive mode and automatically go from transmit to receive mode. See 4.2.8.2 of manual.
|
- Use the RFM95 sequencer to stay in idle mode most of the time, then automatically go to receive mode and automatically go from transmit to receive mode. See 4.2.8.2 of manual.
|
||||||
|
|
|
@ -5,9 +5,57 @@ all else fails could always use the stock Radiohead solution - though super inef
|
||||||
|
|
||||||
great source of papers and class notes: http://www.cs.jhu.edu/~cs647/
|
great source of papers and class notes: http://www.cs.jhu.edu/~cs647/
|
||||||
|
|
||||||
|
reliable messaging tasks (stage one for DSR):
|
||||||
|
|
||||||
|
- add a 'messagePeek' hook for all messages that pass through our node.
|
||||||
|
- use the same 'recentmessages' array used for broadcast msgs to detect duplicate retransmitted messages.
|
||||||
|
- keep possible retries in the list with rebroadcast messages?
|
||||||
|
- for each message keep a count of # retries (max of three)
|
||||||
|
- delay some random time for each retry (large enough to allow for acks to come in)
|
||||||
|
- once an ack comes in, remove the packet from the retry list and deliver the ack to the original sender
|
||||||
|
- after three retries, deliver a no-ack packet to the original sender (i.e. the phone app or mesh router service)
|
||||||
|
- add a max hops parameter, use it for broadcast as well (0 means adjacent only, 1 is one forward etc...). Store as two bits in the header.
|
||||||
|
|
||||||
|
dsr tasks
|
||||||
|
|
||||||
|
- do "hop by hop" routing
|
||||||
|
- when sending, if destnodeinfo.next_hop is zero (and no message is already waiting for an arp for that node), startRouteDiscovery() for that node. Queue the message in the 'waiting for arp queue' so we can send it later when then the arp completes.
|
||||||
|
- otherwise, use next_hop and start sending a message (with ack request) towards that node.
|
||||||
|
|
||||||
|
when we receive any packet
|
||||||
|
|
||||||
|
- sniff and update tables (especially useful to find adjacent nodes). Update user, network and position info.
|
||||||
|
- if we need to route() that packet, resend it to the next_hop based on our nodedb.
|
||||||
|
- if it is broadcast or destined for our node, deliver locally
|
||||||
|
- handle routereply/routeerror/routediscovery messages as described below
|
||||||
|
- then free it
|
||||||
|
|
||||||
|
routeDiscovery
|
||||||
|
|
||||||
|
- if we've already passed through us (or is from us), then it ignore it
|
||||||
|
- use the nodes already mentioned in the request to update our routing table
|
||||||
|
- if they were looking for us, send back a routereply
|
||||||
|
- if max_hops is zero and they weren't looking for us, drop (FIXME, send back error - I think not though?)
|
||||||
|
- if we receive a discovery packet, we use it to populate next_hop (if needed) towards the requester (after decrementing max_hops)
|
||||||
|
- if we receive a discovery packet, and we have a next_hop in our nodedb for that destination we send a (reliable) we send a route reply towards the requester
|
||||||
|
|
||||||
|
when sending any reliable packet
|
||||||
|
|
||||||
|
- if we get back a nak, send a routeError message back towards the original requester. all nodes eavesdrop on that packet and update their route caches
|
||||||
|
|
||||||
|
when we receive a routereply packet
|
||||||
|
|
||||||
|
- update next_hop on the node, if the new reply needs fewer hops than the existing one (we prefer shorter paths). fixme, someday use a better heuristic
|
||||||
|
|
||||||
|
when we receive a routeError packet
|
||||||
|
|
||||||
|
- delete the route for that failed recipient, restartRouteDiscovery()
|
||||||
|
- if we receive routeerror in response to a discovery,
|
||||||
|
- fixme, eventually keep caches of possible other routes.
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
|
|
||||||
- DONE reread the radiohead mesh implementation - hop to hop acknoledgement seems VERY expensive but otherwise it seems like DSR
|
- DONE reread the radiohead mesh implementation - hop to hop acknowledgement seems VERY expensive but otherwise it seems like DSR
|
||||||
- DONE read about mesh routing solutions (DSR and AODV)
|
- DONE read about mesh routing solutions (DSR and AODV)
|
||||||
- DONE read about general mesh flooding solutions (naive, MPR, geo assisted)
|
- DONE read about general mesh flooding solutions (naive, MPR, geo assisted)
|
||||||
- DONE reread the disaster radio protocol docs - seems based on Babel (which is AODVish)
|
- DONE reread the disaster radio protocol docs - seems based on Babel (which is AODVish)
|
||||||
|
|
2
proto
2
proto
|
@ -1 +1 @@
|
||||||
Subproject commit 4840493693d5799ebd451f6857ecbbc5c9157348
|
Subproject commit 3bf195cb2d60f1d877a89bca87d0c70ea2d01177
|
|
@ -2,15 +2,10 @@
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "mesh-pb-constants.h"
|
#include "mesh-pb-constants.h"
|
||||||
|
|
||||||
/// We clear our old flood record five minute after we see the last of it
|
|
||||||
#define FLOOD_EXPIRE_TIME (5 * 60 * 1000L)
|
|
||||||
|
|
||||||
static bool supportFlooding = true; // Sometimes to simplify debugging we want jusT simple broadcast only
|
static bool supportFlooding = true; // Sometimes to simplify debugging we want jusT simple broadcast only
|
||||||
|
|
||||||
FloodingRouter::FloodingRouter() : toResend(MAX_NUM_NODES)
|
FloodingRouter::FloodingRouter() : toResend(MAX_NUM_NODES)
|
||||||
{
|
{
|
||||||
recentBroadcasts.reserve(MAX_NUM_NODES); // Prealloc the worst case # of records - to prevent heap fragmentation
|
|
||||||
// setup our periodic task
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,47 +96,3 @@ void FloodingRouter::doTask()
|
||||||
setPeriod(getRandomDelay());
|
setPeriod(getRandomDelay());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Update recentBroadcasts and return true if we have already seen this packet
|
|
||||||
*/
|
|
||||||
bool FloodingRouter::wasSeenRecently(const MeshPacket *p)
|
|
||||||
{
|
|
||||||
if (p->to != NODENUM_BROADCAST)
|
|
||||||
return false; // Not a broadcast, so we don't care
|
|
||||||
|
|
||||||
if (p->id == 0) {
|
|
||||||
DEBUG_MSG("Ignoring message with zero id\n");
|
|
||||||
return false; // Not a floodable message ID, so we don't care
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t now = millis();
|
|
||||||
for (size_t i = 0; i < recentBroadcasts.size();) {
|
|
||||||
BroadcastRecord &r = recentBroadcasts[i];
|
|
||||||
|
|
||||||
if ((now - r.rxTimeMsec) >= FLOOD_EXPIRE_TIME) {
|
|
||||||
// DEBUG_MSG("Deleting old broadcast record %d\n", i);
|
|
||||||
recentBroadcasts.erase(recentBroadcasts.begin() + i); // delete old record
|
|
||||||
} else {
|
|
||||||
if (r.id == p->id && r.sender == p->from) {
|
|
||||||
DEBUG_MSG("Found existing broadcast record for fr=0x%x,to=0x%x,id=%d\n", p->from, p->to, p->id);
|
|
||||||
|
|
||||||
// Update the time on this record to now
|
|
||||||
r.rxTimeMsec = now;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Didn't find an existing record, make one
|
|
||||||
BroadcastRecord r;
|
|
||||||
r.id = p->id;
|
|
||||||
r.sender = p->from;
|
|
||||||
r.rxTimeMsec = now;
|
|
||||||
recentBroadcasts.push_back(r);
|
|
||||||
DEBUG_MSG("Adding broadcast record for fr=0x%x,to=0x%x,id=%d\n", p->from, p->to, p->id);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
|
@ -1,17 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "PacketHistory.h"
|
||||||
#include "PeriodicTask.h"
|
#include "PeriodicTask.h"
|
||||||
#include "Router.h"
|
#include "Router.h"
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A record of a recent message broadcast
|
|
||||||
*/
|
|
||||||
struct BroadcastRecord {
|
|
||||||
NodeNum sender;
|
|
||||||
PacketId id;
|
|
||||||
uint32_t rxTimeMsec; // Unix time in msecs - the time we received it
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a mixin that extends Router with the ability to do Naive Flooding (in the standard mesh protocol sense)
|
* This is a mixin that extends Router with the ability to do Naive Flooding (in the standard mesh protocol sense)
|
||||||
|
@ -36,13 +28,9 @@ struct BroadcastRecord {
|
||||||
Any entries in recentBroadcasts that are older than X seconds (longer than the
|
Any entries in recentBroadcasts that are older than X seconds (longer than the
|
||||||
max time a flood can take) will be discarded.
|
max time a flood can take) will be discarded.
|
||||||
*/
|
*/
|
||||||
class FloodingRouter : public Router, public PeriodicTask
|
class FloodingRouter : public Router, public PeriodicTask, private PacketHistory
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/** FIXME: really should be a std::unordered_set with the key being sender,id.
|
|
||||||
* This would make checking packets in wasSeenRecently faster.
|
|
||||||
*/
|
|
||||||
std::vector<BroadcastRecord> recentBroadcasts;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packets we've received that we need to resend after a short delay
|
* Packets we've received that we need to resend after a short delay
|
||||||
|
@ -74,10 +62,4 @@ class FloodingRouter : public Router, public PeriodicTask
|
||||||
virtual void handleReceived(MeshPacket *p);
|
virtual void handleReceived(MeshPacket *p);
|
||||||
|
|
||||||
virtual void doTask();
|
virtual void doTask();
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* Update recentBroadcasts and return true if we have already seen this packet
|
|
||||||
*/
|
|
||||||
bool wasSeenRecently(const MeshPacket *p);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
#include "PacketHistory.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
|
/// We clear our old flood record five minute after we see the last of it
|
||||||
|
#define FLOOD_EXPIRE_TIME (5 * 60 * 1000L)
|
||||||
|
|
||||||
|
PacketHistory::PacketHistory()
|
||||||
|
{
|
||||||
|
recentPackets.reserve(MAX_NUM_NODES); // Prealloc the worst case # of records - to prevent heap fragmentation
|
||||||
|
// setup our periodic task
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update recentBroadcasts and return true if we have already seen this packet
|
||||||
|
*/
|
||||||
|
bool PacketHistory::wasSeenRecently(const MeshPacket *p)
|
||||||
|
{
|
||||||
|
if (p->id == 0) {
|
||||||
|
DEBUG_MSG("Ignoring message with zero id\n");
|
||||||
|
return false; // Not a floodable message ID, so we don't care
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t now = millis();
|
||||||
|
for (size_t i = 0; i < recentPackets.size();) {
|
||||||
|
PacketRecord &r = recentPackets[i];
|
||||||
|
|
||||||
|
if ((now - r.rxTimeMsec) >= FLOOD_EXPIRE_TIME) {
|
||||||
|
// DEBUG_MSG("Deleting old broadcast record %d\n", i);
|
||||||
|
recentPackets.erase(recentPackets.begin() + i); // delete old record
|
||||||
|
} else {
|
||||||
|
if (r.id == p->id && r.sender == p->from) {
|
||||||
|
DEBUG_MSG("Found existing broadcast record for fr=0x%x,to=0x%x,id=%d\n", p->from, p->to, p->id);
|
||||||
|
|
||||||
|
// Update the time on this record to now
|
||||||
|
r.rxTimeMsec = now;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Didn't find an existing record, make one
|
||||||
|
PacketRecord r;
|
||||||
|
r.id = p->id;
|
||||||
|
r.sender = p->from;
|
||||||
|
r.rxTimeMsec = now;
|
||||||
|
recentPackets.push_back(r);
|
||||||
|
DEBUG_MSG("Adding broadcast record for fr=0x%x,to=0x%x,id=%d\n", p->from, p->to, p->id);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Router.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A record of a recent message broadcast
|
||||||
|
*/
|
||||||
|
struct PacketRecord {
|
||||||
|
NodeNum sender;
|
||||||
|
PacketId id;
|
||||||
|
uint32_t rxTimeMsec; // Unix time in msecs - the time we received it
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a mixin that adds a record of past packets we have seen
|
||||||
|
*/
|
||||||
|
class PacketHistory
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/** FIXME: really should be a std::unordered_set with the key being sender,id.
|
||||||
|
* This would make checking packets in wasSeenRecently faster.
|
||||||
|
*/
|
||||||
|
std::vector<PacketRecord> recentPackets;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PacketHistory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update recentBroadcasts and return true if we have already seen this packet
|
||||||
|
*/
|
||||||
|
bool wasSeenRecently(const MeshPacket *p);
|
||||||
|
};
|
|
@ -32,10 +32,6 @@ typedef enum _ChannelSettings_ModemConfig {
|
||||||
} ChannelSettings_ModemConfig;
|
} ChannelSettings_ModemConfig;
|
||||||
|
|
||||||
/* Struct definitions */
|
/* Struct definitions */
|
||||||
typedef struct _RouteDiscovery {
|
|
||||||
pb_callback_t route;
|
|
||||||
} RouteDiscovery;
|
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(32) ChannelSettings_psk_t;
|
typedef PB_BYTES_ARRAY_T(32) ChannelSettings_psk_t;
|
||||||
typedef struct _ChannelSettings {
|
typedef struct _ChannelSettings {
|
||||||
int32_t tx_power;
|
int32_t tx_power;
|
||||||
|
@ -90,6 +86,11 @@ typedef struct _RadioConfig_UserPreferences {
|
||||||
bool promiscuous_mode;
|
bool promiscuous_mode;
|
||||||
} RadioConfig_UserPreferences;
|
} RadioConfig_UserPreferences;
|
||||||
|
|
||||||
|
typedef struct _RouteDiscovery {
|
||||||
|
pb_size_t route_count;
|
||||||
|
int32_t route[8];
|
||||||
|
} RouteDiscovery;
|
||||||
|
|
||||||
typedef struct _User {
|
typedef struct _User {
|
||||||
char id[16];
|
char id[16];
|
||||||
char long_name[40];
|
char long_name[40];
|
||||||
|
@ -98,11 +99,12 @@ typedef struct _User {
|
||||||
} User;
|
} User;
|
||||||
|
|
||||||
typedef struct _NodeInfo {
|
typedef struct _NodeInfo {
|
||||||
int32_t num;
|
uint32_t num;
|
||||||
bool has_user;
|
bool has_user;
|
||||||
User user;
|
User user;
|
||||||
bool has_position;
|
bool has_position;
|
||||||
Position position;
|
Position position;
|
||||||
|
uint32_t next_hop;
|
||||||
float snr;
|
float snr;
|
||||||
} NodeInfo;
|
} NodeInfo;
|
||||||
|
|
||||||
|
@ -121,6 +123,17 @@ typedef struct _SubPacket {
|
||||||
bool has_user;
|
bool has_user;
|
||||||
User user;
|
User user;
|
||||||
bool want_response;
|
bool want_response;
|
||||||
|
pb_size_t which_route;
|
||||||
|
union {
|
||||||
|
RouteDiscovery request;
|
||||||
|
RouteDiscovery reply;
|
||||||
|
} route;
|
||||||
|
uint32_t dest;
|
||||||
|
pb_size_t which_ack;
|
||||||
|
union {
|
||||||
|
uint32_t success_id;
|
||||||
|
uint32_t fail_id;
|
||||||
|
} ack;
|
||||||
} SubPacket;
|
} SubPacket;
|
||||||
|
|
||||||
typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t;
|
typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t;
|
||||||
|
@ -135,6 +148,7 @@ typedef struct _MeshPacket {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
float rx_snr;
|
float rx_snr;
|
||||||
uint32_t rx_time;
|
uint32_t rx_time;
|
||||||
|
uint32_t hop_limit;
|
||||||
} MeshPacket;
|
} MeshPacket;
|
||||||
|
|
||||||
typedef struct _DeviceState {
|
typedef struct _DeviceState {
|
||||||
|
@ -196,13 +210,13 @@ typedef struct _ToRadio {
|
||||||
#define Position_init_default {0, 0, 0, 0, 0}
|
#define Position_init_default {0, 0, 0, 0, 0}
|
||||||
#define Data_init_default {_Data_Type_MIN, {0, {0}}}
|
#define Data_init_default {_Data_Type_MIN, {0, {0}}}
|
||||||
#define User_init_default {"", "", "", {0}}
|
#define User_init_default {"", "", "", {0}}
|
||||||
#define RouteDiscovery_init_default {{{NULL}, NULL}}
|
#define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
||||||
#define SubPacket_init_default {false, Position_init_default, false, Data_init_default, false, User_init_default, 0}
|
#define SubPacket_init_default {false, Position_init_default, false, Data_init_default, false, User_init_default, 0, 0, {RouteDiscovery_init_default}, 0, 0, {0}}
|
||||||
#define MeshPacket_init_default {0, 0, 0, {SubPacket_init_default}, 0, 0, 0}
|
#define MeshPacket_init_default {0, 0, 0, {SubPacket_init_default}, 0, 0, 0, 0}
|
||||||
#define ChannelSettings_init_default {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, ""}
|
#define ChannelSettings_init_default {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, ""}
|
||||||
#define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default, false, ChannelSettings_init_default}
|
#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, 0, 0}
|
#define RadioConfig_UserPreferences_init_default {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}
|
#define NodeInfo_init_default {0, false, User_init_default, false, Position_init_default, 0, 0}
|
||||||
#define MyNodeInfo_init_default {0, 0, 0, "", "", "", 0, 0, 0}
|
#define MyNodeInfo_init_default {0, 0, 0, "", "", "", 0, 0, 0}
|
||||||
#define DeviceState_init_default {false, RadioConfig_init_default, false, MyNodeInfo_init_default, false, User_init_default, 0, {NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default}, 0, {MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default}, false, MeshPacket_init_default, 0}
|
#define DeviceState_init_default {false, RadioConfig_init_default, false, MyNodeInfo_init_default, false, User_init_default, 0, {NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default, NodeInfo_init_default}, 0, {MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default, MeshPacket_init_default}, false, MeshPacket_init_default, 0}
|
||||||
#define DebugString_init_default {""}
|
#define DebugString_init_default {""}
|
||||||
|
@ -211,13 +225,13 @@ typedef struct _ToRadio {
|
||||||
#define Position_init_zero {0, 0, 0, 0, 0}
|
#define Position_init_zero {0, 0, 0, 0, 0}
|
||||||
#define Data_init_zero {_Data_Type_MIN, {0, {0}}}
|
#define Data_init_zero {_Data_Type_MIN, {0, {0}}}
|
||||||
#define User_init_zero {"", "", "", {0}}
|
#define User_init_zero {"", "", "", {0}}
|
||||||
#define RouteDiscovery_init_zero {{{NULL}, NULL}}
|
#define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
||||||
#define SubPacket_init_zero {false, Position_init_zero, false, Data_init_zero, false, User_init_zero, 0}
|
#define SubPacket_init_zero {false, Position_init_zero, false, Data_init_zero, false, User_init_zero, 0, 0, {RouteDiscovery_init_zero}, 0, 0, {0}}
|
||||||
#define MeshPacket_init_zero {0, 0, 0, {SubPacket_init_zero}, 0, 0, 0}
|
#define MeshPacket_init_zero {0, 0, 0, {SubPacket_init_zero}, 0, 0, 0, 0}
|
||||||
#define ChannelSettings_init_zero {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, ""}
|
#define ChannelSettings_init_zero {0, _ChannelSettings_ModemConfig_MIN, {0, {0}}, ""}
|
||||||
#define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero, false, ChannelSettings_init_zero}
|
#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, 0, 0}
|
#define RadioConfig_UserPreferences_init_zero {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}
|
#define NodeInfo_init_zero {0, false, User_init_zero, false, Position_init_zero, 0, 0}
|
||||||
#define MyNodeInfo_init_zero {0, 0, 0, "", "", "", 0, 0, 0}
|
#define MyNodeInfo_init_zero {0, 0, 0, "", "", "", 0, 0, 0}
|
||||||
#define DeviceState_init_zero {false, RadioConfig_init_zero, false, MyNodeInfo_init_zero, false, User_init_zero, 0, {NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero}, 0, {MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero}, false, MeshPacket_init_zero, 0}
|
#define DeviceState_init_zero {false, RadioConfig_init_zero, false, MyNodeInfo_init_zero, false, User_init_zero, 0, {NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero, NodeInfo_init_zero}, 0, {MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero, MeshPacket_init_zero}, false, MeshPacket_init_zero, 0}
|
||||||
#define DebugString_init_zero {""}
|
#define DebugString_init_zero {""}
|
||||||
|
@ -225,7 +239,6 @@ typedef struct _ToRadio {
|
||||||
#define ToRadio_init_zero {0, {MeshPacket_init_zero}}
|
#define ToRadio_init_zero {0, {MeshPacket_init_zero}}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define RouteDiscovery_route_tag 2
|
|
||||||
#define ChannelSettings_tx_power_tag 1
|
#define ChannelSettings_tx_power_tag 1
|
||||||
#define ChannelSettings_modem_config_tag 3
|
#define ChannelSettings_modem_config_tag 3
|
||||||
#define ChannelSettings_psk_tag 4
|
#define ChannelSettings_psk_tag 4
|
||||||
|
@ -260,6 +273,7 @@ typedef struct _ToRadio {
|
||||||
#define RadioConfig_UserPreferences_min_wake_secs_tag 11
|
#define RadioConfig_UserPreferences_min_wake_secs_tag 11
|
||||||
#define RadioConfig_UserPreferences_keep_all_packets_tag 100
|
#define RadioConfig_UserPreferences_keep_all_packets_tag 100
|
||||||
#define RadioConfig_UserPreferences_promiscuous_mode_tag 101
|
#define RadioConfig_UserPreferences_promiscuous_mode_tag 101
|
||||||
|
#define RouteDiscovery_route_tag 2
|
||||||
#define User_id_tag 1
|
#define User_id_tag 1
|
||||||
#define User_long_name_tag 2
|
#define User_long_name_tag 2
|
||||||
#define User_short_name_tag 3
|
#define User_short_name_tag 3
|
||||||
|
@ -268,19 +282,26 @@ typedef struct _ToRadio {
|
||||||
#define NodeInfo_user_tag 2
|
#define NodeInfo_user_tag 2
|
||||||
#define NodeInfo_position_tag 3
|
#define NodeInfo_position_tag 3
|
||||||
#define NodeInfo_snr_tag 7
|
#define NodeInfo_snr_tag 7
|
||||||
|
#define NodeInfo_next_hop_tag 5
|
||||||
#define RadioConfig_preferences_tag 1
|
#define RadioConfig_preferences_tag 1
|
||||||
#define RadioConfig_channel_settings_tag 2
|
#define RadioConfig_channel_settings_tag 2
|
||||||
|
#define SubPacket_success_id_tag 10
|
||||||
|
#define SubPacket_fail_id_tag 11
|
||||||
|
#define SubPacket_request_tag 6
|
||||||
|
#define SubPacket_reply_tag 7
|
||||||
#define SubPacket_position_tag 1
|
#define SubPacket_position_tag 1
|
||||||
#define SubPacket_data_tag 3
|
#define SubPacket_data_tag 3
|
||||||
#define SubPacket_user_tag 4
|
#define SubPacket_user_tag 4
|
||||||
#define SubPacket_want_response_tag 5
|
#define SubPacket_want_response_tag 5
|
||||||
|
#define SubPacket_dest_tag 9
|
||||||
#define MeshPacket_decoded_tag 3
|
#define MeshPacket_decoded_tag 3
|
||||||
#define MeshPacket_encrypted_tag 8
|
#define MeshPacket_encrypted_tag 8
|
||||||
#define MeshPacket_from_tag 1
|
#define MeshPacket_from_tag 1
|
||||||
#define MeshPacket_to_tag 2
|
#define MeshPacket_to_tag 2
|
||||||
#define MeshPacket_rx_time_tag 9
|
|
||||||
#define MeshPacket_id_tag 6
|
#define MeshPacket_id_tag 6
|
||||||
|
#define MeshPacket_rx_time_tag 9
|
||||||
#define MeshPacket_rx_snr_tag 7
|
#define MeshPacket_rx_snr_tag 7
|
||||||
|
#define MeshPacket_hop_limit_tag 10
|
||||||
#define DeviceState_radio_tag 1
|
#define DeviceState_radio_tag 1
|
||||||
#define DeviceState_my_node_tag 2
|
#define DeviceState_my_node_tag 2
|
||||||
#define DeviceState_owner_tag 3
|
#define DeviceState_owner_tag 3
|
||||||
|
@ -326,20 +347,27 @@ X(a, STATIC, SINGULAR, FIXED_LENGTH_BYTES, macaddr, 4)
|
||||||
#define User_DEFAULT NULL
|
#define User_DEFAULT NULL
|
||||||
|
|
||||||
#define RouteDiscovery_FIELDLIST(X, a) \
|
#define RouteDiscovery_FIELDLIST(X, a) \
|
||||||
X(a, CALLBACK, REPEATED, INT32, route, 2)
|
X(a, STATIC, REPEATED, INT32, route, 2)
|
||||||
#define RouteDiscovery_CALLBACK pb_default_field_callback
|
#define RouteDiscovery_CALLBACK NULL
|
||||||
#define RouteDiscovery_DEFAULT NULL
|
#define RouteDiscovery_DEFAULT NULL
|
||||||
|
|
||||||
#define SubPacket_FIELDLIST(X, a) \
|
#define SubPacket_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, position, 1) \
|
X(a, STATIC, OPTIONAL, MESSAGE, position, 1) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, data, 3) \
|
X(a, STATIC, OPTIONAL, MESSAGE, data, 3) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, user, 4) \
|
X(a, STATIC, OPTIONAL, MESSAGE, user, 4) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, want_response, 5)
|
X(a, STATIC, SINGULAR, BOOL, want_response, 5) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (route,request,route.request), 6) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (route,reply,route.reply), 7) \
|
||||||
|
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)
|
||||||
#define SubPacket_CALLBACK NULL
|
#define SubPacket_CALLBACK NULL
|
||||||
#define SubPacket_DEFAULT NULL
|
#define SubPacket_DEFAULT NULL
|
||||||
#define SubPacket_position_MSGTYPE Position
|
#define SubPacket_position_MSGTYPE Position
|
||||||
#define SubPacket_data_MSGTYPE Data
|
#define SubPacket_data_MSGTYPE Data
|
||||||
#define SubPacket_user_MSGTYPE User
|
#define SubPacket_user_MSGTYPE User
|
||||||
|
#define SubPacket_route_request_MSGTYPE RouteDiscovery
|
||||||
|
#define SubPacket_route_reply_MSGTYPE RouteDiscovery
|
||||||
|
|
||||||
#define MeshPacket_FIELDLIST(X, a) \
|
#define MeshPacket_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, from, 1) \
|
X(a, STATIC, SINGULAR, UINT32, from, 1) \
|
||||||
|
@ -348,7 +376,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload,decoded,decoded), 3) \
|
||||||
X(a, STATIC, ONEOF, BYTES, (payload,encrypted,encrypted), 8) \
|
X(a, STATIC, ONEOF, BYTES, (payload,encrypted,encrypted), 8) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, id, 6) \
|
X(a, STATIC, SINGULAR, UINT32, id, 6) \
|
||||||
X(a, STATIC, SINGULAR, FLOAT, rx_snr, 7) \
|
X(a, STATIC, SINGULAR, FLOAT, rx_snr, 7) \
|
||||||
X(a, STATIC, SINGULAR, FIXED32, rx_time, 9)
|
X(a, STATIC, SINGULAR, FIXED32, rx_time, 9) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, hop_limit, 10)
|
||||||
#define MeshPacket_CALLBACK NULL
|
#define MeshPacket_CALLBACK NULL
|
||||||
#define MeshPacket_DEFAULT NULL
|
#define MeshPacket_DEFAULT NULL
|
||||||
#define MeshPacket_payload_decoded_MSGTYPE SubPacket
|
#define MeshPacket_payload_decoded_MSGTYPE SubPacket
|
||||||
|
@ -387,9 +416,10 @@ X(a, STATIC, SINGULAR, BOOL, promiscuous_mode, 101)
|
||||||
#define RadioConfig_UserPreferences_DEFAULT NULL
|
#define RadioConfig_UserPreferences_DEFAULT NULL
|
||||||
|
|
||||||
#define NodeInfo_FIELDLIST(X, a) \
|
#define NodeInfo_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, INT32, num, 1) \
|
X(a, STATIC, SINGULAR, UINT32, num, 1) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, user, 2) \
|
X(a, STATIC, OPTIONAL, MESSAGE, user, 2) \
|
||||||
X(a, STATIC, OPTIONAL, MESSAGE, position, 3) \
|
X(a, STATIC, OPTIONAL, MESSAGE, position, 3) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, next_hop, 5) \
|
||||||
X(a, STATIC, SINGULAR, FLOAT, snr, 7)
|
X(a, STATIC, SINGULAR, FLOAT, snr, 7)
|
||||||
#define NodeInfo_CALLBACK NULL
|
#define NodeInfo_CALLBACK NULL
|
||||||
#define NodeInfo_DEFAULT NULL
|
#define NodeInfo_DEFAULT NULL
|
||||||
|
@ -496,18 +526,18 @@ extern const pb_msgdesc_t ToRadio_msg;
|
||||||
#define Position_size 39
|
#define Position_size 39
|
||||||
#define Data_size 256
|
#define Data_size 256
|
||||||
#define User_size 72
|
#define User_size 72
|
||||||
/* RouteDiscovery_size depends on runtime parameters */
|
#define RouteDiscovery_size 88
|
||||||
#define SubPacket_size 376
|
#define SubPacket_size 478
|
||||||
#define MeshPacket_size 407
|
#define MeshPacket_size 515
|
||||||
#define ChannelSettings_size 60
|
#define ChannelSettings_size 60
|
||||||
#define RadioConfig_size 136
|
#define RadioConfig_size 136
|
||||||
#define RadioConfig_UserPreferences_size 72
|
#define RadioConfig_UserPreferences_size 72
|
||||||
#define NodeInfo_size 131
|
#define NodeInfo_size 132
|
||||||
#define MyNodeInfo_size 85
|
#define MyNodeInfo_size 85
|
||||||
#define DeviceState_size 18124
|
#define DeviceState_size 21720
|
||||||
#define DebugString_size 258
|
#define DebugString_size 258
|
||||||
#define FromRadio_size 416
|
#define FromRadio_size 524
|
||||||
#define ToRadio_size 410
|
#define ToRadio_size 518
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|
Ładowanie…
Reference in New Issue