mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-30 03:13:51 +00:00
#668 Partial work for store & forward
This commit is contained in:
parent
36643cf5f5
commit
3201d1c3bc
@ -11,14 +11,6 @@
|
|||||||
#define STORE_RECORDS 5000
|
#define STORE_RECORDS 5000
|
||||||
#define BYTES_PER_RECORDS 512
|
#define BYTES_PER_RECORDS 512
|
||||||
|
|
||||||
struct sfRecord
|
|
||||||
{
|
|
||||||
uint8_t bytes[BYTES_PER_RECORDS];
|
|
||||||
uint32_t timestamp; // Time the packet was received
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sfRecord records[STORE_RECORDS];
|
|
||||||
|
|
||||||
#define STOREFORWARDPLUGIN_ENABLED 0
|
#define STOREFORWARDPLUGIN_ENABLED 0
|
||||||
|
|
||||||
StoreForwardPlugin *storeForwardPlugin;
|
StoreForwardPlugin *storeForwardPlugin;
|
||||||
@ -69,7 +61,6 @@ int32_t StoreForwardPlugin::runOnce()
|
|||||||
|
|
||||||
// Non-Router
|
// Non-Router
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
storeForwardPluginRadio = new StoreForwardPluginRadio();
|
storeForwardPluginRadio = new StoreForwardPluginRadio();
|
||||||
@ -118,36 +109,15 @@ bool StoreForwardPluginRadio::handleReceived(const MeshPacket &mp)
|
|||||||
|
|
||||||
if (STOREFORWARDPLUGIN_ENABLED) {
|
if (STOREFORWARDPLUGIN_ENABLED) {
|
||||||
|
|
||||||
auto &p = mp.decoded.data;
|
// auto &p = mp.decoded.data;
|
||||||
// DEBUG_MSG("Received text msg self=0x%0x, from=0x%0x, to=0x%0x, id=%d, msg=%.*s\n",
|
|
||||||
// nodeDB.getNodeNum(), mp.from, mp.to, mp.id, p.payload.size, p.payload.bytes);
|
|
||||||
|
|
||||||
if (mp.from == nodeDB.getNodeNum()) {
|
if (mp.from != nodeDB.getNodeNum()) {
|
||||||
|
DEBUG_MSG("Store & Forward Plugin ---------- ---------- ---------- ---------- ----------\n");
|
||||||
/*
|
printPacket("PACKET FROM PHONE", &mp);
|
||||||
* If radioConfig.preferences.serialplugin_echo is true, then echo the packets that are sent out back to the TX
|
|
||||||
* of the serial interface.
|
|
||||||
*/
|
|
||||||
if (radioConfig.preferences.serialplugin_echo) {
|
|
||||||
|
|
||||||
// For some reason, we get the packet back twice when we send out of the radio.
|
|
||||||
// TODO: need to find out why.
|
|
||||||
if (lastRxID != mp.id) {
|
|
||||||
lastRxID = mp.id;
|
|
||||||
// DEBUG_MSG("* * Message came this device\n");
|
|
||||||
// Serial2.println("* * Message came this device");
|
|
||||||
Serial2.printf("%s", p.payload.bytes);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// DEBUG_MSG("* * Message came from the mesh\n");
|
DEBUG_MSG("Store & Forward Plugin - Disabled\n");
|
||||||
// Serial2.println("* * Message came from the mesh");
|
|
||||||
Serial2.printf("%s", p.payload.bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
DEBUG_MSG("Serial Plugin Disabled\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,6 +34,7 @@ class StoreForwardPluginRadio : public SinglePortPlugin
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_TEXT_MESSAGE_APP) {}
|
// SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_TEXT_MESSAGE_APP) {}
|
||||||
|
// SerialPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_STORE_FORWARD_APP) {}
|
||||||
StoreForwardPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_SERIAL_APP) {}
|
StoreForwardPluginRadio() : SinglePortPlugin("SerialPluginRadio", PortNum_SERIAL_APP) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -44,6 +45,8 @@ class StoreForwardPluginRadio : public SinglePortPlugin
|
|||||||
protected:
|
protected:
|
||||||
virtual MeshPacket *allocReply();
|
virtual MeshPacket *allocReply();
|
||||||
|
|
||||||
|
virtual bool wantPortnum(PortNum p){return true;};
|
||||||
|
|
||||||
/** Called to handle a particular incoming message
|
/** Called to handle a particular incoming message
|
||||||
|
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
|
Loading…
Reference in New Issue
Block a user