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:
@@ -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){
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user