diff --git a/cores/esp32/WString.h b/cores/esp32/WString.h index 4fbf3e3326e..6517109f29b 100644 --- a/cores/esp32/WString.h +++ b/cores/esp32/WString.h @@ -34,7 +34,7 @@ // A pure abstract class forward used as a means to proide a unique pointer type // but really is never defined. class __FlashStringHelper; -#define FPSTR(pstr_pointer) (reinterpret_cast(pstr_pointer)) +#define FPSTR(str_pointer) (reinterpret_cast(str_pointer)) #define F(string_literal) (FPSTR(PSTR(string_literal))) // An inherited class for holding the result of a concatenation. These diff --git a/libraries/ESPmDNS/src/ESPmDNS.cpp b/libraries/ESPmDNS/src/ESPmDNS.cpp index 77ab313a08f..cb2828716b1 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.cpp +++ b/libraries/ESPmDNS/src/ESPmDNS.cpp @@ -60,7 +60,7 @@ MDNSResponder::~MDNSResponder() { end(); } -bool MDNSResponder::begin(const char* hostName){ +bool MDNSResponder::begin(const String& hostName){ if(mdns_init()){ log_e("Failed starting MDNS"); return false; @@ -68,7 +68,7 @@ bool MDNSResponder::begin(const char* hostName){ //WiFi.onEvent(_on_sys_event); _hostname = hostName; _hostname.toLowerCase(); - if(mdns_hostname_set(hostName)) { + if(mdns_hostname_set(hostName.c_str())) { log_e("Failed setting MDNS hostname"); return false; } diff --git a/libraries/ESPmDNS/src/ESPmDNS.h b/libraries/ESPmDNS/src/ESPmDNS.h index 16c590d4a87..9a5e5c14184 100644 --- a/libraries/ESPmDNS/src/ESPmDNS.h +++ b/libraries/ESPmDNS/src/ESPmDNS.h @@ -54,7 +54,10 @@ class MDNSResponder { public: MDNSResponder(); ~MDNSResponder(); - bool begin(const char* hostName); + bool begin(const String& hostName); + bool begin(const char* hostName){ + return begin(String(hostName)); + } void end(); void setInstanceName(String name); diff --git a/libraries/WiFi/src/WiFiSTA.h b/libraries/WiFi/src/WiFiSTA.h index 2cdea7667b8..0b8f9daf053 100644 --- a/libraries/WiFi/src/WiFiSTA.h +++ b/libraries/WiFi/src/WiFiSTA.h @@ -45,7 +45,13 @@ class WiFiSTAClass public: wl_status_t begin(const char* wpa2_ssid, wpa2_auth_method_t method, const char* wpa2_identity=NULL, const char* wpa2_username=NULL, const char *wpa2_password=NULL, const char* ca_pem=NULL, const char* client_crt=NULL, const char* client_key=NULL, int32_t channel=0, const uint8_t* bssid=0, bool connect=true); + wl_status_t begin(const String& wpa2_ssid, wpa2_auth_method_t method, const String& wpa2_identity = (const char*)NULL, const String& wpa2_username = (const char*)NULL, const String& wpa2_password = (const char*)NULL, const String& ca_pem = (const char*)NULL, const String& client_crt = (const char*)NULL, const String& client_key = (const char*)NULL, int32_t channel=0, const uint8_t* bssid=0, bool connect=true) { + return begin(wpa2_ssid.c_str(), method, wpa2_identity.c_str(), wpa2_username.c_str(), wpa2_password.c_str(), ca_pem.c_str(), client_crt.c_str(), client_key.c_str(), channel, bssid, connect); + } wl_status_t begin(const char* ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true); + wl_status_t begin(const String& ssid, const String& passphrase = (const char*)NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true) { + return begin(ssid.c_str(), passphrase.c_str(), channel, bssid, connect); + } wl_status_t begin(char* ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true); wl_status_t begin();