move want_replies into new plugin system

This commit is contained in:
Kevin Hester
2020-12-05 11:15:06 +08:00
parent 91b99bd584
commit 3e0dc44210
8 changed files with 44 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
#include "MeshPlugin.h"
#include "NodeDB.h"
#include <assert.h>
std::vector<MeshPlugin *> *MeshPlugin::plugins;
@@ -27,6 +28,11 @@ void MeshPlugin::callPlugins(const MeshPacket &mp)
auto &pi = **i;
if (pi.wantPortnum(mp.decoded.data.portnum)) {
bool handled = pi.handleReceived(mp);
// Possibly send replies (unless we are handling a locally generated message)
if (mp.decoded.want_response && mp.from != nodeDB.getNodeNum())
pi.sendResponse(mp.from);
DEBUG_MSG("Plugin %s handled=%d\n", pi.name, handled);
if (handled)
break;