forked from jeremymlong/ESP8266-UPnP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpnpDevice.h
49 lines (38 loc) · 1.06 KB
/
UpnpDevice.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef UPNPDEVICE_H_
#define UPNPDEVICE_H_
#include <WiFiUdp.h>
#include <WiFiServer.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include "MSearchInfo.h"
#include "NotifyType.h"
#include "DateTime.h"
#define SSDP_ADDR IPAddress(239,255,255,250)
#define SSDP_PORT 1900
#define SSDP_UNICAST_PORT 2869
class UpnpDevice
{
public:
UpnpDevice(String friendlyName, uint16 port);
virtual ~UpnpDevice() {}
void begin();
void loop();
virtual String getDescriptionXml() = 0;
virtual void sendNotify(NotifyType nt, WiFiUDP *session) = 0;
virtual bool matchesSearch(String searchTerm);
virtual void addSearchRequest(MSearchInfo *msearch);
bool respondToSearch();
inline void setDateTime(DateTime* dateTime) { m_dateTime = dateTime; }
inline String getFriendlyName() { return m_friendlyName; }
protected:
virtual void respondToSearch(MSearchInfo* msearch) = 0;
virtual void setup() = 0;
String m_friendlyName;
uint32 m_serial;
uint16 m_port;
DateTime *m_dateTime;
ESP8266WebServer m_webServer;
private:
LinkedList<MSearchInfo*> m_searchRequests;
};
#endif