1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

[SSDP] add schema(Print &) const (#6798)

* [SSDP] add `schema(Print &) const`

Supercedes #2806

Make SSDP::schema(WiFiClient&) use a by-ref (reduce stack use)

Add a SSDP::schema(Print&)

From @Palatis' original PR:
useful when using AsyncWebServer.

* Use ip.toString, only export Print& schema interface

Because WiFiClient inherits a Print interface, replace the
::schema(WiFiClient&) with ::schema(Print&) which is source compatible
with existing code and allows the functionality requested in the initial
PR.

Use ip.toString() in the templates instead of breaking up the octets of
the address.

* Fix compile errors and backwards compatibility
This commit is contained in:
Earle F. Philhower, III
2019-11-18 22:02:54 -07:00
committed by Develo
parent 9b96f53778
commit 344c4492af
2 changed files with 7 additions and 6 deletions

View File

@ -62,7 +62,8 @@ class SSDPClass{
~SSDPClass();
bool begin();
void end();
void schema(WiFiClient client);
void schema(WiFiClient client) const { schema((Print&)std::ref(client)); }
void schema(Print &print) const;
void setDeviceType(const String& deviceType) { setDeviceType(deviceType.c_str()); }
void setDeviceType(const char *deviceType);