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

intermediate: udp reader

This commit is contained in:
andreas
2024-11-08 21:00:25 +01:00
parent b0d5e27b5a
commit 82f5e17987
10 changed files with 406 additions and 24 deletions

View File

@@ -7,6 +7,7 @@
#include "GwSerial.h"
#include "GwTcpClient.h"
#include "GwUdpWriter.h"
#include "GwUdpReader.h"
class SerInit{
public:
int serial=-1;
@@ -260,8 +261,27 @@ static ChannelParam channelParameters[]={
.maxId=-1,
.rxstatus=0,
.txstatus=offsetof(GwApi::Status,GwApi::Status::udpwTx)
},
{
.id=UDPR_CHANNEL_ID,
.baud="",
.receive=GwConfigDefinitions::udprEnabled,
.send="",
.direction="",
.toN2K=GwConfigDefinitions::udprToN2k,
.readF=GwConfigDefinitions::udprReadFilter,
.writeF="",
.preventLog="",
.readAct="",
.writeAct="",
.sendSeasmart="",
.name="UDPReader",
.maxId=-1,
.rxstatus=offsetof(GwApi::Status,GwApi::Status::udprRx),
.txstatus=0
}
};
template<typename T>
@@ -451,6 +471,12 @@ void GwChannelList::begin(bool fallbackSerial){
writer->begin();
addChannel(createChannel(logger,config,UDPW_CHANNEL_ID,writer));
}
//udp reader
if (config->getBool(GwConfigDefinitions::udprEnabled)){
GwUdpReader *reader=new GwUdpReader(config,logger,UDPR_CHANNEL_ID);
reader->begin();
addChannel(createChannel(logger,config,UDPR_CHANNEL_ID,reader));
}
logger->flush();
}
String GwChannelList::getMode(int id){

View File

@@ -19,6 +19,7 @@
#define TCP_CLIENT_CHANNEL_ID 4
#define MIN_TCP_CHANNEL_ID 5
#define UDPW_CHANNEL_ID 20
#define UDPR_CHANNEL_ID 21
#define MIN_USER_TASK 200
class GwSocketServer;