Unverified Commit 628b668c authored by Dirk O. Kaar's avatar Dirk O. Kaar Committed by GitHub

Add overloads to support __FlashStringHelper like ESP8266 has them. (#8111)

Co-authored-by: default avatarMe No Dev <me-no-dev@users.noreply.github.com>
parent 9d8471dc
......@@ -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<const __FlashStringHelper *>(pstr_pointer))
#define FPSTR(str_pointer) (reinterpret_cast<const __FlashStringHelper *>(str_pointer))
#define F(string_literal) (FPSTR(PSTR(string_literal)))
// An inherited class for holding the result of a concatenation. These
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment