firmware/src/mesh/SinglePortPlugin.h

25 lines
606 B
C
Raw Normal View History

2020-12-05 02:14:15 +00:00
#pragma once
#include "MeshPlugin.h"
/**
* Most plugins are only interested in sending/receving one particular portnum. This baseclass simplifies that common
* case.
*/
class SinglePortPlugin : public MeshPlugin
{
protected:
PortNum ourPortNum;
public:
/** Constructor
* name is for debugging output
*/
SinglePortPlugin(const char *_name, PortNum _ourPortNum) : MeshPlugin(_name), ourPortNum(_ourPortNum) {}
protected:
/**
* @return true if you want to receive the specified portnum
*/
virtual bool wantPortnum(PortNum p) { return p == ourPortNum; }
};