@@ -69,7 +69,7 @@ static const char _ssdp_notify_template[] PROGMEM =
6969
7070static const char _ssdp_packet_template[] PROGMEM =
7171 " %s" // _ssdp_response_template / _ssdp_notify_template
72- " CACHE-CONTROL: max-age=%u\r\n " // SSDP_INTERVAL
72+ " CACHE-CONTROL: max-age=%u\r\n " // _interval
7373 " SERVER: Arduino/1.0 UPNP/1.1 %s/%s\r\n " // _modelName, _modelNumber
7474 " USN: %s\r\n " // _uuid
7575 " %s: %s\r\n " // "NT" or "ST", _deviceType
@@ -130,6 +130,7 @@ SSDPClass::SSDPClass() :
130130 _timer(0 ),
131131 _port(80 ),
132132 _ttl(SSDP_MULTICAST_TTL),
133+ _interval(SSDP_INTERVAL),
133134 _respondToAddr(0 ,0 ,0 ,0 ),
134135 _respondToPort(0 ),
135136 _pending(false ),
@@ -241,7 +242,7 @@ void SSDPClass::_send(ssdp_method_t method) {
241242 int len = snprintf_P (buffer, sizeof (buffer),
242243 _ssdp_packet_template,
243244 valueBuffer,
244- SSDP_INTERVAL ,
245+ _interval ,
245246 _modelName,
246247 _modelNumber,
247248 _uuid,
@@ -428,7 +429,7 @@ void SSDPClass::_update() {
428429 if (_pending && (millis () - _process_time) > _delay) {
429430 _pending = false ; _delay = 0 ;
430431 _send (NONE);
431- } else if (_notify_time == 0 || (millis () - _notify_time) > (SSDP_INTERVAL * 1000L )){
432+ } else if (_notify_time == 0 || (millis () - _notify_time) > (_interval * 1000L )){
432433 _notify_time = millis ();
433434 _st_is_uuid = false ;
434435 _send (NOTIFY);
@@ -493,11 +494,14 @@ void SSDPClass::setManufacturerURL(const char *url) {
493494 strlcpy (_manufacturerURL, url, sizeof (_manufacturerURL));
494495}
495496
496-
497497void SSDPClass::setTTL (const uint8_t ttl) {
498498 _ttl = ttl;
499499}
500500
501+ void SSDPClass::setInterval (uint32_t interval) {
502+ _interval = interval;
503+ }
504+
501505void SSDPClass::_onTimerStatic (SSDPClass* self) {
502506 self->_update ();
503507}
0 commit comments