2022-08-22 16:41:23 -05:00
|
|
|
#pragma once
|
|
|
|
|
#include "Observer.h"
|
2023-01-21 14:34:29 +01:00
|
|
|
#include "SinglePortModule.h"
|
2022-08-22 16:41:23 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Waypoint message handling for meshtastic
|
|
|
|
|
*/
|
2024-06-29 21:16:07 -05:00
|
|
|
class WaypointModule : public SinglePortModule, public Observable<const UIFrameEvent *>
|
2022-08-22 16:41:23 -05:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/** Constructor
|
|
|
|
|
* name is for debugging output
|
|
|
|
|
*/
|
2023-01-21 18:22:19 +01:00
|
|
|
WaypointModule() : SinglePortModule("waypoint", meshtastic_PortNum_WAYPOINT_APP) {}
|
2024-06-29 21:16:07 -05:00
|
|
|
#if HAS_SCREEN
|
|
|
|
|
bool shouldDraw();
|
|
|
|
|
#endif
|
2022-08-22 16:41:23 -05:00
|
|
|
protected:
|
|
|
|
|
/** Called to handle a particular incoming message
|
|
|
|
|
|
2023-01-21 14:34:29 +01:00
|
|
|
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for
|
|
|
|
|
it
|
2022-08-22 16:41:23 -05:00
|
|
|
*/
|
2024-06-29 21:16:07 -05:00
|
|
|
|
|
|
|
|
virtual Observable<const UIFrameEvent *> *getUIFrameObservable() override { return this; }
|
|
|
|
|
#if HAS_SCREEN
|
|
|
|
|
virtual bool wantUIFrame() override { return this->shouldDraw(); }
|
|
|
|
|
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override;
|
|
|
|
|
#endif
|
2023-01-21 18:22:19 +01:00
|
|
|
virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override;
|
2022-08-22 16:41:23 -05:00
|
|
|
};
|
|
|
|
|
|
2024-06-29 21:16:07 -05:00
|
|
|
extern WaypointModule *waypointModule;
|