adds getWiFiIsSaved()

This commit is contained in:
Shawn A
2018-02-19 08:21:22 -06:00
parent 97398d7ce2
commit ea994d5ccd
2 changed files with 26 additions and 0 deletions
+23
View File
@@ -1476,13 +1476,36 @@ void WiFiManager::setScanDispPerc(boolean enabled){
_scanDispOptions = true;
}
/**
* return the last known connection result
* logged on autoconnect and wifisave, can be used to check why failed
* get as readable string with getWLStatusString(getLastConxResult);
* @since $dev
* @return bool return wl_status codes
*/
uint8_t WiFiManager::getLastConxResult(){
return _lastconxresult;
}
/**
* set the hostname (dhcp client id)
* @since $dev
* @param char* hostname 32 character hostname to use for sta+ap in esp32, sta in esp8266
* @return bool false if hostname is not valid
*/
bool WiFiManager::setHostname(const char * hostname){
//@todo max length 32
_hostname = hostname;
return true;
}
/**
* check if wifi has a saved ap or not
* @since $dev
* @return bool true if a saved ap config exists
*/
bool WiFiManager::getWiFiIsSaved(){
return WiFi_hasAutoConnect();
}
// HELPERS
+3
View File
@@ -177,7 +177,10 @@ class WiFiManager
uint8_t getLastConxResult();
// get a status as string
String getWLStatusString(uint8_t status);
// set a custom hostname, sets sta and ap dhcp client id for esp32, and sta for esp8266
bool setHostname(const char * hostname);
// check if the module has a saved ap to connect to
bool getWiFiIsSaved();
private:
std::unique_ptr<DNSServer> dnsServer;