* refactored the hasSeen(Packet) stuff.

This commit is contained in:
Scott Powell 2025-01-14 06:43:03 +11:00
parent 8983584dd8
commit 20fccac2b7
10 changed files with 68 additions and 133 deletions

View file

@ -26,6 +26,14 @@ public:
uint8_t secret[PUB_KEY_SIZE];
};
/**
* An abstraction of the data tables needed to be maintained
*/
class MeshTables {
public:
virtual bool hasSeen(const Packet* packet) = 0;
};
/**
* \brief The next layer in the basic Dispatcher task, Mesh recognises the particular Payload TYPES,
* and provides virtual methods for sub-classes on handling incoming, and also preparing outbound Packets.
@ -33,6 +41,7 @@ public:
class Mesh : public Dispatcher {
RTCClock* _rtc;
RNG* _rng;
MeshTables* _tables;
protected:
DispatcherAction onRecvPacket(Packet* pkt) override;
@ -117,8 +126,8 @@ protected:
*/
virtual void onAckRecv(Packet* packet, uint32_t ack_crc) { }
Mesh(Radio& radio, MillisecondClock& ms, RNG& rng, RTCClock& rtc, PacketManager& mgr)
: Dispatcher(radio, ms, mgr), _rng(&rng), _rtc(&rtc)
Mesh(Radio& radio, MillisecondClock& ms, RNG& rng, RTCClock& rtc, PacketManager& mgr, MeshTables& tables)
: Dispatcher(radio, ms, mgr), _rng(&rng), _rtc(&rtc), _tables(&tables)
{
}