mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-20 09:43:03 +00:00
34 lines
1.2 KiB
C++
34 lines
1.2 KiB
C++
#pragma once
|
|
#include "../mesh/generated/meshtastic/telemetry.pb.h"
|
|
#include "NodeDB.h"
|
|
#include "ProtobufModule.h"
|
|
#include <OLEDDisplay.h>
|
|
#include <OLEDDisplayUi.h>
|
|
|
|
class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModule<meshtastic_Telemetry>
|
|
{
|
|
public:
|
|
DeviceTelemetryModule()
|
|
: concurrency::OSThread("DeviceTelemetryModule"),
|
|
ProtobufModule("DeviceTelemetry", meshtastic_PortNum_TELEMETRY_APP, &meshtastic_Telemetry_msg)
|
|
{
|
|
setIntervalFromNow(10 * 1000);
|
|
}
|
|
virtual bool wantUIFrame() { return false; }
|
|
|
|
protected:
|
|
/** Called to handle a particular incoming message
|
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
|
*/
|
|
virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *p) override;
|
|
virtual int32_t runOnce() override;
|
|
/**
|
|
* Send our Telemetry into the mesh
|
|
*/
|
|
bool sendTelemetry(NodeNum dest = NODENUM_BROADCAST, bool phoneOnly = false);
|
|
|
|
private:
|
|
uint32_t sendToPhoneIntervalMs = SECONDS_IN_MINUTE * 1000; // Send to phone every minute
|
|
uint32_t lastSentToMesh = 0;
|
|
};
|