Skip to content
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

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

Merged
merged 3 commits into from May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cores/esp32/WString.h
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions libraries/ESPmDNS/src/ESPmDNS.cpp
Expand Up @@ -60,15 +60,15 @@ 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;
}
//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;
}
Expand Down
5 changes: 4 additions & 1 deletion libraries/ESPmDNS/src/ESPmDNS.h
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions libraries/WiFi/src/WiFiSTA.h
Expand Up @@ -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();

Expand Down