6 #define MAX_TMP_SIZE 300
8 #define MAX_AGE (60 * 60 * 24)
30 virtual const char *
name() {
return "n/a"; };
45 const char *
name()
override {
return "MSearch"; }
54 "M-SEARCH * HTTP/1.1\r\n"
56 "MAN: \"ssdp:discover\"\r\n"
83 const char *
name()
override {
return "MSearchReply"; }
94 "CACHE-CONTROL: max-age = %d\r\n"
123 const char *
name()
override {
return "MSearchReplyCP"; }
137 const char *
name()
override {
return "NotifyReplyCP"; }
169 const char *
name()
override {
return "PostAlive"; }
175 DLNABroadcastAddress.toString());
186 process(nt, usn, device_url, max_age, udp);
189 process(nt, usn, device_url, max_age, udp);
194 process(nt, usn, device_url, max_age, udp);
201 void setupData(
const char *nt,
const char *udn,
char *result_nt,
203 strcpy(result_nt, nt);
204 strcpy(result_usn, udn);
205 strcat(result_usn,
"::");
206 strcat(result_usn, nt);
209 bool process(
const char *nt,
const char *usn,
const char *device_url,
214 "NOTIFY * HTTP/1.1\r\n"
216 "CACHE-CONTROL: max-age = %d\r\n"
219 "NTS: ssdp:alive\r\n"
221 int n = snprintf(buffer,
MAX_TMP_SIZE, tmp, DLNABroadcastAddress.toString(),
222 max_age, device_url, nt, usn);
226 udp.
send(DLNABroadcastAddress, (uint8_t *)buffer, n);
238 const char *
name()
override {
return "ByeBye"; }
241 DLNABroadcastAddress.toString());
245 "NOTIFY * HTTP/1.1\r\n"
247 "CACHE-CONTROL: max-age = %d\r\n"
250 "NTS: ssdp:byebye\r\n"
252 int n = snprintf(buffer,
MAX_TMP_SIZE, tmp, DLNABroadcastAddress.toString(),
256 udp.
send(DLNABroadcastAddress, (uint8_t *)buffer, n);
275 const char *
name()
override {
return "Subscribe"; }
283 "SUBSCRIBE %s HTTP/1.1\r\n"
287 "TIMEOUT: Second-%d\r\n\r\n";
#define MAX_TMP_SIZE
Definition: Schedule.h:6
#define MAX_AGE
Definition: Schedule.h:8
Device Attributes and generation of XML using urn:schemas-upnp-org:device-1-0. We could just return a...
Definition: DLNADevice.h:27
Vector< DLNAServiceInfo > & getServices()
Definition: DLNADevice.h:125
Url & getDeviceURL()
This method returns base url/device.xml.
Definition: DLNADevice.h:69
const char * getDeviceType()
Definition: DLNADevice.h:44
const char * getUDN()
Provide the udn uuid.
Definition: DLNADevice.h:50
Abstract Interface for UDP API.
Definition: IUDPService.h:34
virtual bool send(uint8_t *data, int len)=0
void log(DlnaLogLevel current_level, const char *fmt...)
Print log message.
Definition: Logger.h:40
Processing at control point to handle a MSearchReply from the device.
Definition: Schedule.h:121
Str usn
Definition: Schedule.h:125
const char * name() override
Definition: Schedule.h:123
Str location
Definition: Schedule.h:124
Str search_target
Definition: Schedule.h:126
bool process(IUDPService &udp) override
Definition: Schedule.h:128
Answer from device to MSearch request by sending a reply.
Definition: Schedule.h:77
MSearchReplySchedule(DLNADevice &device, IPAddressAndPort addr)
Definition: Schedule.h:79
Str search_target
Definition: Schedule.h:107
int mx
Definition: Schedule.h:110
bool process(IUDPService &udp) override
Definition: Schedule.h:85
const char * name() override
Definition: Schedule.h:83
IPAddressAndPort address
Definition: Schedule.h:108
DLNADevice * p_device
Definition: Schedule.h:109
int max_age
Definition: Schedule.h:113
Send MSearch request.
Definition: Schedule.h:39
IPAddressAndPort address
Definition: Schedule.h:69
const char * search_target
Definition: Schedule.h:70
MSearchSchedule(IPAddressAndPort addr, const char *searchTarget)
Definition: Schedule.h:41
const char * name() override
Definition: Schedule.h:45
bool process(IUDPService &udp) override
Definition: Schedule.h:47
int max_age
Definition: Schedule.h:68
Definition: Schedule.h:135
const char * name() override
Definition: Schedule.h:137
Str delivery_host_and_port
Definition: Schedule.h:139
std::function< bool(NotifyReplyCP &ref)> callback
Definition: Schedule.h:146
Str xml
Definition: Schedule.h:143
Str event_key
Definition: Schedule.h:142
Str subscription_id
Definition: Schedule.h:141
Str delivery_path
Definition: Schedule.h:140
bool process(IUDPService &udp) override
Definition: Schedule.h:148
Str nts
Definition: Schedule.h:138
Send out PostAlive messages: Repeated every 5 seconds.
Definition: Schedule.h:163
DLNADevice * p_device
Definition: Schedule.h:200
PostAliveSchedule(DLNADevice &device, uint32_t repeatMs)
Definition: Schedule.h:165
bool process(IUDPService &udp) override
Definition: Schedule.h:173
void setRepeatMs(uint32_t ms)
Definition: Schedule.h:171
bool process(const char *nt, const char *usn, const char *device_url, int max_age, IUDPService &udp)
Definition: Schedule.h:209
void setupData(const char *nt, const char *udn, char *result_nt, char *result_usn)
Definition: Schedule.h:201
const char * name() override
Definition: Schedule.h:169
Send out ByeBye message.
Definition: Schedule.h:235
PostByeSchedule(DLNADevice &device)
Definition: Schedule.h:237
DLNADevice * p_device
Definition: Schedule.h:262
bool process(IUDPService &udp) override
Definition: Schedule.h:239
int max_age
Definition: Schedule.h:261
const char * name() override
Definition: Schedule.h:238
Send SUBSCRIBE message via UDP unicast.
Definition: Schedule.h:269
void setDestination(IPAddressAndPort address, const char *path)
Definition: Schedule.h:301
void setDuration(uint32_t sec)
Definition: Schedule.h:306
IPAddressAndPort address
Definition: Schedule.h:297
const char * name() override
Definition: Schedule.h:275
const char * path
Definition: Schedule.h:298
int durationSec
Definition: Schedule.h:299
PostSubscribe(IPAddressAndPort address, const char *path, uint32_t sec)
Definition: Schedule.h:271
bool process(IUDPService &udp) override
Definition: Schedule.h:277
String implementation which keeps the data on the heap. We grow the allocated memory only if the copy...
Definition: Str.h:22
const char * c_str()
provides the string value as const char*
Definition: Str.h:188
const char * url()
Definition: Url.h:46
Definition: Allocator.h:6
@ DlnaDebug
Definition: Logger.h:16
@ DlnaInfo
Definition: Logger.h:16
LoggerClass DlnaLogger
Definition: Logger.cpp:5
IP Adress including Port information.
Definition: IPAddressAndPort.h:13
const char * toString()
Definition: IPAddressAndPort.h:19
An individual Schedule (to send out UDP messages)
Definition: Schedule.h:17
uint64_t end_time
Definition: Schedule.h:24
bool active
Definition: Schedule.h:26
virtual const char * name()
Definition: Schedule.h:30
virtual bool process(IUDPService &udp)
Definition: Schedule.h:28
uint64_t time
Definition: Schedule.h:20
uint32_t repeat_ms
Definition: Schedule.h:22