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

@@ -96,7 +96,7 @@ size_t GwSerial::sendToClients(const char *buf,int sourceId,bool partial){
}
return enqueued;
}
void GwSerial::loop(bool handleRead){
void GwSerial::loop(bool handleRead,bool handleWrite){
write();
if (! isInitialized()) return;
if (! handleRead) return;
@@ -116,10 +116,10 @@ void GwSerial::loop(bool handleRead){
serial->readBytes(buffer,available);
}
}
bool GwSerial::readMessages(GwMessageFetcher *writer){
if (! isInitialized()) return false;
if (! allowRead) return false;
return writer->handleBuffer(readBuffer);
void GwSerial::readMessages(GwMessageFetcher *writer){
if (! isInitialized()) return;
if (! allowRead) return;
writer->handleBuffer(readBuffer);
}
void GwSerial::flush(){