mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-02-11 07:03:07 +01:00
make birectional channels the default, clean up some channel handling
This commit is contained in:
@@ -249,3 +249,16 @@ unsigned long GwChannel::countTx(){
|
||||
if (! countOut) return 0UL;
|
||||
return countOut->getGlobal();
|
||||
}
|
||||
String GwChannel::typeString(int type){
|
||||
switch (type){
|
||||
case GWSERIAL_TYPE_UNI:
|
||||
return "UNI";
|
||||
case GWSERIAL_TYPE_BI:
|
||||
return "BI";
|
||||
case GWSERIAL_TYPE_RX:
|
||||
return "RX";
|
||||
case GWSERIAL_TYPE_TX:
|
||||
return "TX";
|
||||
}
|
||||
return "UNKNOWN";
|
||||
}
|
||||
@@ -77,7 +77,8 @@ class GwChannel{
|
||||
if (maxSourceId < 0) return source == sourceId;
|
||||
return (source >= sourceId && source <= maxSourceId);
|
||||
}
|
||||
String getMode(){return impl->getMode();}
|
||||
static String typeString(int type);
|
||||
String getMode(){return typeString(impl->getType());}
|
||||
int getMinId(){return sourceId;};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
#include "GwBuffer.h"
|
||||
#include "GwChannelModes.h"
|
||||
class GwChannelInterface{
|
||||
public:
|
||||
virtual void loop(bool handleRead,bool handleWrite)=0;
|
||||
virtual void readMessages(GwMessageFetcher *writer)=0;
|
||||
virtual size_t sendToClients(const char *buffer, int sourceId, bool partial=false)=0;
|
||||
virtual Stream * getStream(bool partialWrites){ return NULL;}
|
||||
virtual String getMode(){return "UNKNOWN";}
|
||||
virtual int getType()=0; //return the numeric type
|
||||
virtual int getType(){ return GWSERIAL_TYPE_BI;} //return the numeric type
|
||||
};
|
||||
Reference in New Issue
Block a user