1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-21 21:22:31 +03:00

mDNS: Add support for String arg to begin() (#5542)

Analogous to commit dd6333ee8b
This commit is contained in:
Takayuki 'January June' Suwa
2018-12-24 00:57:34 +09:00
committed by Develo
parent dd6333ee8b
commit 8049543e98
2 changed files with 12 additions and 0 deletions

View File

@ -66,12 +66,18 @@ public:
MDNSResponder(); MDNSResponder();
~MDNSResponder(); ~MDNSResponder();
bool begin(const char* hostName); bool begin(const char* hostName);
bool begin(const String& hostName) {
return begin(hostName.c_str());
}
//for compatibility //for compatibility
bool begin(const char* hostName, IPAddress ip, uint32_t ttl=120){ bool begin(const char* hostName, IPAddress ip, uint32_t ttl=120){
(void) ip; (void) ip;
(void) ttl; (void) ttl;
return begin(hostName); return begin(hostName);
} }
bool begin(const String& hostName, IPAddress ip, uint32_t ttl=120) {
return begin(hostName.c_str(), ip, ttl);
}
/* Application should call this whenever AP is configured/disabled */ /* Application should call this whenever AP is configured/disabled */
void notifyAPChange(); void notifyAPChange();
void update(); void update();

View File

@ -173,10 +173,16 @@ public:
// Later call MDNS::update() in every 'loop' to run the process loop // Later call MDNS::update() in every 'loop' to run the process loop
// (probing, announcing, responding, ...) // (probing, announcing, responding, ...)
bool begin(const char* p_pcHostname); bool begin(const char* p_pcHostname);
bool begin(const String& p_strHostname) {return begin(p_strHostname.c_str());}
// for compatibility // for compatibility
bool begin(const char* p_pcHostname, bool begin(const char* p_pcHostname,
IPAddress p_IPAddress, // ignored IPAddress p_IPAddress, // ignored
uint32_t p_u32TTL = 120); // ignored uint32_t p_u32TTL = 120); // ignored
bool begin(const String& p_strHostname,
IPAddress p_IPAddress, // ignored
uint32_t p_u32TTL = 120) { // ignored
return begin(p_strHostname.c_str(), p_IPAddress, p_u32TTL);
}
// Finish MDNS processing // Finish MDNS processing
bool close(void); bool close(void);