Files
firmware/src/mesh/api/PacketAPI.h
T
Tom f90b48ea6c chore: trunk fmt --all (#11938)
Whitespace and comment-alignment only: the output of `trunk fmt --all` on
develop @ d49cf21c3 with the pinned clang-format@20.1.0 and prettier. 48
files had drifted; trunk-action only checks the files a PR touches, so the
drift never fails CI and instead lands as noise in the next PR to edit any of
them. No code change.
2026-09-24 22:41:37 +00:00

38 lines
1.0 KiB
C++

#pragma once
#include "PhoneAPI.h"
#include "comms/PacketServer.h"
#include "concurrency/OSThread.h"
/**
* A version of the phone API used for inter task communication based on protobuf packets, e.g.
* between two tasks running on CPU0 and CPU1, respectively.
*
*/
class PacketAPI : public PhoneAPI, public concurrency::OSThread
{
public:
static PacketAPI *create(PacketServer *_server);
virtual ~PacketAPI() {};
virtual int32_t runOnce();
// Check the current underlying physical queue to see if the client is fetching packets
bool checkIsConnected() override;
protected:
explicit PacketAPI(PacketServer *_server);
void onNowHasData(uint32_t fromRadioNum) override {}
void onConnectionChanged(bool connected) override {}
private:
bool receivePacket(void);
bool sendPacket(void);
bool notifyProgrammingMode(void);
bool isConnected;
bool programmingMode;
PacketServer *server;
uint8_t txBuf[MAX_TO_FROM_RADIO_SIZE] = {0}; // dummy buf to obey PhoneAPI
};
extern PacketAPI *packetAPI;