Changed API interface of AutoConnect::where

pull/69/head
Hieromon Ikasamo 6 years ago
parent c4426a041e
commit 937cd712c5
  1. 6
      docs/api.html
  2. 2
      examples/mqttRSSI/mqttRSSI.ino
  3. 2
      examples/mqttRSSI_NA/mqttRSSI_NA.ino
  4. 6
      mkdocs/api.md
  5. 2
      src/AutoConnect.h

@ -1287,14 +1287,14 @@ Register the handler function for undefined URL request detected.
<dd><span class="apidef">fn</span><span class="apidesc">A function of the "not found" handler.</span></dd>
</dl></p>
<h3 id="where"><i class="fa fa-caret-right"></i> where<a class="headerlink" href="#where" title="Permanent link">&para;</a></h3>
<p><div class="codehilite" style="background: #272822"><pre style="line-height: 125%"><span></span><span style="color: #f8f8f2">AutoConenctAux</span><span style="color: #f92672">&amp;</span> <span style="color: #f8f8f2">where(</span><span style="color: #66d9ef">void</span><span style="color: #f8f8f2">)</span>
<p><div class="codehilite" style="background: #272822"><pre style="line-height: 125%"><span></span><span style="color: #f8f8f2">String</span> <span style="color: #f8f8f2">where(</span><span style="color: #66d9ef">void</span><span style="color: #f8f8f2">)</span>
</pre></div>
Returns a pointer to the AutoConnectAux object of the custom Web page that caused the request to the page.<br>
Returns an uri string of the AutoConnectAux uri object of the custom Web page that caused the request to the page.<br>
AutoConnect identifies the URI (ie. the referrer URI) that caused the request each time from the client occurs and will save the URI If the request source is a custom Web page of AutoConnectAux. The <strong>where</strong> function returns a pointer of AutoConnectAux which is a URI of a least recent request from the custom Web page.<br>
This function is provided to access the fields (ie. the AutoConnectElements) with a custom Web page handler of a page and is available only for request source that is the custom Web pages. It is invalid for HTTP requests from individual pages registered with the <strong>on</strong> handler of ESP8266WebServer/WebServer for ESP32. In other words, this function only returns the AutoConnecAux page which is a least recently displayed.
<dl class="apidl">
<dt><strong>Return value</strong></dt>
<dd>A pointer to the AutoConnectAux that caused the request the page.</dd>
<dd>An uri string of the AutoConnectAux that caused the request the page.</dd>
</dl></p>
<p>The <strong>where</strong> function usage is described in the section <a href="achandling.html#where-to-pick-up-the-values"><em>Where to pick up the values</em></a>.</p>

@ -275,7 +275,7 @@ String loadParams(AutoConnectAux& aux, PageArgument& args) {
String saveParams(AutoConnectAux& aux, PageArgument& args) {
// The 'where()' function returns the AutoConnectAux that caused
// the transition to this page.
AutoConnectAux& mqtt_setting = portal.where();
AutoConnectAux& mqtt_setting = portal.aux(portal.where());
getParams(mqtt_setting);
AutoConnectInput& mqttserver = mqtt_setting["mqttserver"].as<AutoConnectInput>();

@ -147,8 +147,6 @@ int getStrength(uint8_t points) {
// Retreive the value of each element entered by '/mqtt_setting'.
String saveParams(AutoConnectAux& aux, PageArgument& args) {
// The 'where()' function returns the AutoConnectAux that caused
// the transition to this page.
mqttserver.value.trim();
channelid.value.trim();
userkey.value.trim();

@ -296,14 +296,14 @@ Register the handler function for undefined URL request detected.
### <i class="fa fa-caret-right"></i> where
```cpp
AutoConenctAux& where(void)
String where(void)
```
Returns a pointer to the AutoConnectAux object of the custom Web page that caused the request to the page.<br>
Returns an uri string of the AutoConnectAux uri object of the custom Web page that caused the request to the page.<br>
AutoConnect identifies the URI (ie. the referrer URI) that caused the request each time from the client occurs and will save the URI If the request source is a custom Web page of AutoConnectAux. The **where** function returns a pointer of AutoConnectAux which is a URI of a least recent request from the custom Web page.<br>
This function is provided to access the fields (ie. the AutoConnectElements) with a custom Web page handler of a page and is available only for request source that is the custom Web pages. It is invalid for HTTP requests from individual pages registered with the **on** handler of ESP8266WebServer/WebServer for ESP32. In other words, this function only returns the AutoConnecAux page which is a least recently displayed.
<dl class="apidl">
<dt>**Return value**</dt>
<dd>A pointer to the AutoConnectAux that caused the request the page.</dd>
<dd>An uri string of the AutoConnectAux that caused the request the page.</dd>
</dl>
The **where** function usage is described in the section [*Where to pick up the values*](achandling.md#where-to-pick-up-the-values).

@ -185,7 +185,7 @@ class AutoConnect {
void join(AutoConnectAux& aux);
void join(AutoConnectAuxVT auxVector);
bool on(const String& uri, const AuxHandlerFunctionT handler, AutoConnectExitOrder_t order = AC_EXIT_AHEAD);
AutoConnectAux& where(void) const { return *aux(_auxUri); }
String where(void) const { return _auxUri; }
/** For AutoConnectAux described in JSON */
#ifdef AUTOCONNECT_USE_JSON

Loading…
Cancel
Save