Arduino DLNA Server
IUDPService.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <WiFi.h>
5 #include <WiFiUdp.h>
6 
8 #include "basic/Str.h"
9 #include "assert.h"
10 
11 namespace tiny_dlna {
12 
13 // multicast address for SSDP
14 static IPAddressAndPort DLNABroadcastAddress{IPAddress(239, 255, 255, 250),
15  1900};
16 
23 struct RequestData {
24  Str data{0};
26  operator bool() { return !data.isEmpty(); }
27 };
28 
34 class IUDPService {
35  public:
36  virtual bool begin(IPAddressAndPort addr) = 0;
37  virtual bool send(uint8_t *data, int len) = 0;
38  virtual bool send(IPAddressAndPort addr, uint8_t *data, int len) = 0;
39  virtual RequestData receive() = 0;
40 };
41 
42 } // namespace tiny_dlna
Abstract Interface for UDP API.
Definition: IUDPService.h:34
virtual RequestData receive()=0
virtual bool send(IPAddressAndPort addr, uint8_t *data, int len)=0
virtual bool begin(IPAddressAndPort addr)=0
virtual bool send(uint8_t *data, int len)=0
virtual bool isEmpty()
checks if the string is empty
Definition: StrView.h:373
String implementation which keeps the data on the heap. We grow the allocated memory only if the copy...
Definition: Str.h:22
Definition: Allocator.h:6
IP Adress including Port information.
Definition: IPAddressAndPort.h:13
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