|
|
@ -3,7 +3,7 @@ |
|
|
|
* @file AutoConnectPage.h |
|
|
|
* @file AutoConnectPage.h |
|
|
|
* @author hieromon@gmail.com |
|
|
|
* @author hieromon@gmail.com |
|
|
|
* @version 1.1.0 |
|
|
|
* @version 1.1.0 |
|
|
|
* @date 2019-10-13 |
|
|
|
* @date 2019-10-15 |
|
|
|
* @copyright MIT license. |
|
|
|
* @copyright MIT license. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
@ -289,7 +289,7 @@ const char AutoConnect::_CSS_SPINNER[] PROGMEM = { |
|
|
|
"position:relative;" |
|
|
|
"position:relative;" |
|
|
|
"margin:100px auto" |
|
|
|
"margin:100px auto" |
|
|
|
"}" |
|
|
|
"}" |
|
|
|
".double-bounce1, .double-bounce2{" |
|
|
|
".dbl-bounce1, .dbl-bounce2{" |
|
|
|
"width:100%;" |
|
|
|
"width:100%;" |
|
|
|
"height:100%;" |
|
|
|
"height:100%;" |
|
|
|
"border-radius:50%;" |
|
|
|
"border-radius:50%;" |
|
|
@ -301,7 +301,7 @@ const char AutoConnect::_CSS_SPINNER[] PROGMEM = { |
|
|
|
"-webkit-animation:sk-bounce 2.0s infinite ease-in-out;" |
|
|
|
"-webkit-animation:sk-bounce 2.0s infinite ease-in-out;" |
|
|
|
"animation:sk-bounce 2.0s infinite ease-in-out" |
|
|
|
"animation:sk-bounce 2.0s infinite ease-in-out" |
|
|
|
"}" |
|
|
|
"}" |
|
|
|
".double-bounce2{" |
|
|
|
".dbl-bounce2{" |
|
|
|
"-webkit-animation-delay:-1.0s;" |
|
|
|
"-webkit-animation-delay:-1.0s;" |
|
|
|
"animation-delay:-1.0s" |
|
|
|
"animation-delay:-1.0s" |
|
|
|
"}" |
|
|
|
"}" |
|
|
@ -487,10 +487,10 @@ const char AutoConnect::_CSS_LUXBAR[] PROGMEM = { |
|
|
|
"white-space:nowrap;" |
|
|
|
"white-space:nowrap;" |
|
|
|
"}" |
|
|
|
"}" |
|
|
|
"}" |
|
|
|
"}" |
|
|
|
".lb-cb:checked+.lb-menu .lb-burger-doublespin span::before{" |
|
|
|
".lb-cb:checked+.lb-menu .lb-burger-dblspin span::before{" |
|
|
|
"transform:rotate(225deg)" |
|
|
|
"transform:rotate(225deg)" |
|
|
|
"}" |
|
|
|
"}" |
|
|
|
".lb-cb:checked+.lb-menu .lb-burger-doublespin span::after{" |
|
|
|
".lb-cb:checked+.lb-menu .lb-burger-dblspin span::after{" |
|
|
|
"transform:rotate(-225deg)" |
|
|
|
"transform:rotate(-225deg)" |
|
|
|
"}" |
|
|
|
"}" |
|
|
|
".lb-menu-material," |
|
|
|
".lb-menu-material," |
|
|
@ -525,7 +525,7 @@ const char AutoConnect::_ELM_MENU_PRE[] PROGMEM = { |
|
|
|
"<ul class=\"lb-navigation\">" |
|
|
|
"<ul class=\"lb-navigation\">" |
|
|
|
"<li class=\"lb-header\">" |
|
|
|
"<li class=\"lb-header\">" |
|
|
|
"<a href=\"" AUTOCONNECT_URI "\" class=\"lb-brand\">MENU_TITLE</a>" |
|
|
|
"<a href=\"" AUTOCONNECT_URI "\" class=\"lb-brand\">MENU_TITLE</a>" |
|
|
|
"<label class=\"lb-burger lb-burger-doublespin\" id=\"lb-burger\" for=\"lb-cb\"><span></span></label>" |
|
|
|
"<label class=\"lb-burger lb-burger-dblspin\" id=\"lb-burger\" for=\"lb-cb\"><span></span></label>" |
|
|
|
"</li>" |
|
|
|
"</li>" |
|
|
|
"<li class=\"lb-item\"><a href=\"" AUTOCONNECT_URI_CONFIG "\">" AUTOCONNECT_MENULABEL_CONFIGNEW "</a></li>" |
|
|
|
"<li class=\"lb-item\"><a href=\"" AUTOCONNECT_URI_CONFIG "\">" AUTOCONNECT_MENULABEL_CONFIGNEW "</a></li>" |
|
|
|
"<li class=\"lb-item\"><a href=\"" AUTOCONNECT_URI_OPEN "\">" AUTOCONNECT_MENULABEL_OPENSSIDS "</a></li>" |
|
|
|
"<li class=\"lb-item\"><a href=\"" AUTOCONNECT_URI_OPEN "\">" AUTOCONNECT_MENULABEL_OPENSSIDS "</a></li>" |
|
|
@ -751,8 +751,8 @@ const char AutoConnect::_PAGE_CONNECTING[] PROGMEM = { |
|
|
|
"{{MENU_PRE}}" |
|
|
|
"{{MENU_PRE}}" |
|
|
|
"{{MENU_POST}}" |
|
|
|
"{{MENU_POST}}" |
|
|
|
"<div class=\"spinner\">" |
|
|
|
"<div class=\"spinner\">" |
|
|
|
"<div class=\"double-bounce1\"></div>" |
|
|
|
"<div class=\"dbl-bounce1\"></div>" |
|
|
|
"<div class=\"double-bounce2\"></div>" |
|
|
|
"<div class=\"dbl-bounce2\"></div>" |
|
|
|
"<div style=\"position:absolute;left:-100%;right:-100%;text-align:center;margin:10px auto;font-weight:bold;color:#0b0b33;\">{{CUR_SSID}}</div>" |
|
|
|
"<div style=\"position:absolute;left:-100%;right:-100%;text-align:center;margin:10px auto;font-weight:bold;color:#0b0b33;\">{{CUR_SSID}}</div>" |
|
|
|
"</div>" |
|
|
|
"</div>" |
|
|
|
"</div>" |
|
|
|
"</div>" |
|
|
@ -1006,15 +1006,17 @@ String AutoConnect::_token_WIFI_STATUS(PageArgument& args) { |
|
|
|
|
|
|
|
|
|
|
|
String AutoConnect::_token_STATION_STATUS(PageArgument& args) { |
|
|
|
String AutoConnect::_token_STATION_STATUS(PageArgument& args) { |
|
|
|
AC_UNUSED(args); |
|
|
|
AC_UNUSED(args); |
|
|
|
const char* wlStatusSymbol =""; |
|
|
|
PGM_P wlStatusSymbol = PSTR(""); |
|
|
|
static const char* wlStatusSymbols[] = { |
|
|
|
// const char* wlStatusSymbol ="";
|
|
|
|
|
|
|
|
PGM_P wlStatusSymbols[] = { |
|
|
|
|
|
|
|
// static const char* wlStatusSymbols[] = {
|
|
|
|
#if defined(ARDUINO_ARCH_ESP8266) |
|
|
|
#if defined(ARDUINO_ARCH_ESP8266) |
|
|
|
"IDLE", |
|
|
|
PSTR("IDLE"), |
|
|
|
"CONNECTING", |
|
|
|
PSTR("CONNECTING"), |
|
|
|
"WRONG_PASSWORD", |
|
|
|
PSTR("WRONG_PASSWORD"), |
|
|
|
"NO_AP_FOUND", |
|
|
|
PSTR("NO_AP_FOUND"), |
|
|
|
"CONNECT_FAIL", |
|
|
|
PSTR("CONNECT_FAIL"), |
|
|
|
"GOT_IP" |
|
|
|
PSTR("GOT_IP") |
|
|
|
}; |
|
|
|
}; |
|
|
|
switch (wifi_station_get_connect_status()) { |
|
|
|
switch (wifi_station_get_connect_status()) { |
|
|
|
case STATION_IDLE: |
|
|
|
case STATION_IDLE: |
|
|
@ -1036,14 +1038,14 @@ String AutoConnect::_token_STATION_STATUS(PageArgument& args) { |
|
|
|
wlStatusSymbol = wlStatusSymbols[5]; |
|
|
|
wlStatusSymbol = wlStatusSymbols[5]; |
|
|
|
break; |
|
|
|
break; |
|
|
|
#elif defined(ARDUINO_ARCH_ESP32) |
|
|
|
#elif defined(ARDUINO_ARCH_ESP32) |
|
|
|
"IDLE", |
|
|
|
PSTR("IDLE"), |
|
|
|
"NO_SSID_AVAIL", |
|
|
|
PSTR("NO_SSID_AVAIL"), |
|
|
|
"SCAN_COMPLETED", |
|
|
|
PSTR("SCAN_COMPLETED"), |
|
|
|
"CONNECTED", |
|
|
|
PSTR("CONNECTED"), |
|
|
|
"CONNECT_FAILED", |
|
|
|
PSTR("CONNECT_FAILED"), |
|
|
|
"CONNECTION_LOST", |
|
|
|
PSTR("CONNECTION_LOST"), |
|
|
|
"DISCONNECTED", |
|
|
|
PSTR("DISCONNECTED"), |
|
|
|
"NO_SHIELD" |
|
|
|
PSTR("NO_SHIELD") |
|
|
|
}; |
|
|
|
}; |
|
|
|
switch (_rsConnect) { |
|
|
|
switch (_rsConnect) { |
|
|
|
case WL_IDLE_STATUS: |
|
|
|
case WL_IDLE_STATUS: |
|
|
@ -1072,7 +1074,7 @@ String AutoConnect::_token_STATION_STATUS(PageArgument& args) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
return String("(") + String(_rsConnect) + String(") ") + String(wlStatusSymbol); |
|
|
|
return String("(") + String(_rsConnect) + String(") ") + String(FPSTR(wlStatusSymbol)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String AutoConnect::_token_LOCAL_IP(PageArgument& args) { |
|
|
|
String AutoConnect::_token_LOCAL_IP(PageArgument& args) { |
|
|
@ -1260,10 +1262,16 @@ String AutoConnect::_token_CONFIG_STAIP(PageArgument& args) { |
|
|
|
|
|
|
|
|
|
|
|
String AutoConnect::_token_OPEN_SSID(PageArgument& args) { |
|
|
|
String AutoConnect::_token_OPEN_SSID(PageArgument& args) { |
|
|
|
AC_UNUSED(args); |
|
|
|
AC_UNUSED(args); |
|
|
|
AutoConnectCredential credit(_apConfig.boundaryOffset); |
|
|
|
static const char _ssidList[] PROGMEM = "<input id=\"sb\" type=\"submit\" name=\"%s\" value=\"%s\"><label class=\"slist\">%s</label>%s<br>"; |
|
|
|
station_config_t entry; |
|
|
|
static const char _ssidRssi[] PROGMEM = "%d% Ch.%d"; |
|
|
|
|
|
|
|
static const char _ssidNA[] PROGMEM = "N/A"; |
|
|
|
|
|
|
|
static const char _ssidLock[] PROGMEM = "<span class=\"img-lock\"></span>"; |
|
|
|
|
|
|
|
static const char _ssidNull[] PROGMEM = ""; |
|
|
|
String ssidList; |
|
|
|
String ssidList; |
|
|
|
String rssiSym; |
|
|
|
station_config_t entry; |
|
|
|
|
|
|
|
char slCont[176]; |
|
|
|
|
|
|
|
char rssiCont[32]; |
|
|
|
|
|
|
|
AutoConnectCredential credit(_apConfig.boundaryOffset); |
|
|
|
|
|
|
|
|
|
|
|
uint8_t creEntries = credit.entries(); |
|
|
|
uint8_t creEntries = credit.entries(); |
|
|
|
if (creEntries > 0) { |
|
|
|
if (creEntries > 0) { |
|
|
@ -1274,20 +1282,23 @@ String AutoConnect::_token_OPEN_SSID(PageArgument& args) { |
|
|
|
ssidList = String(F("<p><b>No saved credentials.</b></p>")); |
|
|
|
ssidList = String(F("<p><b>No saved credentials.</b></p>")); |
|
|
|
|
|
|
|
|
|
|
|
for (uint8_t i = 0; i < creEntries; i++) { |
|
|
|
for (uint8_t i = 0; i < creEntries; i++) { |
|
|
|
|
|
|
|
rssiCont[0] = '\0'; |
|
|
|
|
|
|
|
PGM_P rssiSym = _ssidNA; |
|
|
|
|
|
|
|
PGM_P ssidLock = _ssidNull; |
|
|
|
credit.load(i, &entry); |
|
|
|
credit.load(i, &entry); |
|
|
|
AC_DBG("A credential #%d loaded\n", (int)i); |
|
|
|
AC_DBG("A credential #%d loaded\n", (int)i); |
|
|
|
ssidList += String(F("<input id=\"sb\" type=\"submit\" name=\"" AUTOCONNECT_PARAMID_CRED "\" value=\"")) + String(reinterpret_cast<char*>(entry.ssid)) + String(F("\"><label class=\"slist\">")); |
|
|
|
|
|
|
|
rssiSym = String(F("N/A</label>")); |
|
|
|
|
|
|
|
for (int8_t sc = 0; sc < (int8_t)_scanCount; sc++) { |
|
|
|
for (int8_t sc = 0; sc < (int8_t)_scanCount; sc++) { |
|
|
|
if (!memcmp(entry.bssid, WiFi.BSSID(sc), sizeof(station_config_t::bssid))) { |
|
|
|
if (!memcmp(entry.bssid, WiFi.BSSID(sc), sizeof(station_config_t::bssid))) { |
|
|
|
_connectCh = WiFi.channel(sc); |
|
|
|
_connectCh = WiFi.channel(sc); |
|
|
|
rssiSym = String(AutoConnect::_toWiFiQuality(WiFi.RSSI(sc))) + String(F("% Ch.")) + String(_connectCh) + String(F("</label>")); |
|
|
|
snprintf_P(rssiCont, sizeof(rssiCont), (PGM_P)_ssidRssi, AutoConnect::_toWiFiQuality(WiFi.RSSI(sc)), _connectCh); |
|
|
|
|
|
|
|
rssiSym = rssiCont; |
|
|
|
if (WiFi.encryptionType(sc) != ENC_TYPE_NONE) |
|
|
|
if (WiFi.encryptionType(sc) != ENC_TYPE_NONE) |
|
|
|
rssiSym += String(F("<span class=\"img-lock\"></span>")); |
|
|
|
ssidLock = _ssidLock; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ssidList += rssiSym + String(F("<br>")); |
|
|
|
snprintf_P(slCont, sizeof(slCont), (PGM_P)_ssidList, AUTOCONNECT_PARAMID_CRED, reinterpret_cast<char*>(entry.ssid), rssiSym, ssidLock); |
|
|
|
|
|
|
|
ssidList += String(slCont); |
|
|
|
} |
|
|
|
} |
|
|
|
return ssidList; |
|
|
|
return ssidList; |
|
|
|
} |
|
|
|
} |
|
|
|