Updated a response waiting sequence of connection attempts

pull/41/head
Hieromon Ikasamo 6 years ago
parent a2000cb957
commit 20c1d9da14
  1. 4
      src/AutoConnect.cpp
  2. 10
      src/AutoConnectDefs.h
  3. 16
      src/AutoConnectPage.cpp

@ -601,7 +601,7 @@ bool AutoConnect::_captivePortal() {
if (!_isIP(hostHeader) && (hostHeader != WiFi.localIP().toString())) { if (!_isIP(hostHeader) && (hostHeader != WiFi.localIP().toString())) {
String location = String(F("http://")) + _webServer->client().localIP().toString() + String(AUTOCONNECT_URI); String location = String(F("http://")) + _webServer->client().localIP().toString() + String(AUTOCONNECT_URI);
_webServer->sendHeader(String(F("Location")), location, true); _webServer->sendHeader(String(F("Location")), location, true);
_webServer->send(302, String(F("text/plain")), ""); _webServer->send(302, String(F("text/plain")), _emptyString);
_webServer->client().flush(); _webServer->client().flush();
_webServer->client().stop(); _webServer->client().stop();
return true; return true;
@ -767,7 +767,7 @@ String AutoConnect::_invokeResult(PageArgument& args) {
#endif #endif
redirect += _redirectURI; redirect += _redirectURI;
_webServer->sendHeader(String(F("Location")), redirect, true); _webServer->sendHeader(String(F("Location")), redirect, true);
_webServer->send(302, String(F("text/plain")), ""); _webServer->send(302, String(F("text/plain")), _emptyString);
_webServer->client().flush(); _webServer->client().flush();
_webServer->client().stop(); _webServer->client().stop();
_waitForEndTransmission(); // Wait for response transmission complete _waitForEndTransmission(); // Wait for response transmission complete

@ -53,7 +53,7 @@
#define AUTOCONNECT_AP_NM 0x00FFFFFF //*< 255.255.255.0 */ #define AUTOCONNECT_AP_NM 0x00FFFFFF //*< 255.255.255.0 */
#endif // !AUTOCONNECT_AP_NM #endif // !AUTOCONNECT_AP_NM
#ifndef AUTOCONNECT_AP_CH #ifndef AUTOCONNECT_AP_CH
#define AUTOCONNECT_AP_CH 11 #define AUTOCONNECT_AP_CH 1
#endif // !AUTOCONNECT_AP_CH #endif // !AUTOCONNECT_AP_CH
// AutoConnect menu root path // AutoConnect menu root path
@ -101,10 +101,10 @@
#define AUTOCONNECT_STARTUPTIME (AUTOCONNECT_TIMEOUT/1000) #define AUTOCONNECT_STARTUPTIME (AUTOCONNECT_TIMEOUT/1000)
#endif // !AUTOCONNECT_STARTUPTIME #endif // !AUTOCONNECT_STARTUPTIME
// Response wait time until requesting a result of connection attempt [s] as String // Response wait time until requesting a result of connection attempt, uint:[s] as String
#ifndef AUTOCONNECT_RESPONSEREQUEST_TIMEOUT #ifndef AUTOCONNECT_RESPONSE_WAITTIME
#define AUTOCONNECT_RESPONSEREQUEST_TIMEOUT "7" #define AUTOCONNECT_RESPONSE_WAITTIME "2"
#endif // !AUTOCONNECT_RESPONSEREQUEST_TIMEOUT #endif // !AUTOCONNECT_RESPONSE_WAITTIME
// Default HTTP port // Default HTTP port
#ifndef AUTOCONNECT_HTTPPORT #ifndef AUTOCONNECT_HTTPPORT

@ -288,7 +288,7 @@ const char AutoConnect::_CSS_SPINNER[] PROGMEM = {
"width:100%;" "width:100%;"
"height:100%;" "height:100%;"
"border-radius:50%;" "border-radius:50%;"
"background-color:#a2d9cd;" "background-color:#a3cccc;"
"opacity:0.6;" "opacity:0.6;"
"position:absolute;" "position:absolute;"
"top:0;" "top:0;"
@ -717,17 +717,12 @@ const char AutoConnect::_PAGE_OPENCREDT[] PROGMEM = {
const char AutoConnect::_PAGE_CONNECTING[] PROGMEM = { const char AutoConnect::_PAGE_CONNECTING[] PROGMEM = {
"{{REQ}}" "{{REQ}}"
"{{HEAD}}" "{{HEAD}}"
"<meta http-equiv=\"refresh\" content=\"1;url=" AUTOCONNECT_URI_RESULT "\">"
"<title>AutoConnect connecting</title>" "<title>AutoConnect connecting</title>"
"<style type=\"text/css\">" "<style type=\"text/css\">"
"{{CSS_BASE}}" "{{CSS_BASE}}"
"{{CSS_SPINNER}}" "{{CSS_SPINNER}}"
"{{CSS_LUXBAR}}" "{{CSS_LUXBAR}}"
"</style>" "</style>"
"<script type=\"text/javascript\">"
"setTimeout(\"link()\"," AUTOCONNECT_RESPONSEREQUEST_TIMEOUT ");"
"function link(){location.href='" AUTOCONNECT_URI_RESULT "';}"
"</script>"
"</head>" "</head>"
"<body style=\"padding-top:58px;\">" "<body style=\"padding-top:58px;\">"
"<div class=\"container\">" "<div class=\"container\">"
@ -736,9 +731,13 @@ const char AutoConnect::_PAGE_CONNECTING[] PROGMEM = {
"<div class=\"spinner\">" "<div class=\"spinner\">"
"<div class=\"double-bounce1\"></div>" "<div class=\"double-bounce1\"></div>"
"<div class=\"double-bounce2\"></div>" "<div class=\"double-bounce2\"></div>"
"<div style=\"position:absolute;left:-100%;right:-100%;text-align:center;margin:10px auto;font-weight:bold;color:#4169e1;\">{{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>"
"<script type=\"text/javascript\">"
"setTimeout(\"link()\"," AUTOCONNECT_RESPONSE_WAITTIME ");"
"function link(){location.href='" AUTOCONNECT_URI_RESULT "';}"
"</script>"
"</body>" "</body>"
"</html>" "</html>"
}; };
@ -1176,7 +1175,8 @@ String AutoConnect::_token_BOOTURI(PageArgument& args) {
String AutoConnect::_token_CURRENT_SSID(PageArgument& args) { String AutoConnect::_token_CURRENT_SSID(PageArgument& args) {
AC_UNUSED(args); AC_UNUSED(args);
return String(reinterpret_cast<char*>(_credential.ssid)); String ssid = reinterpret_cast<char*>(_credential.ssid);
return ssid;
} }
/** /**

Loading…
Cancel
Save