mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-12 13:33:06 +01:00
correctly send out seasmart only if NMEA out is not enabled on channel
This commit is contained in:
@@ -128,9 +128,11 @@ void GwChannel::updateCounter(const char *msg, bool out)
|
||||
}
|
||||
}
|
||||
|
||||
bool GwChannel::canSendOut(const char *buffer){
|
||||
bool GwChannel::canSendOut(const char *buffer, bool isSeasmart){
|
||||
if (! enabled || ! impl) return false;
|
||||
if (! NMEAout || readActisense) return false;
|
||||
if (readActisense) return false;
|
||||
if (! isSeasmart && ! NMEAout) return false;
|
||||
if (isSeasmart && ! seaSmartOut) return false;
|
||||
if (writeFilter && ! writeFilter->canPass(buffer)) return false;
|
||||
return true;
|
||||
}
|
||||
@@ -177,9 +179,9 @@ void GwChannel::readMessages(GwChannel::NMEA0183Handler handler){
|
||||
receiver->setHandler(handler);
|
||||
impl->readMessages(receiver);
|
||||
}
|
||||
void GwChannel::sendToClients(const char *buffer, int sourceId){
|
||||
void GwChannel::sendToClients(const char *buffer, int sourceId, bool isSeasmart){
|
||||
if (! impl) return;
|
||||
if (canSendOut(buffer)){
|
||||
if (canSendOut(buffer,isSeasmart)){
|
||||
if(impl->sendToClients(buffer,sourceId)){
|
||||
updateCounter(buffer,true);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class GwChannel{
|
||||
}
|
||||
bool isEnabled(){return enabled;}
|
||||
bool shouldRead(){return enabled && NMEAin;}
|
||||
bool canSendOut(const char *buffer);
|
||||
bool canSendOut(const char *buffer, bool isSeasmart);
|
||||
bool canReceive(const char *buffer);
|
||||
bool sendSeaSmart(){ return seaSmartOut;}
|
||||
bool sendToN2K(){return toN2k;}
|
||||
@@ -67,7 +67,7 @@ class GwChannel{
|
||||
void loop(bool handleRead, bool handleWrite);
|
||||
typedef std::function<void(const char *buffer, int sourceid)> NMEA0183Handler;
|
||||
void readMessages(NMEA0183Handler handler);
|
||||
void sendToClients(const char *buffer, int sourceId);
|
||||
void sendToClients(const char *buffer, int sourceId, bool isSeasmart=false);
|
||||
typedef std::function<void(const tN2kMsg &msg, int sourceId)> N2kHandler ;
|
||||
void parseActisense(N2kHandler handler);
|
||||
void sendActisense(const tN2kMsg &msg, int sourceId);
|
||||
|
||||
Reference in New Issue
Block a user