Skip to content

Commit 8049543

Browse files
jjsuwadevyte
authored andcommitted
mDNS: Add support for String arg to begin() (#5542)
Analogous to commit dd6333e
1 parent dd6333e commit 8049543

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

libraries/ESP8266mDNS/src/ESP8266mDNS_Legacy.h

+6
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,18 @@ class MDNSResponder {
6666
MDNSResponder();
6767
~MDNSResponder();
6868
bool begin(const char* hostName);
69+
bool begin(const String& hostName) {
70+
return begin(hostName.c_str());
71+
}
6972
//for compatibility
7073
bool begin(const char* hostName, IPAddress ip, uint32_t ttl=120){
7174
(void) ip;
7275
(void) ttl;
7376
return begin(hostName);
7477
}
78+
bool begin(const String& hostName, IPAddress ip, uint32_t ttl=120) {
79+
return begin(hostName.c_str(), ip, ttl);
80+
}
7581
/* Application should call this whenever AP is configured/disabled */
7682
void notifyAPChange();
7783
void update();

libraries/ESP8266mDNS/src/LEAmDNS.h

+6
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,16 @@ class MDNSResponder {
173173
// Later call MDNS::update() in every 'loop' to run the process loop
174174
// (probing, announcing, responding, ...)
175175
bool begin(const char* p_pcHostname);
176+
bool begin(const String& p_strHostname) {return begin(p_strHostname.c_str());}
176177
// for compatibility
177178
bool begin(const char* p_pcHostname,
178179
IPAddress p_IPAddress, // ignored
179180
uint32_t p_u32TTL = 120); // ignored
181+
bool begin(const String& p_strHostname,
182+
IPAddress p_IPAddress, // ignored
183+
uint32_t p_u32TTL = 120) { // ignored
184+
return begin(p_strHostname.c_str(), p_IPAddress, p_u32TTL);
185+
}
180186
// Finish MDNS processing
181187
bool close(void);
182188

0 commit comments

Comments
 (0)