firmware/src/plugins/StoreForwardPlugin.cpp

75 lines
1.4 KiB
C++
Raw Normal View History

#include "StoreForwardPlugin.h"
#include "MeshService.h"
#include "NodeDB.h"
#include "RTC.h"
#include "Router.h"
#include "configuration.h"
#include <Arduino.h>
2021-02-14 22:01:08 +00:00
#include <assert.h>
StoreForwardPlugin *storeForwardPlugin;
StoreForwardPluginRadio *storeForwardPluginRadio;
2021-02-14 16:44:49 +00:00
StoreForwardPlugin::StoreForwardPlugin() : concurrency::OSThread("StoreForwardPlugin") {}
int32_t StoreForwardPlugin::runOnce()
{
#ifndef NO_ESP32
/*
Uncomment the preferences below if you want to use the plugin
without having to configure it from the PythonAPI or WebUI.
*/
2021-02-14 22:01:08 +00:00
if (0) {
if (firstTime) {
2021-02-14 22:01:08 +00:00
storeForwardPluginRadio = new StoreForwardPluginRadio();
firstTime = 0;
} else {
2021-02-14 22:01:08 +00:00
}
2021-02-14 22:01:08 +00:00
return (10);
} else {
2021-02-14 22:01:08 +00:00
DEBUG_MSG("StoreForwardPlugin Disabled\n");
return (INT32_MAX);
}
#endif
}
MeshPacket *StoreForwardPluginRadio::allocReply()
{
auto reply = allocDataPacket(); // Allocate a packet for sending
return reply;
}
void StoreForwardPluginRadio::sendPayload(NodeNum dest, bool wantReplies)
{
MeshPacket *p = allocReply();
p->to = dest;
p->decoded.want_response = wantReplies;
service.sendToMesh(p);
}
bool StoreForwardPluginRadio::handleReceived(const MeshPacket &mp)
{
#ifndef NO_ESP32
#endif
return true; // Let others look at this message also if they want
}