firmware/src/modules/RoutingModule.h

36 lines
1.1 KiB
C
Raw Normal View History

2021-02-17 05:06:23 +00:00
#pragma once
#include "ProtobufPlugin.h"
2021-03-12 06:10:36 +00:00
#include "Channels.h"
2021-02-17 05:06:23 +00:00
/**
* Routing module for router control messages
2021-02-17 05:06:23 +00:00
*/
2022-02-27 10:21:02 +00:00
class RoutingModule : public ProtobufPlugin<Routing>
2021-02-17 05:06:23 +00:00
{
public:
/** Constructor
* name is for debugging output
*/
2022-02-27 10:21:02 +00:00
RoutingModule();
2021-02-17 05:06:23 +00:00
2021-03-12 06:10:36 +00:00
void sendAckNak(Routing_Error err, NodeNum to, PacketId idFrom, ChannelIndex chIndex);
2021-02-17 05:06:23 +00:00
protected:
friend class Router;
/** Called to handle a particular incoming message
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
*/
2022-01-24 17:24:40 +00:00
virtual bool handleReceivedProtobuf(const MeshPacket &mp, Routing *p) override;
2021-02-17 05:06:23 +00:00
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
* so that subclasses can (optionally) send a response back to the original sender. */
2022-01-24 17:24:40 +00:00
virtual MeshPacket *allocReply() override;
2021-02-17 05:06:23 +00:00
2021-02-23 06:35:34 +00:00
/// Override wantPacket to say we want to see all packets, not just those for our port number
2022-01-24 17:24:40 +00:00
virtual bool wantPacket(const MeshPacket *p) override { return true; }
2021-02-17 05:06:23 +00:00
};
2022-02-27 10:21:02 +00:00
extern RoutingModule *routingModule;