Added waypoint module routing

This commit is contained in:
Ben Meadors 2022-08-19 14:48:24 -05:00
parent 579ebbffe2
commit d6811b9e35
3 changed files with 45 additions and 1 deletions

View File

@ -13,8 +13,9 @@
#include "modules/ReplyModule.h" #include "modules/ReplyModule.h"
#include "modules/RoutingModule.h" #include "modules/RoutingModule.h"
#include "modules/TextMessageModule.h" #include "modules/TextMessageModule.h"
#include "modules/Telemetry/DeviceTelemetry.h" #include "modules/WaypointModule.h"
#if HAS_TELEMETRY #if HAS_TELEMETRY
#include "modules/Telemetry/DeviceTelemetry.h"
#include "modules/Telemetry/EnvironmentTelemetry.h" #include "modules/Telemetry/EnvironmentTelemetry.h"
#endif #endif
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
@ -34,6 +35,7 @@ void setupModules()
adminModule = new AdminModule(); adminModule = new AdminModule();
nodeInfoModule = new NodeInfoModule(); nodeInfoModule = new NodeInfoModule();
positionModule = new PositionModule(); positionModule = new PositionModule();
waypointModule = new WaypointModule();
textMessageModule = new TextMessageModule(); textMessageModule = new TextMessageModule();
// Note: if the rest of meshtastic doesn't need to explicitly use your module, you do not need to assign the instance // Note: if the rest of meshtastic doesn't need to explicitly use your module, you do not need to assign the instance

View File

@ -0,0 +1,17 @@
#include "configuration.h"
#include "WaypointModule.h"
#include "NodeDB.h"
#include "PowerFSM.h"
WaypointModule *waypointModule;
ProcessMessage WaypointModule::handleReceived(const MeshPacket &mp)
{
auto &p = mp.decoded;
DEBUG_MSG("Received waypoint msg from=0x%0x, id=0x%x, msg=%.*s\n", mp.from, mp.id, p.payload.size, p.payload.bytes);
notifyObservers(&mp);
return ProcessMessage::CONTINUE; // Let others look at this message also if they want
}

View File

@ -0,0 +1,25 @@
#pragma once
#include "SinglePortModule.h"
#include "Observer.h"
/**
* Waypoint message handling for meshtastic
*/
class WaypointModule : public SinglePortModule, public Observable<const MeshPacket *>
{
public:
/** Constructor
* name is for debugging output
*/
WaypointModule() : SinglePortModule("waypoint", PortNum_WAYPOINT_APP) {}
protected:
/** Called to handle a particular incoming message
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
*/
virtual ProcessMessage handleReceived(const MeshPacket &mp) override;
};
extern WaypointModule *waypointModule;