1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-16 07:23:07 +01:00

intermediate: introduce an abstract channel

This commit is contained in:
wellenvogel
2021-12-31 18:38:11 +01:00
parent 0acb988f31
commit 47fb805ee6
9 changed files with 351 additions and 259 deletions

View File

@@ -3,8 +3,9 @@
#include "HardwareSerial.h"
#include "GwLog.h"
#include "GwBuffer.h"
#include "GwChannelInterface.h"
class GwSerialStream;
class GwSerial{
class GwSerial : public GwChannelInterface{
private:
GwBuffer *buffer;
GwBuffer *readBuffer=NULL;
@@ -23,11 +24,11 @@ class GwSerial{
~GwSerial();
int setup(int baud,int rxpin,int txpin);
bool isInitialized();
size_t sendToClients(const char *buf,int sourceId,bool partial=false);
void loop(bool handleRead=true);
bool readMessages(GwMessageFetcher *writer);
virtual size_t sendToClients(const char *buf,int sourceId,bool partial=false);
virtual void loop(bool handleRead=true,bool handleWrite=true);
virtual void readMessages(GwMessageFetcher *writer);
void flush();
Stream *getStream(bool partialWrites);
virtual Stream *getStream(bool partialWrites);
friend GwSerialStream;
};
#endif