Rename MeshPlugin, SinglePortPlugin and ProtobufPlugin

This commit is contained in:
Sacha Weatherstone
2022-03-09 19:01:43 +11:00
parent 46b8b61b7f
commit 6bee95d6b2
33 changed files with 80 additions and 80 deletions

View File

@@ -0,0 +1,39 @@
#pragma once
#include "MeshModule.h"
#include "Router.h"
/**
* Most modules are only interested in sending/receving one particular portnum. This baseclass simplifies that common
* case.
*/
class SinglePortModule : public MeshModule
{
protected:
PortNum ourPortNum;
public:
/** Constructor
* name is for debugging output
*/
SinglePortModule(const char *_name, PortNum _ourPortNum) : MeshModule(_name), ourPortNum(_ourPortNum) {}
protected:
/**
* @return true if you want to receive the specified portnum
*/
virtual bool wantPacket(const MeshPacket *p) override { return p->decoded.portnum == ourPortNum; }
/**
* Return a mesh packet which has been preinited as a data packet with a particular port number.
* You can then send this packet (after customizing any of the payload fields you might need) with
* service.sendToMesh()
*/
MeshPacket *allocDataPacket()
{
// Update our local node info with our position (even if we don't decide to update anyone else)
MeshPacket *p = router->allocForSending();
p->decoded.portnum = ourPortNum;
return p;
}
};