mirror of
https://github.com/alexhopeoconnor/WiFiManager.git
synced 2026-10-04 02:48:13 +10:00
#528 adds getLastConxResult
This commit is contained in:
@@ -170,6 +170,7 @@ boolean WiFiManager::autoConnect(char const *apName, char const *apPassword) {
|
||||
if (WiFi.status() == WL_CONNECTED || connectWifi("", "") == WL_CONNECTED) {
|
||||
//connected
|
||||
DEBUG_WM(F("IP Address:"),WiFi.localIP());
|
||||
_lastconxresult = WL_CONNECTED;
|
||||
return true;
|
||||
}
|
||||
// not connected start configportal
|
||||
@@ -492,6 +493,7 @@ int WiFiManager::connectWifi(String ssid, String pass) {
|
||||
connRes = waitForConnectResult();
|
||||
}
|
||||
|
||||
_lastconxresult = connRes;
|
||||
return connRes;
|
||||
}
|
||||
|
||||
@@ -1429,6 +1431,10 @@ void WiFiManager::setScanDispPerc(boolean enabled){
|
||||
_scanDispOptions = true;
|
||||
}
|
||||
|
||||
uint8_t WiFiManager::getLastConxResult(){
|
||||
return _lastconxresult;
|
||||
}
|
||||
|
||||
// HELPERS
|
||||
|
||||
template <typename Generic>
|
||||
|
||||
+7
-4
@@ -173,6 +173,10 @@ class WiFiManager
|
||||
void debugSoftAPConfig();
|
||||
// debug output platform info and versioning
|
||||
void debugPlatformInfo();
|
||||
// get last connection result, includes autoconnect and wifisave
|
||||
uint8_t getLastConxResult();
|
||||
// get a status as string
|
||||
String getWLStatusString(uint8_t status);
|
||||
|
||||
private:
|
||||
std::unique_ptr<DNSServer> dnsServer;
|
||||
@@ -204,8 +208,8 @@ class WiFiManager
|
||||
unsigned long _configPortalStart = 0; // config portal start time (updated for timeouts)
|
||||
unsigned long _webPortalAccessed = 0; // last web access time
|
||||
WiFiMode_t _usermode = WIFI_OFF;
|
||||
|
||||
String _wifissidprefix = FPSTR(S_ssidpre); // auto apname prefix prefix+chipid
|
||||
String _wifissidprefix = FPSTR(S_ssidpre); // auto apname prefix prefix+chipid
|
||||
uint8_t _lastconxresult = WL_IDLE_STATUS;
|
||||
|
||||
// option parameters
|
||||
int _minimumQuality = -1; // filter wifiscan ap by this rssi
|
||||
@@ -272,7 +276,6 @@ class WiFiManager
|
||||
String getHTTPHead(String title);
|
||||
|
||||
//helpers
|
||||
String getWLStatusString(uint8_t status);
|
||||
int getRSSIasQuality(int RSSI);
|
||||
boolean isIp(String str);
|
||||
String toStringIp(IPAddress ip);
|
||||
@@ -299,7 +302,7 @@ class WiFiManager
|
||||
|
||||
// debugging
|
||||
boolean _debug = true;
|
||||
uint8_t _debugLevel = 2;
|
||||
uint8_t _debugLevel = 1;
|
||||
Stream& _debugPort; // debug output stream ref
|
||||
template <typename Generic>
|
||||
void DEBUG_WM(Generic text);
|
||||
|
||||
+4
-4
@@ -225,11 +225,11 @@ const char HTTP_HEAD_CT2[] PROGMEM = "text/plain";
|
||||
|
||||
const char * const WIFI_STA_STATUS[] PROGMEM
|
||||
{
|
||||
"WL_IDLE_STATUS",
|
||||
"WL_NO_SSID_AVAIL",
|
||||
"WL_IDLE_STATUS", // STATION_IDLE
|
||||
"WL_NO_SSID_AVAIL", // STATION_NO_AP_FOUND
|
||||
"WL_SCAN_COMPLETED",
|
||||
"WL_CONNECTED",
|
||||
"WL_CONNECT_FAILED",
|
||||
"WL_CONNECTED", // STATION_GOT_IP
|
||||
"WL_CONNECT_FAILED",// STATION_CONNECT_FAIL, STATION_WRONG_PASSWORD(NI)
|
||||
"WL_CONNECTION_LOST",
|
||||
"WL_DISCONNECTED"
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user