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:
28
lib/socketserver/GwUdpWriter.h
Normal file
28
lib/socketserver/GwUdpWriter.h
Normal 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
|
||||
Reference in New Issue
Block a user