@@ -56,16 +56,16 @@ static const IPAddress SSDP_MULTICAST_ADDR(239, 255, 255, 250);
56
56
57
57
58
58
59
- static const char * _ssdp_response_template =
59
+ static const char _ssdp_response_template[] PROGMEM =
60
60
" HTTP/1.1 200 OK\r\n "
61
61
" EXT:\r\n " ;
62
62
63
- static const char * _ssdp_notify_template =
63
+ static const char _ssdp_notify_template[] PROGMEM =
64
64
" NOTIFY * HTTP/1.1\r\n "
65
65
" HOST: 239.255.255.250:1900\r\n "
66
66
" NTS: ssdp:alive\r\n " ;
67
67
68
- static const char * _ssdp_packet_template =
68
+ static const char _ssdp_packet_template[] PROGMEM =
69
69
" %s" // _ssdp_response_template / _ssdp_notify_template
70
70
" CACHE-CONTROL: max-age=%u\r\n " // SSDP_INTERVAL
71
71
" SERVER: Arduino/1.0 UPNP/1.1 %s/%s\r\n " // _modelName, _modelNumber
@@ -74,7 +74,7 @@ static const char* _ssdp_packet_template =
74
74
" LOCATION: http://%u.%u.%u.%u:%u/%s\r\n " // WiFi.localIP(), _port, _schemaURL
75
75
" \r\n " ;
76
76
77
- static const char * _ssdp_schema_template =
77
+ static const char _ssdp_schema_template[] PROGMEM =
78
78
" HTTP/1.1 200 OK\r\n "
79
79
" Content-Type: text/xml\r\n "
80
80
" Connection: close\r\n "
@@ -201,9 +201,12 @@ void SSDPClass::_send(ssdp_method_t method){
201
201
char buffer[1460 ];
202
202
uint32_t ip = WiFi.localIP ();
203
203
204
- int len = snprintf (buffer, sizeof (buffer),
204
+ char valueBuffer[strlen_P (_ssdp_notify_template)+1 ];
205
+ strcpy_P (valueBuffer, (method == NONE)?_ssdp_response_template:_ssdp_notify_template);
206
+
207
+ int len = snprintf_P (buffer, sizeof (buffer),
205
208
_ssdp_packet_template,
206
- (method == NONE)?_ssdp_response_template:_ssdp_notify_template ,
209
+ valueBuffer ,
207
210
SSDP_INTERVAL,
208
211
_modelName, _modelNumber,
209
212
_uuid,
@@ -240,7 +243,9 @@ void SSDPClass::_send(ssdp_method_t method){
240
243
241
244
void SSDPClass::schema (WiFiClient client){
242
245
uint32_t ip = WiFi.localIP ();
243
- client.printf (_ssdp_schema_template,
246
+ char buffer[strlen_P (_ssdp_schema_template)+1 ];
247
+ strcpy_P (buffer, _ssdp_schema_template);
248
+ client.printf (buffer,
244
249
IP2STR (&ip), _port,
245
250
_deviceType,
246
251
_friendlyName,
0 commit comments