27 udp.onPacket([&](AsyncUDPPacket packet) {
30 result.
peer.
port = packet.remotePort();
33 result.
data.
copyFrom((
const char*)packet.data(), packet.length());
36 queue.enqueue(result);
42 bool send(uint8_t* data,
int len) {
return send(
peer, data, len); }
59 queue.dequeue(result);
Abstract Interface for UDP API.
Definition: IUDPService.h:34
void log(DlnaLogLevel current_level, const char *fmt...)
Print log message.
Definition: Logger.h:40
A simple single producer, single consumer lock free queue.
Definition: QueueLockFree.h:14
void copyFrom(const char *source, int len, int maxlen=0)
assigns a memory buffer
Definition: Str.h:94
Access to UDP functionality: sending and receiving of data using the Async API of the ESP32.
Definition: UDPAsyncService.h:18
QueueLockFree< RequestData > queue
Definition: UDPAsyncService.h:67
IPAddressAndPort peer
Definition: UDPAsyncService.h:65
bool begin(IPAddressAndPort addr)
Definition: UDPAsyncService.h:20
AsyncUDP udp
Definition: UDPAsyncService.h:64
bool send(IPAddressAndPort addr, uint8_t *data, int len)
Definition: UDPAsyncService.h:44
RequestData receive()
Definition: UDPAsyncService.h:53
bool send(uint8_t *data, int len)
Definition: UDPAsyncService.h:42
Definition: Allocator.h:6
@ DlnaDebug
Definition: Logger.h:16
@ DlnaInfo
Definition: Logger.h:16
@ DlnaError
Definition: Logger.h:16
LoggerClass DlnaLogger
Definition: Logger.cpp:5
IP Adress including Port information.
Definition: IPAddressAndPort.h:13
int port
Definition: IPAddressAndPort.h:17
const char * toString()
Definition: IPAddressAndPort.h:19
IPAddress address
Definition: IPAddressAndPort.h:16
Provides information of the received UDP which consists of the (xml) data and the peer address and po...
Definition: IUDPService.h:23
IPAddressAndPort peer
Definition: IUDPService.h:25
Str data
Definition: IUDPService.h:24