wip reliable unicast (1 hop)

This commit is contained in:
geeksville
2020-05-19 11:56:17 -07:00
parent cca4867987
commit 8bf4919576
8 changed files with 289 additions and 95 deletions

View File

@@ -44,7 +44,7 @@ class Router
* do idle processing
* Mostly looking in our incoming rxPacket queue and calling handleReceived.
*/
void loop();
virtual void loop();
/**
* Send a packet on a suitable interface. This routine will
@@ -53,6 +53,13 @@ class Router
*/
virtual ErrorCode send(MeshPacket *p);
/// Allocate and return a meshpacket which defaults as send to broadcast from the current node.
MeshPacket *allocForSending();
/**
* @return our local nodenum */
NodeNum getNodeNum();
protected:
/**
* Called from loop()
@@ -65,10 +72,21 @@ class Router
virtual void handleReceived(MeshPacket *p);
/**
* Every (non duplicate) packet this node receives will be passed through this method. This allows subclasses to
* Every (non duplicate) packet this node receives will be passed through this method. This allows subclasses to
* update routing tables etc... based on what we overhear (even for messages not destined to our node)
*/
virtual void sniffReceived(MeshPacket *p);
/**
* Remove any encryption and decode the protobufs inside this packet (if necessary).
*
* @return true for success, false for corrupt packet.
*/
bool perhapsDecode(MeshPacket *p);
};
extern Router &router;
extern Router &router;
/// Generate a unique packet id
// FIXME, move this someplace better
PacketId generatePacketId();