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())) {
String location = String(F("http://")) + _webServer->client().localIP().toString() + String(AUTOCONNECT_URI);
_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().stop();
return true;
@ -767,7 +767,7 @@ String AutoConnect::_invokeResult(PageArgument& args) {
#endif
redirect += _redirectURI;
_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().stop();
_waitForEndTransmission(); // Wait for response transmission complete

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

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

Loading…
Cancel
Save