Adds AutoConnect::where function

pull/41/head
Hieromon Ikasamo 6 years ago
parent f19aa020f1
commit 00d4b17155
  1. 1
      keywords.txt
  2. 7
      src/AutoConnect.cpp
  3. 4
      src/AutoConnect.h

@ -46,6 +46,7 @@ setTitle KEYWORD2
toHTML KEYWORD2 toHTML KEYWORD2
typeOf KEYWORD2 typeOf KEYWORD2
value KEYWORD2 value KEYWORD2
where KEYWORD2
####################################### #######################################
# Literals (KEYWORD3) # Literals (KEYWORD3)

@ -58,6 +58,7 @@ void AutoConnect::_initialize() {
_disconnectEventId = -1; // The member available for ESP32 only _disconnectEventId = -1; // The member available for ESP32 only
#endif #endif
_aux.release(); _aux.release();
_auxUri = String("");
} }
/** /**
@ -781,11 +782,11 @@ bool AutoConnect::_classifyHandle(HTTPMethod method, String uri) {
// the form data of the AutoConnectAux page and with this timing save // the form data of the AutoConnectAux page and with this timing save
// the value of each element. // the value of each element.
if (_webServer->hasArg(AUTOCONNECT_AUXURI_PARAM)) { if (_webServer->hasArg(AUTOCONNECT_AUXURI_PARAM)) {
String auxUri = _webServer->arg(AUTOCONNECT_AUXURI_PARAM); _auxUri = _webServer->arg(AUTOCONNECT_AUXURI_PARAM);
auxUri.replace("/", "/"); _auxUri.replace("/", "/");
AutoConnectAux* aux = _aux.get(); AutoConnectAux* aux = _aux.get();
while (aux) { while (aux) {
if (aux->_uriStr == auxUri) { if (aux->_uriStr == _auxUri) {
aux->_storeElements(_webServer.get()); aux->_storeElements(_webServer.get());
break; break;
} }

@ -181,6 +181,7 @@ class AutoConnect {
void join(AutoConnectAux& aux); void join(AutoConnectAux& aux);
void join(AutoConnectAuxVT auxVector); void join(AutoConnectAuxVT auxVector);
bool on(const String& uri, const AuxHandlerFunctionT handler, AutoConnectExitOrder_t order = AC_EXIT_AHEAD); bool on(const String& uri, const AuxHandlerFunctionT handler, AutoConnectExitOrder_t order = AC_EXIT_AHEAD);
AutoConnectAux* where(void) const { return aux(_auxUri); }
/** For AutoConnectAux described in JSON */ /** For AutoConnectAux described in JSON */
#ifdef AUTOCONNECT_USE_JSON #ifdef AUTOCONNECT_USE_JSON
@ -255,6 +256,7 @@ class AutoConnect {
/** Extended pages made up with AutoConnectAux */ /** Extended pages made up with AutoConnectAux */
std::unique_ptr<AutoConnectAux> _aux; std::unique_ptr<AutoConnectAux> _aux;
String _auxUri; /**< Last accessed AutoConnectAux */
/** Saved configurations */ /** Saved configurations */
AutoConnectConfig _apConfig; AutoConnectConfig _apConfig;
@ -273,9 +275,9 @@ class AutoConnect {
#endif #endif
/** HTTP header information of the currently requested page. */ /** HTTP header information of the currently requested page. */
IPAddress _currentHostIP; /**< host IP address */
String _uri; /**< Requested URI */ String _uri; /**< Requested URI */
String _redirectURI; /**< Redirect destination */ String _redirectURI; /**< Redirect destination */
IPAddress _currentHostIP; /**< host IP address */
String _menuTitle; /**< Title string of the page */ String _menuTitle; /**< Title string of the page */
/** PegeElements of AutoConnect site. */ /** PegeElements of AutoConnect site. */

Loading…
Cancel
Save