2020-12-05 10:00:46 +08:00
|
|
|
#pragma once
|
2020-11-28 12:10:19 +08:00
|
|
|
#include "Observer.h"
|
2023-01-21 14:34:29 +01:00
|
|
|
#include "SinglePortModule.h"
|
2020-11-28 12:10:19 +08:00
|
|
|
|
|
|
|
|
/**
|
2025-09-23 01:05:22 -04:00
|
|
|
* Text message handling for Meshtastic.
|
|
|
|
|
*
|
|
|
|
|
* This module is responsible for receiving and storing incoming text messages
|
|
|
|
|
* from the mesh. It updates device state and notifies observers so that other
|
|
|
|
|
* components (such as the MessageRenderer) can later display or process them.
|
|
|
|
|
*
|
|
|
|
|
* Rendering of messages on screen is no longer done here.
|
2020-11-28 12:10:19 +08:00
|
|
|
*/
|
2023-01-21 18:22:19 +01:00
|
|
|
class TextMessageModule : public SinglePortModule, public Observable<const meshtastic_MeshPacket *>
|
2020-11-28 12:10:19 +08:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/** Constructor
|
|
|
|
|
* name is for debugging output
|
|
|
|
|
*/
|
2023-01-21 18:22:19 +01:00
|
|
|
TextMessageModule() : SinglePortModule("text", meshtastic_PortNum_TEXT_MESSAGE_APP) {}
|
2020-11-28 12:10:19 +08:00
|
|
|
|
2020-11-28 13:51:51 +08:00
|
|
|
protected:
|
2020-11-28 12:10:19 +08:00
|
|
|
/** Called to handle a particular incoming message
|
2025-09-23 01:05:22 -04:00
|
|
|
*
|
|
|
|
|
* @return ProcessMessage::STOP if you've guaranteed you've handled this
|
|
|
|
|
* message and no other handlers should be considered for it.
|
|
|
|
|
*/
|
2023-01-21 18:22:19 +01:00
|
|
|
virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override;
|
2023-08-19 07:46:34 -05:00
|
|
|
virtual bool wantPacket(const meshtastic_MeshPacket *p) override;
|
2020-11-28 12:10:19 +08:00
|
|
|
};
|
|
|
|
|
|
2025-09-26 00:28:25 -04:00
|
|
|
extern TextMessageModule *textMessageModule;
|