2021-01-31 17:12:36 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-03-09 08:01:43 +00:00
|
|
|
#include "SinglePortModule.h"
|
2021-01-31 17:12:36 +00:00
|
|
|
#include "concurrency/OSThread.h"
|
|
|
|
#include "configuration.h"
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include <functional>
|
|
|
|
|
2022-02-27 09:49:24 +00:00
|
|
|
class RangeTestModule : private concurrency::OSThread
|
2021-01-31 17:12:36 +00:00
|
|
|
{
|
|
|
|
bool firstTime = 1;
|
2023-05-15 13:47:10 +00:00
|
|
|
unsigned long started = 0;
|
2021-01-31 17:12:36 +00:00
|
|
|
|
|
|
|
public:
|
2022-02-27 09:49:24 +00:00
|
|
|
RangeTestModule();
|
2021-01-31 17:12:36 +00:00
|
|
|
|
|
|
|
protected:
|
2022-01-24 17:24:40 +00:00
|
|
|
virtual int32_t runOnce() override;
|
2021-01-31 17:12:36 +00:00
|
|
|
};
|
|
|
|
|
2022-02-27 09:49:24 +00:00
|
|
|
extern RangeTestModule *rangeTestModule;
|
2021-01-31 17:12:36 +00:00
|
|
|
|
|
|
|
/*
|
2022-02-27 09:49:24 +00:00
|
|
|
* Radio interface for RangeTestModule
|
2021-01-31 17:12:36 +00:00
|
|
|
*
|
|
|
|
*/
|
2022-03-09 08:01:43 +00:00
|
|
|
class RangeTestModuleRadio : public SinglePortModule
|
2021-01-31 17:12:36 +00:00
|
|
|
{
|
2022-01-24 07:00:14 +00:00
|
|
|
uint32_t lastRxID = 0;
|
2021-01-31 17:12:36 +00:00
|
|
|
|
|
|
|
public:
|
2023-01-21 17:22:19 +00:00
|
|
|
RangeTestModuleRadio() : SinglePortModule("RangeTestModuleRadio", meshtastic_PortNum_TEXT_MESSAGE_APP)
|
2022-07-16 15:08:10 +00:00
|
|
|
{
|
|
|
|
loopbackOk = true; // Allow locally generated messages to loop back to the client
|
|
|
|
}
|
2021-01-31 17:12:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send our payload into the mesh
|
|
|
|
*/
|
|
|
|
void sendPayload(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
|
|
|
|
2021-02-14 06:21:01 +00:00
|
|
|
/**
|
2022-02-14 17:45:29 +00:00
|
|
|
* Append range test data to the file on the Filesystem
|
2021-02-14 06:21:01 +00:00
|
|
|
*/
|
2023-01-21 17:22:19 +00:00
|
|
|
bool appendFile(const meshtastic_MeshPacket &mp);
|
2021-02-14 06:21:01 +00:00
|
|
|
|
2021-01-31 17:12:36 +00:00
|
|
|
protected:
|
|
|
|
/** Called to handle a particular incoming message
|
|
|
|
|
2022-07-16 15:08:10 +00:00
|
|
|
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for
|
|
|
|
it
|
2021-01-31 17:12:36 +00:00
|
|
|
*/
|
2023-01-21 17:22:19 +00:00
|
|
|
virtual ProcessMessage handleReceived(const meshtastic_MeshPacket &mp) override;
|
2021-01-31 17:12:36 +00:00
|
|
|
};
|
|
|
|
|
2022-02-27 09:49:24 +00:00
|
|
|
extern RangeTestModuleRadio *rangeTestModuleRadio;
|