2026-01-18 15:15:31 -06:00
|
|
|
#pragma once
|
|
|
|
|
#if !MESHTASTIC_EXCLUDE_STATUS
|
|
|
|
|
#include "SinglePortModule.h"
|
|
|
|
|
#include "configuration.h"
|
|
|
|
|
|
|
|
|
|
class StatusMessageModule : public SinglePortModule, private concurrency::OSThread
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
/** Constructor
|
|
|
|
|
* name is for debugging output
|
|
|
|
|
*/
|
2026-01-20 10:42:23 -06:00
|
|
|
StatusMessageModule()
|
|
|
|
|
: SinglePortModule("statusMessage", meshtastic_PortNum_NODE_STATUS_APP), concurrency::OSThread("StatusMessage")
|
2026-01-18 15:15:31 -06:00
|
|
|
{
|
2026-01-20 10:42:23 -06:00
|
|
|
if (moduleConfig.has_statusmessage && moduleConfig.statusmessage.node_status[0] != '\0') {
|
|
|
|
|
this->setInterval(2 * 60 * 1000);
|
2026-01-20 18:10:40 -06:00
|
|
|
} else {
|
|
|
|
|
this->setInterval(1000 * 12 * 60 * 60);
|
2026-01-20 10:42:23 -06:00
|
|
|
}
|
|
|
|
|
// TODO: If we have a string, set the initial delay (15 minutes maybe)
|
2026-01-18 15:15:31 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual int32_t runOnce() override;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
/** Called to handle a particular incoming message
|
|
|
|
|
*/
|
|
|
|
|
virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern StatusMessageModule *statusMessageModule;
|
|
|
|
|
#endif
|