Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions libraries/ESP8266SSDP/ESP8266SSDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ static const char* _ssdp_schema_template =
"</root>\r\n"
"\r\n";


struct SSDPTimer {
ETSTimer timer;
};
Expand Down Expand Up @@ -238,7 +237,7 @@ void SSDPClass::_send(ssdp_method_t method){
_server->send(&remoteAddr, remotePort);
}

void SSDPClass::schema(WiFiClient client){
void SSDPClass::schema(WiFiClient & client) const{
uint32_t ip = WiFi.localIP();
client.printf(_ssdp_schema_template,
IP2STR(&ip), _port,
Expand All @@ -255,6 +254,22 @@ void SSDPClass::schema(WiFiClient client){
);
}

void SSDPClass::schema(Print & print) const{
uint32_t ip = WiFi.localIP();
print.printf(_ssdp_schema_template,
IP2STR(&ip), _port,
_deviceType,
_friendlyName,
_presentationURL,
_serialNumber,
_modelName,
_modelNumber,
_modelURL,
_manufacturer,
_manufacturerURL,
_uuid
);
}
void SSDPClass::_update(){
if(!_pending && _server->next()) {
ssdp_method_t method = NONE;
Expand Down
3 changes: 2 additions & 1 deletion libraries/ESP8266SSDP/ESP8266SSDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class SSDPClass{

bool begin();

void schema(WiFiClient client);
void schema(WiFiClient & client) const;
void schema(Print & print) const;

void setDeviceType(const String& deviceType) { setDeviceType(deviceType.c_str()); }
void setDeviceType(const char *deviceType);
Expand Down