mirror of
https://github.com/meshtastic/firmware.git
synced 2026-02-02 15:11:48 +00:00
Canned Messages via InkHUD menu (#7096)
* Allow observers to respond to AdminMessage requests
Ground work for CannedMessage getters and setters
* Enable CannedMessage config in apps for InkHUD devices
* Migrate the InkHUD::Events AdminModule observer
Use the new AdminModule_ObserverData struct
* Bare-bones NicheGraphics util to access canned messages
Handles loading and parsing. Handle admin messages for setting and getting.
* Send canned messages via on-screen menu
* Change ThreadedMessageApplet from Observer to Module API
Allows us to intercept locally generated packets ('loopbackOK = true'), to handle outgoing canned messages.
* Fix: crash getting empty canned message string via Client API
* Move file into Utils subdir
* Move an include statement from .cpp to .h
* Limit strncpy size of dest, not source
Wasn't critical in ths specific case, but definitely a mistake.
This commit is contained in:
@@ -30,7 +30,7 @@ namespace NicheGraphics::InkHUD
|
||||
|
||||
class Applet;
|
||||
|
||||
class ThreadedMessageApplet : public Applet
|
||||
class ThreadedMessageApplet : public Applet, public SinglePortModule
|
||||
{
|
||||
public:
|
||||
explicit ThreadedMessageApplet(uint8_t channelIndex);
|
||||
@@ -41,16 +41,11 @@ class ThreadedMessageApplet : public Applet
|
||||
void onActivate() override;
|
||||
void onDeactivate() override;
|
||||
void onShutdown() override;
|
||||
int onReceiveTextMessage(const meshtastic_MeshPacket *p);
|
||||
ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override;
|
||||
|
||||
bool approveNotification(Notification &n) override; // Which notifications to suppress
|
||||
|
||||
protected:
|
||||
// Used to register our text message callback
|
||||
CallbackObserver<ThreadedMessageApplet, const meshtastic_MeshPacket *> textMessageObserver =
|
||||
CallbackObserver<ThreadedMessageApplet, const meshtastic_MeshPacket *>(this,
|
||||
&ThreadedMessageApplet::onReceiveTextMessage);
|
||||
|
||||
void saveMessagesToFlash();
|
||||
void loadMessagesFromFlash();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user