mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-21 02:02:23 +00:00
Move text message handling into the new plugin system
This commit is contained in:
22
src/mesh/MeshPlugin.cpp
Normal file
22
src/mesh/MeshPlugin.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "MeshPlugin.h"
|
||||
#include <assert.h>
|
||||
|
||||
std::vector<MeshPlugin *> MeshPlugin::plugins;
|
||||
|
||||
MeshPlugin::MeshPlugin(const char *_name) : name(_name) {
|
||||
plugins.push_back(this);
|
||||
}
|
||||
|
||||
MeshPlugin::~MeshPlugin()
|
||||
{
|
||||
assert(0); // FIXME - remove from list of plugins once someone needs this feature
|
||||
}
|
||||
|
||||
void MeshPlugin::callPlugins(const MeshPacket &mp)
|
||||
{
|
||||
for (auto i = plugins.begin(); i != plugins.end(); ++i) {
|
||||
if ((*i)->wantPortnum(mp.decoded.data.portnum))
|
||||
if ((*i)->handleReceived(mp))
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user