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

#79: add udp writer

This commit is contained in:
andreas
2024-11-04 20:21:33 +01:00
parent d0dee367f8
commit 490a5b9ba1
6 changed files with 156 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
#ifndef _GWUDPWRITER_H
#define _GWUDPWRITER_H
#include "GWConfig.h"
#include "GwLog.h"
#include "GwBuffer.h"
#include "GwChannelInterface.h"
#include <memory>
#include <sys/socket.h>
#include <arpa/inet.h>
class GwUdpWriter: public GwChannelInterface{
private:
const GwConfigHandler *config;
GwLog *logger;
int fd=-1;
int minId;
int port;
String address;
struct sockaddr_in destination;
public:
GwUdpWriter(const GwConfigHandler *config,GwLog *logger,int minId);
~GwUdpWriter();
void begin();
virtual void loop(bool handleRead=true,bool handleWrite=true);
virtual size_t sendToClients(const char *buf,int sourceId, bool partialWrite=false);
virtual void readMessages(GwMessageFetcher *writer);
};
#endif