sforkowany z mirror/meshtastic-firmware
Update to store and forward. Don't merge this to main!
rodzic
ae46b3df32
commit
f1a65f9d0e
|
@ -21,7 +21,7 @@ Not necessarily in this order:
|
|||
|
||||
UC 1) MVP - automagically forward packets to a client that may have missed packets.
|
||||
|
||||
UC 2) Client Interface (Web, Android, Python or iOS when that happens) to optionally request packets be resent. This is to support the case where the client may not have received the message the Router has not detected that the client was away. This is because the router will only know you're away if you've been gone for a long time but will have no way of knowing if you were offline for a few minutes. This will cover the case where you have ducked into a cave or you're swapping out your battery.
|
||||
UC 2) Client Interface (Web, Android, Python or iOS when that happens) to optionally request packets be resent. This is to support the case where Router has not detected that the client was away. This is because the router will only know you're away if you've been gone for a period of time but will have no way of knowing if you were offline for a short number of minutes. This will cover the case where you have ducked into a cave or you're swapping out your battery.
|
||||
|
||||
UC 3) router sends a periodic “heartbeat” to let the clients know they’re part of the main mesh
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include "configuration.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <assert.h>
|
||||
//#include <assert.h>
|
||||
|
||||
/*
|
||||
|
||||
|
|
|
@ -31,7 +31,11 @@ void setupPlugins()
|
|||
*/
|
||||
new SerialPlugin();
|
||||
new ExternalNotificationPlugin();
|
||||
|
||||
//rangeTestPlugin = new RangeTestPlugin();
|
||||
//storeForwardPlugin = new StoreForwardPlugin();
|
||||
rangeTestPlugin = new RangeTestPlugin();
|
||||
|
||||
new RangeTestPlugin();
|
||||
new StoreForwardPlugin();
|
||||
#endif
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
#include "configuration.h"
|
||||
#include <Arduino.h>
|
||||
#include <SPIFFS.h>
|
||||
#include <assert.h>
|
||||
//#include <assert.h>
|
||||
|
||||
/*
|
||||
As a sender, I can send packets every n-seonds. These packets include an incramented PacketID.
|
||||
|
|
|
@ -6,22 +6,15 @@
|
|||
#include "configuration.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#define STORE_RECORDS 5000
|
||||
#define BYTES_PER_RECORDS 512
|
||||
|
||||
#define STOREFORWARDPLUGIN_ENABLED 0
|
||||
|
||||
StoreForwardPlugin *storeForwardPlugin;
|
||||
StoreForwardPluginRadio *storeForwardPluginRadio;
|
||||
|
||||
StoreForwardPlugin::StoreForwardPlugin() : concurrency::OSThread("SerialPlugin") {}
|
||||
|
||||
// char serialStringChar[Constants_DATA_PAYLOAD_LEN];
|
||||
StoreForwardPlugin::StoreForwardPlugin() : concurrency::OSThread("StoreForwardPlugin") {}
|
||||
|
||||
int32_t StoreForwardPlugin::runOnce()
|
||||
{
|
||||
#if 0
|
||||
|
||||
#ifndef NO_ESP32
|
||||
|
||||
/*
|
||||
|
@ -29,15 +22,15 @@ int32_t StoreForwardPlugin::runOnce()
|
|||
without having to configure it from the PythonAPI or WebUI.
|
||||
*/
|
||||
|
||||
// radioConfig.preferences.store_forward_plugin_enabled = 1;
|
||||
// radioConfig.preferences.store_forward_plugin_records = 80;
|
||||
radioConfig.preferences.store_forward_plugin_enabled = 0;
|
||||
|
||||
if (radioConfig.preferences.store_forward_plugin_enabled) {
|
||||
|
||||
if (firstTime) {
|
||||
|
||||
// Interface with the serial peripheral from in here.
|
||||
DEBUG_MSG("Initializing Store & Forward Plugin\n");
|
||||
/*
|
||||
*/
|
||||
|
||||
// Router
|
||||
if (radioConfig.preferences.is_router) {
|
||||
|
@ -62,8 +55,7 @@ int32_t StoreForwardPlugin::runOnce()
|
|||
// Non-Router
|
||||
} else {
|
||||
}
|
||||
|
||||
storeForwardPluginRadio = new StoreForwardPluginRadio();
|
||||
// storeForwardPluginRadio = new StoreForwardPluginRadio();
|
||||
|
||||
firstTime = 0;
|
||||
|
||||
|
@ -71,7 +63,7 @@ int32_t StoreForwardPlugin::runOnce()
|
|||
// TBD
|
||||
}
|
||||
|
||||
return (10);
|
||||
return (1000);
|
||||
} else {
|
||||
DEBUG_MSG("Store & Forward Plugin - Disabled\n");
|
||||
|
||||
|
@ -79,6 +71,8 @@ int32_t StoreForwardPlugin::runOnce()
|
|||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
return (INT32_MAX);
|
||||
}
|
||||
|
||||
MeshPacket *StoreForwardPluginRadio::allocReply()
|
||||
|
@ -91,35 +85,36 @@ MeshPacket *StoreForwardPluginRadio::allocReply()
|
|||
|
||||
void StoreForwardPluginRadio::sendPayload(NodeNum dest, bool wantReplies)
|
||||
{
|
||||
#if 0
|
||||
MeshPacket *p = allocReply();
|
||||
p->to = dest;
|
||||
p->decoded.want_response = wantReplies;
|
||||
|
||||
// p->want_ack = SERIALPLUGIN_ACK;
|
||||
|
||||
// p->decoded.data.payload.size = strlen(serialStringChar); // You must specify how many bytes are in the reply
|
||||
// memcpy(p->decoded.data.payload.bytes, serialStringChar, p->decoded.data.payload.size);
|
||||
|
||||
service.sendToMesh(p);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool StoreForwardPluginRadio::handleReceived(const MeshPacket &mp)
|
||||
{
|
||||
|
||||
#if 0
|
||||
#ifndef NO_ESP32
|
||||
|
||||
if (STOREFORWARDPLUGIN_ENABLED) {
|
||||
if (radioConfig.preferences.store_forward_plugin_enabled) {
|
||||
|
||||
// auto &p = mp.decoded.data;
|
||||
|
||||
if (mp.from != nodeDB.getNodeNum()) {
|
||||
DEBUG_MSG("Store & Forward Plugin ---------- ---------- ---------- ---------- ----------\n");
|
||||
printPacket("PACKET FROM PHONE", &mp);
|
||||
DEBUG_MSG("Store & Forward Plugin -- Print Start ---------- ---------- ---------- ---------- ----------\n");
|
||||
printPacket("PACKET FROM RADIO", &mp);
|
||||
DEBUG_MSG("Store & Forward Plugin -- Print End ---------- ---------- ---------- ---------- ----------\n");
|
||||
}
|
||||
|
||||
} else {
|
||||
DEBUG_MSG("Store & Forward Plugin - Disabled\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return true; // Let others look at this message also if they want
|
||||
|
|
|
@ -20,22 +20,16 @@ class StoreForwardPlugin : private concurrency::OSThread
|
|||
extern StoreForwardPlugin *storeForwardPlugin;
|
||||
|
||||
/*
|
||||
* Radio interface for SerialPlugin
|
||||
* Radio interface for StoreForwardPlugin
|
||||
*
|
||||
*/
|
||||
class StoreForwardPluginRadio : public SinglePortPlugin
|
||||
{
|
||||
uint32_t lastRxID;
|
||||
//uint32_t lastRxID;
|
||||
|
||||
public:
|
||||
/*
|
||||
TODO: Switch this to PortNum_SERIAL_APP once the change is able to be merged back here
|
||||
from the main code.
|
||||
*/
|
||||
|
||||
// SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_TEXT_MESSAGE_APP) {}
|
||||
// SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_STORE_FORWARD_APP) {}
|
||||
StoreForwardPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_SERIAL_APP) {}
|
||||
StoreForwardPluginRadio() : SinglePortPlugin("StoreForwardPluginRadio", PortNum_STORE_FORWARD_APP) {}
|
||||
//StoreForwardPluginRadio() : SinglePortPlugin("StoreForwardPluginRadio", PortNum_TEXT_MESSAGE_APP) {}
|
||||
|
||||
/**
|
||||
* Send our payload into the mesh
|
||||
|
@ -45,7 +39,7 @@ class StoreForwardPluginRadio : public SinglePortPlugin
|
|||
protected:
|
||||
virtual MeshPacket *allocReply();
|
||||
|
||||
virtual bool wantPortnum(PortNum p){return true;};
|
||||
//virtual bool wantPortnum(PortNum p){return true;};
|
||||
|
||||
/** Called to handle a particular incoming message
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue