1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Changed templates to include deviceType

Previously, the notify template and and response templates had a
hardcoded NT (or ST) of upnp:root device.  They now include the
deviceType that is set in initialization.
This commit is contained in:
Jeremy Green 2016-03-10 21:57:59 -05:00
parent a4e78b430f
commit c8d855c46d

View File

@ -58,13 +58,11 @@ static const IPAddress SSDP_MULTICAST_ADDR(239, 255, 255, 250);
static const char* _ssdp_response_template = static const char* _ssdp_response_template =
"HTTP/1.1 200 OK\r\n" "HTTP/1.1 200 OK\r\n"
"EXT:\r\n" "EXT:\r\n";
"ST: upnp:rootdevice\r\n";
static const char* _ssdp_notify_template = static const char* _ssdp_notify_template =
"NOTIFY * HTTP/1.1\r\n" "NOTIFY * HTTP/1.1\r\n"
"HOST: 239.255.255.250:1900\r\n" "HOST: 239.255.255.250:1900\r\n"
"NT: upnp:rootdevice\r\n"
"NTS: ssdp:alive\r\n"; "NTS: ssdp:alive\r\n";
static const char* _ssdp_packet_template = static const char* _ssdp_packet_template =
@ -72,6 +70,7 @@ static const char* _ssdp_packet_template =
"CACHE-CONTROL: max-age=%u\r\n" // SSDP_INTERVAL "CACHE-CONTROL: max-age=%u\r\n" // SSDP_INTERVAL
"SERVER: Arduino/1.0 UPNP/1.1 %s/%s\r\n" // _modelName, _modelNumber "SERVER: Arduino/1.0 UPNP/1.1 %s/%s\r\n" // _modelName, _modelNumber
"USN: uuid:%s\r\n" // _uuid "USN: uuid:%s\r\n" // _uuid
"%s: %s\r\n"
"LOCATION: http://%u.%u.%u.%u:%u/%s\r\n" // WiFi.localIP(), _port, _schemaURL "LOCATION: http://%u.%u.%u.%u:%u/%s\r\n" // WiFi.localIP(), _port, _schemaURL
"\r\n"; "\r\n";
@ -207,6 +206,8 @@ void SSDPClass::_send(ssdp_method_t method){
(method == NONE)?_ssdp_response_template:_ssdp_notify_template, (method == NONE)?_ssdp_response_template:_ssdp_notify_template,
SSDP_INTERVAL, SSDP_INTERVAL,
_modelName, _modelNumber, _modelName, _modelNumber,
(method == NONE)?"ST":"NT",
_deviceType,
_uuid, _uuid,
IP2STR(&ip), _port, _schemaURL IP2STR(&ip), _port, _schemaURL
); );