firmware/src/plugins/SerialPlugin.h

53 lines
1.1 KiB
C
Raw Normal View History

2021-01-14 04:22:59 +00:00
#pragma once
#include "SinglePortPlugin.h"
#include "concurrency/OSThread.h"
#include "configuration.h"
#include <Arduino.h>
#include <functional>
class SerialPlugin : private concurrency::OSThread
{
bool firstTime = 1;
public:
SerialPlugin();
protected:
virtual int32_t runOnce();
};
extern SerialPlugin *serialPlugin;
/*
* Radio interface for SerialPlugin
*
*/
class SerialPluginRadio : public SinglePortPlugin
{
uint32_t lastRxID;
public:
/*
TODO: Switch this to PortNum_SERIAL_APP once the change is able to be merged back here
from the main code.
*/
2021-03-13 05:14:27 +00:00
SerialPluginRadio();
2021-01-14 04:22:59 +00:00
/**
* Send our payload into the mesh
*/
void sendPayload(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
protected:
virtual MeshPacket *allocReply();
/** Called to handle a particular incoming message
@return ProcessMessage::STOP if you've guaranteed you've handled this message and no other handlers should be considered for it
2021-01-14 04:22:59 +00:00
*/
virtual ProcessMessage handleReceived(const MeshPacket &mp);
2021-01-14 04:22:59 +00:00
};
extern SerialPluginRadio *serialPluginRadio;