mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-13 05:53:06 +01:00
tcp client 1st working
This commit is contained in:
@@ -88,7 +88,7 @@ void GwChannel::begin(
|
||||
this->toN2k=toN2k;
|
||||
this->readActisense=readActisense;
|
||||
this->writeActisense=writeActisense;
|
||||
if (readActisense|| writeActisense){
|
||||
if (impl && (readActisense|| writeActisense)){
|
||||
channelStream=impl->getStream(false);
|
||||
if (! channelStream) {
|
||||
this->readActisense=false;
|
||||
|
||||
@@ -56,6 +56,7 @@ void GwChannelList::begin(bool fallbackSerial){
|
||||
logger->setWriter(new GwSerialLog(usb));
|
||||
logger->prefix="GWSERIAL:";
|
||||
channel=new GwChannel(logger,"USB",USB_CHANNEL_ID);
|
||||
channel->setImpl(usb);
|
||||
channel->begin(true,
|
||||
config->getBool(config->sendUsb),
|
||||
config->getBool(config->receiveUsb),
|
||||
@@ -140,9 +141,19 @@ void GwChannelList::begin(bool fallbackSerial){
|
||||
}
|
||||
|
||||
//tcp client
|
||||
bool tclEnabled=config->getBool(config->tclEnabled);
|
||||
channel=new GwChannel(logger,"TCPClient",TCP_CLIENT_CHANNEL_ID);
|
||||
if (tclEnabled){
|
||||
client=new GwTcpClient(logger);
|
||||
client->begin(TCP_CLIENT_CHANNEL_ID,
|
||||
config->getString(config->remoteAddress),
|
||||
config->getInt(config->remotePort),
|
||||
config->getBool(config->readTCL)
|
||||
);
|
||||
channel->setImpl(client);
|
||||
}
|
||||
channel->begin(
|
||||
config->getBool(config->tclEnabled),
|
||||
tclEnabled,
|
||||
config->getBool(config->sendTCL),
|
||||
config->getBool(config->readTCL),
|
||||
config->getString(config->tclReadFilter),
|
||||
@@ -152,15 +163,7 @@ void GwChannelList::begin(bool fallbackSerial){
|
||||
false,
|
||||
false
|
||||
);
|
||||
if (channel->isEnabled()){
|
||||
client=new GwTcpClient(logger);
|
||||
client->begin(TCP_CLIENT_CHANNEL_ID,
|
||||
config->getString(config->remoteAddress),
|
||||
config->getInt(config->remotePort),
|
||||
channel->shouldRead()
|
||||
);
|
||||
channel->setImpl(client);
|
||||
}
|
||||
theChannels.push_back(channel);
|
||||
LOG_DEBUG(GwLog::LOG,"%s",channel->toString().c_str());
|
||||
logger->flush();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user