Add WiFi.softAPSSID()

Fixes: https://github.com/espressif/arduino-esp32/issues/4922
This commit is contained in:
me-no-dev 2021-03-10 16:36:51 +02:00
parent 23f6e81d52
commit f815a7c636
2 changed files with 18 additions and 1 deletions

View File

@ -137,6 +137,21 @@ bool WiFiAPClass::softAP(const char* ssid, const char* passphrase, int channel,
return true;
}
/**
* Return the current SSID associated with the network
* @return SSID
*/
String WiFiAPClass::softAPSSID() const
{
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
return String();
}
wifi_config_t info;
if(!esp_wifi_get_config(WIFI_IF_AP, &info)) {
return String(reinterpret_cast<char*>(info.ap.ssid));
}
return String();
}
/**
* Configure access point
@ -189,7 +204,7 @@ bool WiFiAPClass::softAPdisconnect(bool wifioff)
wifi_config_t conf;
if(WiFiGenericClass::getMode() == WIFI_MODE_NULL){
return ESP_ERR_INVALID_STATE;
return false;
}
*conf.ap.ssid = 0;

View File

@ -58,6 +58,8 @@ public:
uint8_t* softAPmacAddress(uint8_t* mac);
String softAPmacAddress(void);
String softAPSSID(void) const;
protected:
};