37 lines
792 B
C++
37 lines
792 B
C++
/**
|
|
* @file udp_logger.h
|
|
* @author techniccontroller (mail[at]techniccontroller.com)
|
|
* @brief Class for sending logging Strings as multicast messages
|
|
* @version 0.1
|
|
* @date 2022-03-21
|
|
*
|
|
* @copyright Copyright (c) 2022
|
|
*
|
|
*/
|
|
|
|
#ifndef UDP_LOGGER_H
|
|
#define UDP_LOGGER_H
|
|
|
|
#include <Arduino.h>
|
|
#include <WiFiUdp.h>
|
|
|
|
class UDPLogger
|
|
{
|
|
public:
|
|
UDPLogger();
|
|
UDPLogger(IPAddress interface_addr, IPAddress multicast_addr, int port, String name);
|
|
void set_name(String name);
|
|
void log_string(String message);
|
|
void log_color_24bit(uint32_t color);
|
|
|
|
private:
|
|
char _packetBuffer[100] = {0};
|
|
int _port;
|
|
IPAddress _interfaceAddr;
|
|
IPAddress _multicastAddr;
|
|
String _name = "Logger";
|
|
unsigned long _lastSend = 0;
|
|
WiFiUDP _udp;
|
|
};
|
|
|
|
#endif /* UDP_LOGGER_H */ |