<ahref="wojson.html"title="Custom Web pages w/o JSON"class="md-nav__link">
Custom Web pages w/o JSON
</a>
</li>
@ -906,8 +927,8 @@
</li>
<liclass="md-nav__item">
<ahref="#over-typing-with-loadelement-function"title=" Over typing with LoadElement function"class="md-nav__link">
Over typing with LoadElement function
<ahref="#overwrite-the-autoconnectelements"title=" Overwrite the AutoConnectElements"class="md-nav__link">
Overwrite the AutoConnectElements
</a>
</li>
@ -939,6 +960,13 @@
<navclass="md-nav">
<ulclass="md-nav__list">
<liclass="md-nav__item">
<ahref="#scope-lifetime-of-autoconnectaux"title="Scope & Lifetime of AutoConnectAux"class="md-nav__link">
Scope & Lifetime of AutoConnectAux
</a>
</li>
<liclass="md-nav__item">
<ahref="#the-uri-of-the-custom-web-pages"title="The URI of the custom Web pages"class="md-nav__link">
The URI of the custom Web pages
@ -1292,7 +1320,7 @@
<spanstyle="color: #f8f8f2">}</span>
</pre></div>
<p>The above example handles in the handler for the values of a custom web page. An <ahref="api.html#on">AutoConnect::on</a> function registers a handler for the AutoConnectAux page of the specified uri. The argument of the custom Web page handler is an AutoConnectAux of the page itself and the <ahref="https://github.com/Hieromon/PageBuilder#arguments-of-invoked-user-function">PageArgument</a> object.</p>
<p>The above example handles in the handler for the values of a custom Web page. An <ahref="api.html#on">AutoConnect::on</a> function registers a handler for the AutoConnectAux page of the specified uri. The argument of the custom Web page handler is an AutoConnectAux of the page itself and the <ahref="https://github.com/Hieromon/PageBuilder#arguments-of-invoked-user-function">PageArgument</a> object.</p>
<p>To retrieve the values entered in a custom Web page you need to access the AutoConnectElement of the page that caused the request to this page and to do this, you use the <ahref="api.html#where">AutoConnect::where</a> function. The <code>AutoConnect::where</code> function returns a pointer to the AutoConnectAux object of the custom Web page that caused the HTTP request.</p>
<divclass="admonition note">
<pclass="admonition-title">The where() function is available for only AutoConnectAux.</p>
@ -1414,11 +1442,94 @@ ESP8266WebServer class will parse the query string and rebuilds its arguments wh
<h3id="over-typing-with-loadelement-function"><iclass="fa fa-wpforms"></i> Over typing with LoadElement function<aclass="headerlink"href="#over-typing-with-loadelement-function"title="Permanent link">¶</a></h3>
<p>The <ahref="apiaux.html#loadelement">AutoConnectAux::loadElement</a> function overwrites its value when loading an AutoConnectElement. If the loadElement function wields an element with an input value, the previous value will be lost by the loaded value. If you need to preserve input values even during page transition operations, we recommend that you load parameters only once at an early stage in the <code>setup()</code> of sketches.</p>
<h3id="check-data-against-on-submission"><iclass="fa fa-check-square"></i> Check data against on submission<aclass="headerlink"href="#check-data-against-on-submission"title="Permanent link">¶</a></h3>
<h3id="overwrite-the-autoconnectelements"><iclass="fa fa-wpforms"></i> Overwrite the AutoConnectElements<aclass="headerlink"href="#overwrite-the-autoconnectelements"title="Permanent link">¶</a></h3>
<p>Sketches can update the attributes of AutoConnectElements with two approaches. A one is to assign directly to the attributes of a member variable of its element. The other is to overwrite them with loading the element by <ahref="apiaux.html#loadelement">AutoConnectAux::loadElement</a>. </p>
<p>The elements for attributes described in the JSON document for AutoConnectElements overwrites the member variables of the target AutoConnectElements. However, AutoConnectAux::loadElement keeps the member variables unchanged if there is no element in the JSON document. This overwriting behavior is the same for the <ahref="api.html#load">AutoConnect::load</a> function.</p>
<p>For example, the combination of the sketch and JSON document as follows updates only the style while keeping Captiopn (ie. "Hello, world") as AutoConnectText value.</p>
<p><iclass="fa fa-code"></i> The sketch (part of code)</p>
<h3id="check-data-against-on-submission"><iclass="far fa-check-square"></i> Check data against on submission<aclass="headerlink"href="#check-data-against-on-submission"title="Permanent link">¶</a></h3>
<p>By giving a <ahref="apielements.html#pattern">pattern</a> to <ahref="apielements.html#autoconenctinput">AutoConnectInput</a>, you can find errors in data styles while typing in custom Web pages. The pattern is specified by <ahref="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">regular expression</a>.<supid="fnref:2"><aclass="footnote-ref"href="#fn:2"rel="footnote">2</a></sup> If the value during input of AutoConnectInput does not match the regular expression specified in the pattern, its background color changes to pink. The following example shows the behavior when checking the IP address in the AutoConnectInput field.</p>
<h3id="convert-data-to-actually-type"><iclass="fa fa-exchange"></i> Convert data to actually type<aclass="headerlink"href="#convert-data-to-actually-type"title="Permanent link">¶</a></h3>
<h2id="transitions-of-the-custom-web-pages">Transitions of the custom Web pages<aclass="headerlink"href="#transitions-of-the-custom-web-pages"title="Permanent link">¶</a></h2>
<h3id="scope-lifetime-of-autoconnectaux">Scope & Lifetime of AutoConnectAux<aclass="headerlink"href="#scope-lifetime-of-autoconnectaux"title="Permanent link">¶</a></h3>
<p>The lifetime of AutoConnectAux and AutoConnectElements must remain in the period when the custom Web page can be manipulated. The implementation of the custom Web page inherits from requestHandler driven from ESP8266WebServer (WebServer for ESP32), so the instance of AutoConnectAux and AutoConnectElements must exist for the duration of effect of handleClient. The following example is incorrect for manipulating custom Web pages. Its AutoConnectAux instance will be destructed at the exit of the setup().</p>
<h3id="the-uri-of-the-custom-web-pages">The URI of the custom Web pages<aclass="headerlink"href="#the-uri-of-the-custom-web-pages"title="Permanent link">¶</a></h3>
<p>The transition of the custom Web page follows the URI of the page, but the ESP8266WebServer class does not know the URI of an AutoConnectAux page. (Registering a custom Web page does not use the <em>ESP8266WebServer::on</em>/<em>WebServer::on</em> function.) Therefore ESP8266WebServer class does not detect its URI access. If you want to detect an http request to AutoConnectAux's custom Web page, you need to register its URI with the <ahref="apiaux.html#on">AutoConnectAux::on</a> function.</p>
<p>In addition to this, there are restrictions in the handler for the custom Web page as shown in the following section.</p>
@ -1446,12 +1557,21 @@ ESP8266WebServer class will parse the query string and rebuilds its arguments wh
<p>To transition from a custom Web page to a sketch owned page, execute the link function of JavaScript with the AutoConnectElement element.</p>
</div>
<script>
window.onload = function() {
Gifffer();
};
</script>
<divclass="footnote">
<hr/>
<ol>
<liid="fn:1">
<p>The valid scope of the name is within an AutoConnectAux. <aclass="footnote-backref"href="#fnref:1"rev="footnote"title="Jump back to footnote 1 in the text">↩</a></p>
</li>
<liid="fn:2">
<p>The pattern of AutoConnectInput conforms to javascript specification. <aclass="footnote-backref"href="#fnref:2"rev="footnote"title="Jump back to footnote 2 in the text">↩</a></p>
<ahref="menuize.html"title="Constucting the menu"class="md-nav__link">
Constucting the menu
</a>
</li>
<liclass="md-nav__item">
<ahref="wojson.html"title="Custom Web pages w/o JSON"class="md-nav__link">
Custom Web pages w/o JSON
</a>
</li>
@ -858,13 +865,6 @@
<labelclass="md-nav__title"for="__toc">Table of contents</label>
<ulclass="md-nav__list"data-md-scrollfix>
<liclass="md-nav__item">
<ahref="#describe-custom-web-pages-with-json"title="Describe custom Web pages with JSON"class="md-nav__link">
Describe custom Web pages with JSON
</a>
</li>
<liclass="md-nav__item">
<ahref="#json-objects-elements-for-the-custom-web-page"title="JSON objects & elements for the custom Web page"class="md-nav__link">
JSON objects & elements for the custom Web page
@ -1049,13 +1049,12 @@
<h1>Custom Web pages with JSON</h1>
<h2id="describe-custom-web-pages-with-json">Describe custom Web pages with JSON<aclass="headerlink"href="#describe-custom-web-pages-with-json"title="Permanent link">¶</a></h2>
<p>You can embed custom Web pages written in <ahref="https://www.json.org/index.html"><strong>JSON</strong></a> into AutoConnect without declaring AutoConnectAux & AutoConnectElements in sketches. Custom Web page declaration in JSON can be included in the sketch in advance as the fixed string, or it can be stored in the external file such as SPIFFS for stream loading. You can also load and save AutoConnectElements objects individually.<supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup></p>
<p>You can embed custom Web pages written in <ahref="https://www.json.org/index.html"><strong>JSON</strong></a> into AutoConnect without declaring AutoConnectAux & AutoConnectElements in sketches. Custom Web page declaration in JSON can be included in the sketch in advance as the fixed string, or it can be stored in the external file such as SPIFFS for stream loading. You can also load and save AutoConnectElements objects individually.<supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup></p>
<p>By providing the following JSON document to AutoConnect, you can include the custom Web page as the bellow:</p>
<p>A JSON document for AutoConnect can also contain declarations of multiple custom web pages. If you fit those multiple pages in one JSON document, sketch processing for loading AutoConnectAux will degenerate further.</p>
<p>A JSON document for AutoConnect can also contain declarations of multiple custom Web pages. If you fit those multiple pages in one JSON document, sketch processing for loading AutoConnectAux will degenerate further.</p>
<p>To process the AutoConnectAux & AutoConnectElements written in the JSON is you need to install the <ahref="https://arduinojson.org/v5/doc/installation/">ArduinoJson version 5</a> library.</p>
<dd>String of URI path that specifies where to place the custom web page. It needs to be a location from the root path including '<strong>/</strong>'.</dd>
<dd>String of URI path that specifies where to place the custom Web page. It needs to be a location from the root path including '<strong>/</strong>'.</dd>
<dd>This is a Boolean value indicating whether to include the custom web page in the AutoConnect menu. If the page only responds to another page and you want to prevent the direct use from the menu, you can exclude from the AutoConnect menu. If this key is false, it will not appear in the menu.</dd>
<dd>This is a Boolean value indicating whether to include the custom Web page in the AutoConnect menu. If the page only responds to another page and you want to prevent the direct use from the menu, you can exclude from the AutoConnect menu. If this key is false, it will not appear in the menu.</dd>
<pclass="admonition-title">Order of elements on a custom Web page</p>
<p>The order in which AutoConnectElements are placed on a custom web page is the order in the JSON document.</p>
<p>The order in which AutoConnectElements are placed on a custom Web page is the order in the JSON document.</p>
</div>
<h3id="multiple-custom-web-pages-declaration-in-json-document"><iclass="fa fa-copy"></i> Multiple custom Web pages declaration in JSON document<aclass="headerlink"href="#multiple-custom-web-pages-declaration-in-json-document"title="Permanent link">¶</a></h3>
<p>You can put declarations of multiple custom Web pages in one JSON document. In that case, declare an array of each custom Web page with JSON. The following JSON document contains three custom Web pages:</p>
@ -1145,16 +1144,12 @@
<h3id="json-object-for-autoconnectelements"><iclass="fa fa-caret-right"></i> JSON object for AutoConnectElements<aclass="headerlink"href="#json-object-for-autoconnectelements"title="Permanent link">¶</a></h3>
<p>AutoConnectElements in JSON description are described as an array in the <code>element</code> with arguments of each <ahref="acelements.html#constructor">constructor</a>.</p>
@ -1377,7 +1372,7 @@ An example of using each function is as follows.
</pre></div></p>
<p>AutoConnect passes the given JSON document directly to the <ahref="https://arduinojson.org/v5/api/jsonbuffer/parseobject/"><strong>parseObject()</strong></a> function of the ArduinoJson library for parsing. Therefore, the constraint of the parseObject() function is applied as it is in the parsing of the JSON document for the AutoConnect. That is, if the JSON string is read-only, duplicating the input string occurs and consumes more memory.</p>
<p>However, AutoConnect does not support saving AutoConnectAux as a whole custom Web page. If you want to persist an AutoConnectElements object, you need to save it as an AutoConenctElement object unit. AutoConnectAux has a<ahref="achandling.html#saving-autoconnectelements">function</a> to write multiple elements to the stream in a batch.</p>
<p>The sketch can persist AutoConnectElements as a JSON document and also uses <ahref="achandling.html#saving-autoconnectelements-with-json">this function</a> to save the values entered on the custom Web page. And you can reload the saved JSON document into AutoConnectElements as the field in a custom Web page using the<ahref="achandling.html#loading-autoconnectaux-autoconnectelements-with-json">load function</a>. </p>
<ahref="wojson.html"title="Custom Web pages w/o JSON"class="md-nav__link">
Custom Web pages w/o JSON
</a>
</li>
@ -899,8 +913,8 @@
</li>
<liclass="md-nav__item">
<ahref="#cast-items-of-your-sketch-own-into-the-autoccnnect-menu"title=" Cast items of your sketch own into the AutocCnnect menu"class="md-nav__link">
Cast items of your sketch own into the AutocCnnect menu
<ahref="#cast-the-legacy-html-pages-as-the-add-on-menu-items"title=" Cast the legacy HTML pages as the add-on menu items"class="md-nav__link">
Cast the legacy HTML pages as the add-on menu items
</a>
</li>
@ -1182,18 +1196,18 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
<spanstyle="color: #f8f8f2">}</span>
</pre></div>
<h3id="cast-items-of-your-sketch-own-into-the-autoccnnect-menu"><iclass="fa fa-caret-right"></i> Cast items of your sketch own into the AutocCnnect menu<aclass="headerlink"href="#cast-items-of-your-sketch-own-into-the-autoccnnect-menu"title="Permanent link">¶</a></h3>
<p>If your sketch is handling your own web page, you can call that page from the <ahref="menu.html">AutoConnect menu</a>. Unlike the custom Web pages by <ahref="apiaux.html#autoconnectaux">AutoConnectAux</a>, this allows AutoConnect menu to legacy web pages registered by <em>ESP8266WebServer::on</em>/<em>WebServer::on</em> function.</p>
<p>To implement this with your sketch, use only the <ahref="apiaux.html#autoconnectaux">AutoConnectAux</a> constructed with the URI of that page. <ahref="acelements.html">AutoConnectElements</a> is not required. The basic procedure for this as follows. </p>
<h3id="cast-the-legacy-html-pages-as-the-add-on-menu-items"><iclass="fa fa-caret-right"></i> Cast the legacy HTML pages as the add-on menu items<aclass="headerlink"href="#cast-the-legacy-html-pages-as-the-add-on-menu-items"title="Permanent link">¶</a></h3>
<p>If your sketch handles web pages, you can embed the pages into the AutoConnect menu with keeping the WiFi connection feature. Unlike the custom Web pages by <ahref="apiaux.html#autoconnectaux">AutoConnectAux</a>, this allows to legacy web pages registered by <em>ESP8266WebServer::on</em> or <em>WebServer::on</em> function.</p>
<p>To implement embedding the your sketch web pages, use only the <ahref="apiaux.html#autoconnectaux">AutoConnectAux</a> constructed with the URI of that page. <ahref="acelements.html">AutoConnectElements</a> is not required. The basic procedure for this as follows:</p>
<ol>
<li>Declare AutoConnectAux for each legacy page. It includes the URI of the page and item string which will display in the AutoConnect menu.</li>
<li>Sketch legacy page handlers.</li>
<li>Sketch the legacy page handlers.</li>
<li>Register those handler functions to ESP8266WebServer/WebServer with the <strong>on</strong> function.</li>
<li>Register AutoConnectAux declared with #1 to AutoConnect using <ahref="api.html#join">AutoConnect::join</a> function. It serves as a menu item.</li>
<li><ahref="api.html#begin">Begin</a> the portal.</li>
<li>Performs <ahref="api.html#handleClient">AutoConnect::handleClient</a> in the <strong>loop</strong> function.</li>
</ol>
<p>For details see the <ahref="menuize.html">Constructing menu</a> section of Examples page.</p>
<p>For details see the <ahref="menuize.html">Constructing the menu</a> section of Examples page.</p>
<h3id="change-menu-title"><iclass="fa fa-caret-right"></i> Change menu title<aclass="headerlink"href="#change-menu-title"title="Permanent link">¶</a></h3>
<p>Although the default menu title is <strong>AutoConnect</strong>, you can change the title by setting <ahref="apiconfig.html#title">AutoConnectConfig::title</a>. To set the menu title properly, you must set before calling <ahref="api.html#begin">AutoConnect::begin</a>.</p>
<ahref="wojson.html"title="Custom Web pages w/o JSON"class="md-nav__link">
Custom Web pages w/o JSON
</a>
</li>
@ -1070,7 +1084,7 @@
<p>The <ahref="api.html#handleclient"><strong>handleClient</strong></a> function of AutoConnect can include the response of the URI handler added by the user using the "<em>on</em>" function of ESP8266WebServer/WebServer. If ESP8266WebServer/WebServer is assigned internally by AutoConnect, the sketch can obtain that reference with the <ahref="api.html#host"><strong>host</strong></a> function.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">webServer</span>A reference of ESP8266WebServer or WebServer instance.</dd>
<dd><spanclass="apidef">webServer</span><spanclass="apidesc">A reference of ESP8266WebServer or WebServer instance.</span></dd>
</dl></p>
<h2id="public-member-functions"><iclass="fa fa-code"></i> Public member functions<aclass="headerlink"href="#public-member-functions"title="Permanent link">¶</a></h2>
Returns a pointer to AutoConnectAux with the URI specified by <em>uri</em>. If AutoConnectAux with that URI is not bound, it returns <strong>nullptr</strong>.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">uri</span>A string of the URI.</dd>
<dd><spanclass="apidef">uri</span><spanclass="apidesc">A string of the URI.</span></dd>
<dt><strong>Return value</strong></dt>
<dd>A Pointer of the AutoConnectAux instance.</dd>
</dl></p>
@ -1095,12 +1109,12 @@ AutoConnect first invokes <em>WiFi.begin</em>. If the <em>ssid</em> and the <em>
The captive portal will not be started if the connection has been established with first <em>WiFi.begin</em>. If the connection cannot establish, switch to WIFI_AP_STA mode and activate SoftAP. Then DNS server starts.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">ssid</span>SSID to be connected.</dd>
<dd><spanclass="apidef">passphrase</span>Password for connection.</dd>
<dd><spanclass="apidef">timeout</span>A time out value in milliseconds for waiting connection.</dd>
<dd><spanclass="apidef">ssid</span><spanclass="apidesc">SSID to be connected.</span></dd>
<dd><spanclass="apidef">passphrase</span><spanclass="apidesc">Password for connection.</span></dd>
<dd><spanclass="apidef">timeout</span><spanclass="apidesc">A time out value in milliseconds for waiting connection.</span></dd>
<dt><strong>Return value</strong></dt>
<dd><spanclass="apidef">true</span>Connection established, AutoConnect service started with WIFI_STA mode.</dd>
<dd><spanclass="apidef">false</span>Could not connected, Captive portal started with WIFI_AP_STA mode.</dd>
<dd><spanclass="apidef">true</span><spanclass="apidesc">Connection established, AutoConnect service started with WIFI_STA mode.</span></dd>
<dd><spanclass="apidef">false</span><spanclass="apidesc">Could not connected, Captive portal started with WIFI_AP_STA mode.</span></dd>
@ -1110,12 +1124,12 @@ The captive portal will not be started if the connection has been established wi
<p>Set SoftAP's WiFi configuration and static IP configuration.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">config</span>Reference to <ahref="apiconfig.html"><strong>AutoConnectConfig</strong></a> containing SoftAP's parameters and static IP parameters.</dd>
<dd><spanclass="apidef">ap</span>SSID for SoftAP. The default value is <strong>esp8266ap</strong> for ESP8266, <strong>esp32ap</strong> for ESP32.</dd>
<dd><spanclass="apidef">password</span>Password for SodtAP. The default value is <strong>12345678</strong>.</dd>
<dd><spanclass="apidef">config</span><spanclass="apidesc">Reference to <ahref="apiconfig.html"><strong>AutoConnectConfig</strong></a> containing SoftAP's parameters and static IP parameters.</span></dd>
<dd><spanclass="apidef">ap</span><spanclass="apidesc">SSID for SoftAP. The default value is <strong>esp8266ap</strong> for ESP8266, <strong>esp32ap</strong> for ESP32.</span></dd>
<dd><spanclass="apidef">password</span><spanclass="apidesc">Password for SodtAP. The default value is <strong>12345678</strong>.</span></dd>
@ -1141,13 +1155,13 @@ The captive portal will not be started if the connection has been established wi
<p>The handleRequest function is not supposed to use with AutoConnect::handleClient. It should be used with ESP8266WebServer::handleClient or WebServer::handleClient.</p>
Join the AutoConnectAux object to AutoConnect. AutoConnectAux objects can be joined one by one, or joined altogether. The AutoConnectAux object joined by the join function can be handled from the AutoConnect menu.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">aux</span>Reference to AutoConnectAux. It can be std::vector of std::reference_wrapper of AutoConnectAux with <ahref="https://en.cppreference.com/w/cpp/language/list_initialization">list initialization</a>.</dd>
<dd><spanclass="apidef">aux</span><spanclass="apidesc">Reference to AutoConnectAux. It can be std::vector of std::reference_wrapper of AutoConnectAux with <ahref="https://en.cppreference.com/w/cpp/language/list_initialization">list initialization</a>.</span></dd>
@ -1197,10 +1211,10 @@ Join the AutoConnectAux object to AutoConnect. AutoConnectAux objects can be joi
Load JSON document of AutoConnectAux which contains AutoConnectElements. If there is a syntax error in the JSON document, false is returned.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">aux</span>The input string to be loaded.</dd>
<dd><spanclass="apidef">aux</span><spanclass="apidesc">The input string to be loaded.</span></dd>
<dt><strong>Return value</strong></dt>
<dd><spanclass="apidef">true</span>The JSON document as AutoConnectAux successfully loaded.</dd>
<dd><spanclass="apidef">false</span>Loading JSON document unsuccessful, probably syntax errors have occurred or insufficient memory. You can diagnose the cause of loading failure using the <ahref="https://arduinojson.org/v5/assistant/">ArduinoJson Assistant</a>.</dd>
<dd><spanclass="apidef">true</span><spanclass="apidesc">The JSON document as AutoConnectAux successfully loaded.</span></dd>
<dd><spanclass="apidef">false</span><spanclass="apidesc">Loading JSON document unsuccessful, probably syntax errors have occurred or insufficient memory. You can diagnose the cause of loading failure using the <ahref="https://arduinojson.org/v5/assistant/">ArduinoJson Assistant</a>.</span></dd>
@ -1209,10 +1223,9 @@ Load JSON document of AutoConnectAux which contains AutoConnectElements. If ther
<dt>Register the handler function of the AutoConnectAux.</dt>
<dt><dlclass="apidl"></dt>
<dt><dt><strong>Parameters</strong></dt></dt>
<dt><dd><spanclass="apidef">uri</span>A string of the URI assigned to the AutoConnectAux page.</dd></dt>
<dt><dd><spanclass="apidef">handler</span>A function that behaves when a request to the AutoConnectAux page occurs. AuxHandlerFunctionT type is defined by the following declaration.</dd></dt>
<dt><dd><spanclass="apidef">order</span>Specifies when the handler is called with the following enumeration value.</dd></dt>
<dt><dd><spanclass="apidef">uri</span><spanclass="apidesc">A string of the URI assigned to the AutoConnectAux page.</span></dd></dt>
<dt><dd><spanclass="apidef">handler</span><spanclass="apidesc">A function that behaves when a request to the AutoConnectAux page occurs. AuxHandlerFunctionT type is defined by the following declaration.<pclass=""apidesc"><code>String handler(AutoConnectAux&, PageArgument&)</code></p></span></dd></dt>
<dt><dd><spanclass="apidef">order</span><spanclass="apidesc">Specifies when the handler is called with the following enumeration value.</span></dd></dt>
<dd>
<ul>
<li><strong>AC_EXIT_AHEAD</strong> :
@ -1244,7 +1257,7 @@ Called even before generating HTML and after generated.</li>
Register the function which will call from AutoConnect at the start of the captive portal.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">fn</span>Function called at the captive portal start.</dd></p>
<dd><spanclass="apidef">fn</span><spanclass="apidesc">Function called at the captive portal start.</span></dd></p>
</dl>
<p>An <em>fn</em> specifies the function called when the captive portal starts. Its prototype declaration is defined as "<em>DetectExit_ft</em>".</p>
@ -1252,10 +1265,10 @@ Register the function which will call from AutoConnect at the start of the capti
</pre></div>
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">softapIP</span>An IP address of SoftAP for the captive portal.</dd>
<dd><spanclass="apidef">softapIP</span><spanclass="apidesc">An IP address of SoftAP for the captive portal.</span></dd>
Returns a pointer to the AutoConnectAux object of the custom web page that caused the request to that page. This function is available only for the AutoConnectAux object. It is invalid for HTTP requests from individual pages registered with the <strong>on</strong> handler of ESP8266WebServer/ESP32. In other words, this function only returns the last AutoConnecAux page called.
Returns a pointer to the AutoConnectAux object of the custom Web page that caused the request to that page. This function is available only for the AutoConnectAux object. It is invalid for HTTP requests from individual pages registered with the <strong>on</strong> handler of ESP8266WebServer/ESP32. In other words, this function only returns the last AutoConnecAux page called.
<dlclass="apidl">
<dt><strong>Retuen value</strong></dt>
<dd>A pointer to the AutoConnectAux that caused the request the page.</dd>
<ahref="wojson.html"title="Custom Web pages w/o JSON"class="md-nav__link">
Custom Web pages w/o JSON
</a>
</li>
@ -931,9 +945,10 @@
</pre></div>
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">uri</span>URI of this custom Web Page.</dd>
<dd><spanclass="apidef">title</span>Page title of this custom web page. It will appear on the auto connection menu and at the top of that page.</dd>
<dd><spanclass="apidef">addons</span>Reference to AutoConnectElement collection.</dt>
<dd><spanclass="apidef">uri</span><spanclass="apidesc">URI of this custom Web Page.</span></dd>
<dd><spanclass="apidef">title</span><spanclass="apidesc">Page title of this custom Web page. It will appear on the auto connection menu and at the top of that page.</span></dd>
<dd><spanclass="apidef">menu</span><spanclass="apidesc">Specifies whether to display this page on menu.</span></dd>
<dd><spanclass="apidef">addons</span><spanclass="apidesc">Reference to AutoConnectElement collection.</span></dt>
</dl></p>
<h2id="public-member-functions"><iclass="fa fa-code"></i> Public member functions<aclass="headerlink"href="#public-member-functions"title="Permanent link">¶</a></h2>
Add an element to the AutoConnectAux. An added element is displayed on the custom Web page invoked from the AutoConnect menu.</p>
Add an element to the AutoConnectAux. An added element is displayed on the custom Web page invoked from the AutoConnect menu.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">addon</span><spanclass="apidesc">Reference of AutoConnectElements. Specifies one of the AutoConnectElements classes.</span></dd>
<dd><spanclass="apidef">addons</span><spanclass="apidesc">An array list of reference of AutoConnectElements. An <ahref="https://en.cppreference.com/w/cpp/language/list_initialization">list initialization</a> of the <ahref="https://en.cppreference.com/w/cpp/container/vector">std::vector</a> can be used for the addons parameter cause the actual definition of type <strong>AutoConnectElementVT</strong> is <code>std::vector<std::reference_wrapper<AutoConnectElement>></code>.</span></dd>
<p>Get registered AutoConnectElement as specified name.</p>
</pre></div>
Get a registered AutoConnectElement as specified name. If <strong>T</strong> is specified as an actual type of AutoConnectElements, it returns a reference to that instance.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">T</span><spanclass="apidesc">Actual type name of AutoConnectElements as <ahref="apielements.html#autoconnectbutton">AutoConnectButton</a>, <ahref="apielements.html#autoconnectcheckbox">AutoConnectCheckbox</a>, <ahref="apielements.html#autoconnectelement">AutoConnectElement</a>, <ahref="apielements.html#autoconnectinput">AutoConnectInput</a>, <ahref="apielements.html#autoconnectradio">AutoConnectRadio</a>, <ahref="apielements.html#autoconnectselect">AutoConnectSelect</a>, <ahref="apielements.html#autoconnectsubmit">AutoConnectSubmit</a>, <ahref="apielements.html#autoconnecttext">AutoConnectText</a>.</span></dd>
<dd><spanclass="apidef">name</span><spanclass="apidesc">Name of the AutoConnectElements to be retrieved.</span></dd>
<dt><strong>Return value</strong></dt><dd>A reference of the AutoConnectElements. If a type is not specified returns a pointer.</dd>
<dd>A reference to std::vector of reference to AutoConnecctElements.</dd>
</dl></p>
<p>The getElements returns a reference to std::vector of reference to AutoConnecctElements. This function is provided to handle AutoConnectElemets owned by AutoConnectAux in bulk, and you can use each method of std::vector for a return value.</p>
<divclass="codehilite"style="background: #272822"><prestyle="line-height: 125%"><span></span><spanstyle="color: #75715e">// An example of getting type and name of all AutoConnectElements registered in AutoConnectAux.</span>
Load all AutoConnectElements elements from JSON document into AutoConnectAux as custom Web pages. The JSON document specified by the load function must be the <ahref="acjson.html#json-objects-elements-for-the-custom-web-page">document structure</a> of AutoConnectAux. Its JSON document can describe multiple pages as an array.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">in</span><spanclass="apidesc">Specifies the JSON document to be load. The load function can input the following objects.</p>
<ul>
<li>String : Read-only String</li>
<li>PROGMEM : Character array contained in the flash</li>
<li>Stream : An entity that inherits stream class, generally SPIFFS or SD.
</span></dd>
<dt><strong>Return value</strong></dt>
<dd><spanclass="apidef">true</span><spanclass="apidesc">JSON document as the custom Web pages successfully loaded.</span></dd>
<pclass="admonition-title">Load multiple custom Web pages separately</p>
<p>Multiple custom Web pages can be loaded at once with JSON as an array. But it will consume a lot of memory. By loading a JSON document by page as much as possible, you can reduce memory consumption.</p>
Load specified element from JSON document into AutoConnectAux. The JSON document specified by the loadElement function must be the <ahref="acjson.html#json-object-for-autoconnectelements">AutoConnectElement document structure</a>. When loading from a JSON document that describes multiple elements, its description must be an array syntax.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">in</span><spanclass="apidesc">Specifies the JSON document to be load. The load function can input the following objects.</p>
<ul>
<li>String : Read-only String</li>
<li>PROGMEM : Character array contained in the flash</li>
<li>Stream : An entity that inherits stream class, generally SPIFFS or SD.
</span></dd>
<dd><spanclass="apidef">name</span><spanclass="apidesc">Specifies the name to be load. If the name is not specified, the loadElement function will load all elements contained in the JSON document.</span></dd>
<pclass="admonition-title">Maybe it is an array</p>
<p>Please note that the JSON document that is the input for loadElement is an array syntax of AutoConnectElements when there are multiple elements. For example, the following JSON document has a syntax error:</p>
Set or reset the display as menu item for this AutoConnectAux.</p>
Set or reset the display as menu item for this AutoConnectAux. This function programmatically manipulates the menu parameter of the <ahref="apiaux.html#autoconnectaux">AutoConenctAux constructor</a>.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">true</span><spanclass="apidesc">Show on the menu.</span></dd>
<dd><spanclass="apidef">false</span><spanclass="apidesc">Hidden on the menu.</span></dd>
@ -979,9 +1071,8 @@ Set or reset the display as menu item for this AutoConnectAux.</p>
<dt>Register the handler function of the AutoConnectAux.</dt>
<dt><dlclass="apidl"></dt>
<dt><dt><strong>Parameters</strong></dt></dt>
<dt><dd><spanclass="apidef">handler</span>A function that behaves when a request to the AutoConnectAux page occurs. AuxHandlerFunctionT type is defined by the following declaration.</dd></dt>
<dt><dd><spanclass="apidef">order</span>Specifies when the handler is called with the following enumeration value.</dd></dt>
<dt><dd><spanclass="apidef">handler</span><spanclass="apidesc">A function that behaves when a request to the AutoConnectAux page occurs. AuxHandlerFunctionT type is defined by the following declaration.<pclass="apidesc"><code>String handler(AutoConnectAux&, PageArgument&)</code></p></span></dd></dt>
<dt><dd><spanclass="apidef">order</span><spanclass="apidesc">Specifies when the handler is called with the following enumeration value.</span></dt>
<dd>
<ul>
<li><strong>AC_EXIT_AHEAD</strong> :
@ -997,7 +1088,7 @@ Called after AutoConnect generates the HTML of the page. You can append to HTML
<dd>
<ul>
<li><strong>AC_EXIT_BOTH</strong> :
Called even before generating HTML and after generated.</li>
Called even before generating HTML and after generated.</dd></li>
</ul>
</dd>
</dl>
@ -1006,20 +1097,70 @@ Called even before generating HTML and after generated.</li>
Release a specified AutoConnectElement from AutoConenctAux. The release function is provided to dynamically change the structure of the custom Web pages with the sketch. By combining the release function and the <ahref="apiaux.html#add">add</a> function or the <ahref="apiaux.html#loadelement">loadElement</a> function, the sketch can change the style of the custom Web page according to its behavior.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">name</span><spanclass="apidesc">Specifies the name of AutoConnectElements to be released.</span></dd>
Write elements of AutoConnectAux to the stream.</p>
Write elements of AutoConnectAux to the stream. The saveElement function outputs the specified AutoConenctElements as a JSON document using the <ahref="https://arduinojson.org/v5/api/jsonobject/prettyprintto/">prettyPrintTo</a> function of the <ahref="https://arduinojson.org/">ArduinoJson</a> library.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">out</span><spanclass="apidesc">Output stream to be output. SPIFFS, SD also Serial can be specified generally.</span></dd>
<dd><spanclass="apidef">names</span><spanclass="apidesc">The array of the name of AutoConnectElements to be output. If the names parameter is not specified, all AutoConnectElements registered in AutoConnectAux are output.</span></dd>
<dt><strong>Return value</strong></dt>
<dd>The number of bytes written.</dd>
</dl></p>
<divclass="admonition note">
<pclass="admonition-title">The output format is pretty</p>
<p>The saveElement function outputs a prettified JSON document.</p>
Sets the value of the specified AutoConnectElement. If values is specified as a <em>std::vector</em> of String, the element that can set the values is the <ahref="apielements.html#autoconnectradio">AutoConnectRadio</a> or the <ahref="apielements.html#autoconnectselect">AutoConnectSelect</a>.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">name</span><spanclass="apidesc">Specifies the name of the AutoConnectElements that you want to set the value.</span></dd>
<dd><spanclass="apidef">value</span><spanclass="apidesc">Specifies the value to be set.</span></dd>
<dd><spanclass="apidef">values</span><spanclass="apidesc">Specifies a reference of a <em>std::vector</em> of String. It contains the values of the AutoConnectRadio or the AutoConnectSelect.</span></dd>
<dt><strong>Return value</strong></dt>
<dd><spanclass="apidef">true</span><spanclass="apidesc">The value has been set.</span></dd>
<dd><spanclass="apidef">false</span><spanclass="apidesc">AutoConnectElements with the specified name are not registered. Or the type of the value is not consistent with the specified AutoConnectElements.</span></dd>
</dl></p>
<divclass="admonition hint">
<pclass="admonition-title">You can directly access the value member variable.</p>
<p>If you are gripping with the sketch to the AutoConnectElements of the target that sets the value, you can access the value member variable directly. The following sketch code has the same effect.
The difference between the setElementValue and the value access with the <ahref="apiaux.html#getelement">getElement</a> is the certainty of the registration state for the element. The <ahref="apiaux.html#getelement">getElement</a> returns an empty object if the element is not registered then a sketch assigns the value to it. May occur unexpected results and crashes. You should use the setElementValue if its registration is unsettled.</p>
Set the title string of the AutoConnectAux page.</p>
Set the title string of the custom Web page. This title will be displayed as the menu title of the custom Web page.
<dlclass="apidl">
<dt><strong>Parameter</strong></dt>
<dd><spanclass="apidef">title</span><spanclass="apidesc">Title string to be display.</span></dd>
</dl></p>
<divclass="admonition caution">
<pclass="admonition-title">Not the menu title</p>
<p>The setTitle function is not set for the AutoConnect menu title. The effect of this function is that custom Web page only. To change the AutoConnect menu title use <ahref="apiconfig.html#title">AutoConnectConfig::title</a>.</p>
<ahref="wojson.html"title="Custom Web pages w/o JSON"class="md-nav__link">
Custom Web pages w/o JSON
</a>
</li>
@ -1133,10 +1147,10 @@
</pre></div>
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">ap</span>SSID for SoftAP. The length should be up to 31. The default value is <strong>esp8266ap</strong> for ESP8266, <strong>esp32ap</strong> for ESP32.</dd>
<dd><spanclass="apidef">password</span>Password for SodtAP. The length should be from 8 to up to 63. The default value is <strong>12345678</strong>.</dd>
<dd><spanclass="apidef">timeout</span>The timeout value of the captive portal in [ms] units. The default value is 0.</dd>
<dd><spanclass="apidef">channel</span>The channel number of WIFi when SoftAP starts. The default values is 1.</dd>
<dd><spanclass="apidef">ap</span><spanclass="apidesc">SSID for SoftAP. The length should be up to 31. The default value is <strong>esp8266ap</strong> for ESP8266, <strong>esp32ap</strong> for ESP32.</span></dd>
<dd><spanclass="apidef">password</span><spanclass="apidesc">Password for SodtAP. The length should be from 8 to up to 63. The default value is <strong>12345678</strong>.</span></dd>
<dd><spanclass="apidef">timeout</span><spanclass="apidesc">The timeout value of the captive portal in [ms] units. The default value is 0.</span></dd>
<dd><spanclass="apidef">channel</span><spanclass="apidesc">The channel number of WIFi when SoftAP starts. The default values is 1.</span></dd>
</dl></p>
<h2id="public-member-variables"><iclass="fa fa-code"></i> Public member variables<aclass="headerlink"href="#public-member-variables"title="Permanent link">¶</a></h2>
<p>Sets IP address for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.
<dlclass="apidl">
<dt><strong>Type</strong></dt>
<dd><spanclass="apidef"style="width:230px;">IPAddress</span>The default value is <strong>192.168.244.1</strong></dd>
<dd><spanclass="apidef">IPAddress</span><spanclass="apidesc">The default value is <strong>192.168.244.1</strong></span></dd>
<p>Automatically will try to reconnect with the past established access point (BSSID) when the current configured SSID in ESP8266/ESP32 could not be connected. By enabling this option, <em>AutoConnect::begin()</em> function will attempt to reconnect to a known access point using credentials stored in the EEPROM, even if the connection failed by current SSID.<br/>
@ -1158,8 +1172,8 @@ If the connection fails, starts the captive portal in SoftAP + STA mode.<br />
<dd><spanclass="apidef"style="width:230px;">false</span>Starts Captive Portal in SoftAP + STA mode without trying to reconnect. This is the default.</dd>
<dd><spanclass="apidef">false</span><spanclass="apidesc">Starts Captive Portal in SoftAP + STA mode without trying to reconnect. This is the default.</span></dd>
</dl></p>
<p>When the autoReconnect option is enabled, an automatic connection will behave if the following conditions are satisfied.</p>
<ul>
@ -1172,8 +1186,8 @@ If the connection fails, starts the captive portal in SoftAP + STA mode.<br />
<dt><strong>Type</strong></dt>
<dd>bool</dd>
<dt><strong>Value</strong></dt>
<dd><spanclass="apidef"style="width:230px;">true</span>Reset after WiFi disconnected automatically.</dd>
<p>Captive portal activation switch. False for disabling the captive portal. It prevents starting the captive portal even if the connection at the first <em>WiFi.begin</em> fails.
@ -1181,8 +1195,8 @@ If the connection fails, starts the captive portal in SoftAP + STA mode.<br />
<dt><strong>Type</strong></dt>
<dd>bool</dd>
<dt><strong>Value</strong></dt>
<dd><spanclass="apidef"style="width:230px;">true</span>Enable the captive portal. This is the default.</dd>
<dd><spanclass="apidef"style="width:230px;">false</span>Disable the captive portal.</dd>
<dd><spanclass="apidef">true</span><spanclass="apidesc">Enable the captive portal. This is the default.</span></dd>
<dd><spanclass="apidef">false</span><spanclass="apidesc">Disable the captive portal.</span></dd>
<p>The credential saved automatically at the connection establishment.
@ -1190,8 +1204,8 @@ If the connection fails, starts the captive portal in SoftAP + STA mode.<br />
<dt><strong>Type</strong></dt>
<dd>AC_SAVECREDENTIAL_t</dd>
<dt><strong>Value</strong></dt>
<dd><spanclass="apidef"style="width:230px;">AC_SAVECREDENTIAL_AUTO</span>The credential saved automatically. This is the default.</dd>
<dd><spanclass="apidef"style="width:230px;">AC_SAVECREDENTIAL_NEVER</span>The credential no saved.</dd>
<dd><spanclass="apidef">AC_SAVECREDENTIAL_AUTO</span><spanclass="apidesc"></span><spanclass="apidef"> </span><spanclass="apidesc">The credential saved automatically. This is the default.</span></dd>
<dd><spanclass="apidef">AC_SAVECREDENTIAL_NEVER</span><spanclass="apidesc"></span><spanclass="apidef"> </span><spanclass="apidesc">The credential no saved.</span></dd>
<p>Specify the location to be redirected after module reset in the AutoConnect menu. It is given as an enumeration value of <strong>AC_ONBOOTURI_t</strong> indicating either the AutoConnect root path or the user screen home path.
@ -1199,8 +1213,8 @@ If the connection fails, starts the captive portal in SoftAP + STA mode.<br />
<dt><strong>Type</strong></dt>
<dd>AC_ONBOOTURI_t</dd>
<dt><strong>Value</strong></dt>
<dd><spanclass="apidef"style="width:230px;">AC_ONBOOTURI_ROOT</span>Resetting the module redirects it to the AutoConnect root path. The root path is assumed to be AUTOCONNECT_URI defined in AutoConnectDefs.h.</dd>
<dd><spanclass="apidef"style="width:230px;">AC_ONBOOTURI_HOME</span>It is redirected to the uri specified by <ahref="apiconfig.html#homeuri"><strong>AutoConnectConfig::homeUri</strong></a>.</dd>
<dd><spanclass="apidef">AC_ONBOOTURI_ROOT</span><spanclass="apidesc"></span><spanclass="apidef"> </span><spanclass="apidesc">Resetting the module redirects it to the AutoConnect root path. The root path is assumed to be AUTOCONNECT_URI defined in AutoConnectDefs.h.</span></dd>
<dd><spanclass="apidef">AC_ONBOOTURI_HOME</span><spanclass="apidesc"></span><spanclass="apidef"> </span><spanclass="apidesc">It is redirected to the uri specified by <ahref="apiconfig.html#homeuri"><strong>AutoConnectConfig::homeUri</strong></a>.</span></dd>
<p>Sets the offset address of the credential storage area for EEPROM. This value must be between greater than 4 and less than flash sector size. (4096 by SDK)<br/>
@ -1241,7 +1255,7 @@ The default value is 0.
<p>Sets gateway address for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.
<dlclass="apidl">
<dt><strong>Type</strong></dt>
<dd><spanclass="apidef"style="width:230px;">IPAddress</span>The default value is <strong>192.168.244.1</strong></dd>
<dd><spanclass="apidef">IPAddress</span><spanclass="apidesc">The default value is <strong>192.168.244.1</strong></span></dd>
<p>Sets the home path of user sketch. This path would be linked from 'HOME' in the AutoConnect menu. The default for homeUri is "/".
@ -1270,20 +1284,20 @@ The default value is 0.
<dt><strong>Type</strong></dt>
<dd>bool</dd>
<dt><strong>Value</strong></dt>
<dd><spanclass="apidef"style="width:230px;">true</span>Start the captive portal with <ahref="api.html#begin"><strong>AutoConnect::begin</strong></a>.</dd>
<dd><spanclass="apidef"style="width:230px;">false</span>Enable the first WiFi.begin() and it will start captive portal when connection failed. This is default.</dd>
<dd><spanclass="apidef">true</span><spanclass="apidesc">Start the captive portal with <ahref="api.html#begin"><strong>AutoConnect::begin</strong></a>.</span></dd>
<dd><spanclass="apidef">false</span><spanclass="apidesc">Enable the first WiFi.begin() and it will start captive portal when connection failed. This is default.</span></dd>
<p>Sets subnet mask for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.
<dlclass="apidl">
<dt><strong>Type</strong></dt>
<dd><spanclass="apidef"style="width:230px;">IPAddress</span>The default value is <strong>255.255.255.0</strong></dd>
<dd><spanclass="apidef">IPAddress</span><spanclass="apidesc">The default value is <strong>255.255.255.0</strong></span></dd>
<p>Specify the timeout value of the captive portal in [ms] units. It is valid when the station is not connected and does not time out if the station is connected to the ESP module in SoftAP mode (ie Attempting WiFi connection with the portal function). If 0, the captive portal will not be timed-out.
<dlclass="apidl">
<dt><strong>Type</strong></dt>
<dd><spanclass="apidef"style="width:230px;">unsigned long</span>Captive portal timeout value. The default value is 0.</dd>
<dd><spanclass="apidef">unsigned long</span><spanclass="apidesc">Captive portal timeout value. The default value is 0.</span></dd>
<p>Sets password for SoftAP. The length should be from 8 to up to 63. The default value is <strong>12345678</strong>.
@ -1297,8 +1311,8 @@ The default value is 0.
<dt><strong>Type</strong></dt>
<dd>bool</dd>
<dt><strong>Value</strong></dt>
<dd><spanclass="apidef"style="width:230px;">true</span>Continue the portal function even if the captive portal times out. The STA + SoftAP mode of the ESP module continues and accepts the connection request to the AP.</dd>
<dd><spanclass="apidef"style="width:230px;">false</span>When the captive portal times out, STA + SoftAP mode of the ESP module is stopped. This is default.</dd>
<dd><spanclass="apidef">true</span><spanclass="apidesc">Continue the portal function even if the captive portal times out. The STA + SoftAP mode of the ESP module continues and accepts the connection request to the AP.</span></dd>
<dd><spanclass="apidef">false</span><spanclass="apidesc">When the captive portal times out, STA + SoftAP mode of the ESP module is stopped. This is default.</span></dd>
</dl></p>
<divclass="admonition hint">
<pclass="admonition-title">Connection request after timed-out</p>
<dd><spanclass="apidef">name</span>The element name.</dd>
<dd><spanclass="apidef">value</span>Value of the element.</dd>
<dd><spanclass="apidef">action</span>Native code of the action script executed when the button is clicked.</dd>
<dd><spanclass="apidef">name</span><spanclass="apidesc">The element name.</span></dd>
<dd><spanclass="apidef">value</span><spanclass="apidesc">Value of the element.</span></dd>
<dd><spanclass="apidef">action</span><spanclass="apidesc">Native code of the action script executed when the button is clicked.</span></dd>
</dl></p>
<h3id="public-member-variables"><iclass="fa fa-code"></i> Public member variables<aclass="headerlink"href="#public-member-variables"title="Permanent link">¶</a></h3>
<p>HTML native code of the action script to be executed when the button is clicked. It is mostly used with a JavaScript to activate a script.<supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup>
<h3id="public-member-functions"><iclass="fa fa-code"></i> Public member functions<aclass="headerlink"href="#public-member-functions"title="Permanent link">¶</a></h3>
@ -1657,35 +1861,35 @@ Returns type of AutoConnectElement.
</pre></div>
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">name</span>The element name.</dd>
<dd><spanclass="apidef">value</span>Value of the element.</dd>
<dd><spanclass="apidef">label</span>A label string prefixed to the checkbox.</dd>
<dd><spanclass="apidef">check</span>Checked state of the checkbox.</dd>
<dd><spanclass="apidef">name</span><spanclass="apidesc">The element name.</span></dd>
<dd><spanclass="apidef">value</span><spanclass="apidesc">Value of the element.</span></dd>
<dd><spanclass="apidef">label</span><spanclass="apidesc">A label string prefixed to the checkbox.</span></dd>
<dd><spanclass="apidef">check</span><spanclass="apidesc">Checked state of the checkbox.</span></dd>
</dl></p>
<h3id="public-member-variables_1"><iclass="fa fa-code"></i> Public member variables<aclass="headerlink"href="#public-member-variables_1"title="Permanent link">¶</a></h3>
<p>Value of the element. It becomes a value attribute of an HTML <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">input</span><spanstyle="color: #a6e22e">type</span><spanstyle="color: #f92672">=</span><spanstyle="color: #e6db74">"checkbox"</span><spanstyle="color: #f8f8f2">></span></code> tag.
<p>A label is an optional string. A label is always arranged on the right side of the checkbox. Specification of a label will generate an HTML <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">label</span><spanstyle="color: #f8f8f2">></span></code> tag with an <code>id</code> attribute. The checkbox and the label are connected by the id attribute.
<h3id="public-member-functions_1"><iclass="fa fa-code"></i> Public member functions<aclass="headerlink"href="#public-member-functions_1"title="Permanent link">¶</a></h3>
@ -1702,21 +1906,21 @@ Returns type of AutoConnectElement.
</pre></div>
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">name</span>The element name.</dd>
<dd><spanclass="apidef">value</span>Value of the element.</dd>
<dd><spanclass="apidef">name</span><spanclass="apidesc">The element name.</span></dd>
<dd><spanclass="apidef">value</span><spanclass="apidesc">Value of the element.</span></dd>
</dl></p>
<h3id="public-member-variables_2"><iclass="fa fa-code"></i> Public member variables<aclass="headerlink"href="#public-member-variables_2"title="Permanent link">¶</a></h3>
<h3id="public-member-functions_2"><iclass="fa fa-code"></i> Public member functions<aclass="headerlink"href="#public-member-functions_2"title="Permanent link">¶</a></h3>
<h3id="public-member-variables_3"><iclass="fa fa-code"></i> Public member variables<aclass="headerlink"href="#public-member-variables_3"title="Permanent link">¶</a></h3>
<p>Value of the element. It becomes a value attribute of an HTML <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">input</span><spanstyle="color: #a6e22e">type</span><spanstyle="color: #f92672">=</span><spanstyle="color: #e6db74">"text"</span><spanstyle="color: #f8f8f2">></span></code> tag. An entered text in the custom Web page will be sent with a query string of the form. The value set before accessing the page is displayed as the initial value.
<p>A label is an optional string. A label is always arranged on the left side of the input box. Specification of a label will generate an HTML <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">label</span><spanstyle="color: #f8f8f2">></span></code> tag with an id attribute. The input box and the label are connected by the id attribute.
<h3id="public-member-functions_3"><iclass="fa fa-code"></i> Public member functions<aclass="headerlink"href="#public-member-functions_3"title="Permanent link">¶</a></h3>
@ -1785,46 +1989,47 @@ Returns type of AutoConnectElement.
</pre></div>
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">name</span>The element name.</dd>
<dd><spanclass="apidef">values</span>An array of values of the radio buttons. Specifies an <ahref="https://en.cppreference.com/w/cpp/container/vector">std::vector</a> object.</dd>
<dd><spanclass="apidef">order</span>The direction to arrange the radio buttons.</dd>
<dd><spanclass="apidef">checked</span>An index to be checked in the radio buttons.</dd>
<dd><spanclass="apidef">name</span><spanclass="apidesc">The element name.</span></dd>
<dd><spanclass="apidef">values</span><spanclass="apidesc">An array of values of the radio buttons. Specifies an <ahref="https://en.cppreference.com/w/cpp/container/vector">std::vector</a> object.</span></dd>
<dd><spanclass="apidef">order</span><spanclass="apidesc">The direction to arrange the radio buttons.</span></dd>
<dd><spanclass="apidef">checked</span><spanclass="apidesc">An index to be checked in the radio buttons.</span></dd>
</dl></p>
<h3id="public-member-variables_4"><iclass="fa fa-code"></i> Public member variables<aclass="headerlink"href="#public-member-variables_4"title="Permanent link">¶</a></h3>
<p>An array of String type for the radio button options. It is an initialization list can be used. The <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">input</span><spanstyle="color: #a6e22e">type</span><spanstyle="color: #f92672">=</span><spanstyle="color: #e6db74">"radio"</span><spanstyle="color: #f8f8f2">></span></code> tags will be generated from each entry in the values.
<p>Specifies the direction to arrange the radio buttons. A label will place in the left or the top according to the <strong><em>order</em></strong>. It is a value of <strong>ACArrange_t</strong> type and accepts one of the following:</p>
<p>Specifies the direction to arrange the radio buttons. A label will place in the left or the top according to the <strong><em>order</em></strong>. It is a value of <strong>ACArrange_t</strong> type and accepts one of the following:
<h3id="public-member-functions_4"><iclass="fa fa-code"></i> Public member functions<aclass="headerlink"href="#public-member-functions_4"title="Permanent link">¶</a></h3>
@ -1849,7 +2054,7 @@ Adds an option for the radio button.
Indicates the check of the specified option for the radio buttons. You can use the <strong>check</strong> function for checking dynamically with arbitrary of the radio button.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">value</span>An option string to be checked.</dd>
<dd><spanclass="apidef">value</span><spanclass="apidesc">An option string to be checked.</span></dd>
@ -1857,7 +2062,7 @@ Indicates the check of the specified option for the radio buttons. You can use t
Clear the array of option strings that AutoConnectRadio has in values. When a <strong><em>reserve</em></strong> parameter is specified, a vector container of that size is reserved.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">reserve</span>Reserved size of a container for option strings.</dd>
<dd><spanclass="apidef">reserve</span><spanclass="apidesc">Reserved size of a container for option strings.</span></dd>
<dd><spanclass="apidef">name</span><spanclass="apidesc">The element name.</span></dd>
<dd><spanclass="apidef">options</span><spanclass="apidesc">An array of options of the select element. Specifies an <ahref="https://en.cppreference.com/w/cpp/container/vector">std::vector</a> object.</span></dd>
<h3id="public-member-variables_5"><iclass="fa fa-code"></i> Public member variables<aclass="headerlink"href="#public-member-variables_5"title="Permanent link">¶</a></h3>
<p>An array of String type for the selection options. It is an initialization list can be used. The <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">option</span><spanstyle="color: #a6e22e">value</span><spanstyle="color: #f8f8f2">></span></code> tags will be generated from each entry in the options.
<h3id="public-member-functions_5"><iclass="fa fa-code"></i> Public member functions<aclass="headerlink"href="#public-member-functions_5"title="Permanent link">¶</a></h3>
<ahref="menuize.html"title="Constucting the menu"class="md-nav__link">
Constucting the menu
</a>
</li>
<liclass="md-nav__item">
<ahref="wojson.html"title="Custom Web pages w/o JSON"class="md-nav__link">
Custom Web pages w/o JSON
</a>
</li>
@ -761,8 +775,8 @@
</li>
<liclass="md-nav__item">
<ahref="#i-can-not-see-the-custom-web-page"title=" I can not see the custom web page."class="md-nav__link">
I can not see the custom web page.
<ahref="#i-cannot-see-the-custom-web-page"title=" I cannot see the custom Web page."class="md-nav__link">
I cannot see the custom Web page.
</a>
</li>
@ -1013,8 +1027,8 @@
</li>
<liclass="md-nav__item">
<ahref="#i-can-not-see-the-custom-web-page"title=" I can not see the custom web page."class="md-nav__link">
I can not see the custom web page.
<ahref="#i-cannot-see-the-custom-web-page"title=" I cannot see the custom Web page."class="md-nav__link">
I cannot see the custom Web page.
</a>
</li>
@ -1300,8 +1314,8 @@ wdt reset
<p>It consumes about 2K bytes in the static and about 12K bytes are consumed at the moment when menu executed.</p>
<h2id="i-cannot-complete-to-wi-fi-login-from-smartphone"><iclass="fa fa-question-circle"></i> I cannot complete to Wi-Fi login from smartphone.<aclass="headerlink"href="#i-cannot-complete-to-wi-fi-login-from-smartphone"title="Permanent link">¶</a></h2>
<p>Because AutoConnect does not send a login success response to the captive portal requests from the smartphone. The login success response varies iOS, Android and Windows. By analyzing the request URL of different login success inquiries for each OS, the correct behavior can be implemented, but not yet. Please resets ESP8266 from the AutoConnect menu.</p>
<h2id="i-can-not-see-the-custom-web-page"><iclass="fa fa-question-circle"></i> I can not see the custom web page.<aclass="headerlink"href="#i-can-not-see-the-custom-web-page"title="Permanent link">¶</a></h2>
<p>JSON parse error</p>
<h2id="i-cannot-see-the-custom-web-page"><iclass="fa fa-question-circle"></i> I cannot see the custom Web page.<aclass="headerlink"href="#i-cannot-see-the-custom-web-page"title="Permanent link">¶</a></h2>
<p>If the sketch is correct, a JSON syntax error may have occurred. In this case, activate the <ahref="faq.html#3-turn-on-the-debug-log-options">AC_DEBUG</a> and rerun. If you take the message of JSON syntax error, the <ahref="https://arduinojson.org/v5/assistant/">Json Assistant</a> helps syntax checking. This online tool is provided by the author of ArduinoJson and is most consistent for the AutoConnect. </p>
<h2id="autoconnect-behaves-not-stable-with-my-sketch-yet"><iclass="fa fa-question-circle"></i> AutoConnect behaves not stable with my sketch yet.<aclass="headerlink"href="#autoconnect-behaves-not-stable-with-my-sketch-yet"title="Permanent link">¶</a></h2>
<p>If AutoConnect behavior is not stable with your sketch, you can try the following measures.</p>
<h3id="4-reports-the-issue-to-autoconnect-repository-on-github">4. Reports the issue to AutoConnect repository on Github<aclass="headerlink"href="#4-reports-the-issue-to-autoconnect-repository-on-github"title="Permanent link">¶</a></h3>
<p>If you can not solve AutoConnect problems please report to <ahref="https://github.com/Hieromon/AutoConnect/issues">Issues</a>. And please make your question comprehensively, not a statement. Include all relevant information.</p>
<p>If you can not solve AutoConnect problems please report to <ahref="https://github.com/Hieromon/AutoConnect/issues">Issues</a>. And please make your question comprehensively, not a statement. Include all relevant information as follows.</p>
<ul>
<li>Hardware module</li>
<li>Arduino core Version (including the upstream tag ID.)</li>
<li>Operating System which you use</li>
<li>lwIP variant</li>
<li>Problem description</li>
<li>If you have a STACK DUMP decoded result with formatted by the code block tag</li>
<li>The sketch code with formatted by the code block tag</li>
<ahref="wojson.html"title="Custom Web pages w/o JSON"class="md-nav__link">
Custom Web pages w/o JSON
</a>
</li>
@ -874,11 +888,11 @@ Enter SSID and Passphrase and tap "<strong>apply</strong>" to starts WiFi connec
<p>You can change the HOME path using the AutoConnect API. The <ahref="api.html#home"><strong>AutoConnect::home</strong></a> function sets the URI as a link of the HOME item of the AutoConnect menu.</p>
<h2id="extend-autoconnect-menu-with-your-sketches"><iclass="fa fa-bars"></i> Extend AutoConnect menu with your sketches<aclass="headerlink"href="#extend-autoconnect-menu-with-your-sketches"title="Permanent link">¶</a></h2>
<p>The AutoConnect menu can contain custom items of your own sketch. It works for the custom Web pages by <ahref="acintro.html">AutoConnectAux</a>, addition to the request handler for ESP8266WebServer class that is registered by the ESP8266WebServer::on function or WebServer::on for ESP32. That is, you can make it as a menu item to invoke a legacy web page. The below screenshot is the result of adding an example sketch for the ESP8266WebServer library known as <ahref="https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/FSBrowser">FSBrowser</a> to the AutoConnect menu item. It adds Edit and List items with little modification of the legacy sketch code.</p>
<p>The AutoConnect menu can contain HTML pages of your sketch as custom items. It works for HTML pages implemented by <strong>ESP8266WebServer::on</strong> handler or <strong>WebServer::on</strong> handler for ESP32. That is, you can make it as menu items to invoke the legacy web page. The below screenshot is the result of adding an example sketch for the ESP8266WebServer library known as <ahref="https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/FSBrowser">FSBrowser</a> to the AutoConnect menu item. It adds Edit and List items with little modification of the legacy sketch code.</p>
<p>The procedure to extend the AutoConnect menu is described in the <ahref="advancedusage.html#cast-items-of-your-sketch-own-into-the-autoccnnect-menu">Advanced usage section</a>.</p>
<p>You can extend the AutoConnect menu to match legacy sketches and according to the procedure described in the <ahref="advancedusage.html#cast-the-legacy-html-pages-as-the-add-on-menu-items">Advanced Usage section</a>.</p>
<ahref="menuize.html"title="Constucting the menu"class="md-nav__link md-nav__link--active">
Constucting the menu
</a>
@ -648,6 +650,18 @@
</li>
<liclass="md-nav__item">
<ahref="wojson.html"title="Custom Web pages w/o JSON"class="md-nav__link">
Custom Web pages w/o JSON
</a>
</li>
</ul>
</nav>
</li>
@ -745,10 +759,10 @@
<h1>Constucting menu</h1>
<h1>Constucting the menu</h1>
<h2id="what-menus-can-be-made-using-autoconnect">What menus can be made using AutoConnect<aclass="headerlink"href="#what-menus-can-be-made-using-autoconnect"title="Permanent link">¶</a></h2>
<p>AutoConnect generates a menu dynamically depending on the instantiated <ahref="acintro.html#how-it-works">AutoConnectAux</a> at the sketch executing time. Usually, it is a collection of <ahref="acelements.html">AutoConnectElement</a>. In addition to this, you can generate a menu from only AutoConnectAux, without AutoConnectElements. That is, you can easily make the built-in menu with legacy sketches of yours.</p>
<p>AutoConnect generates a menu dynamically depending on the instantiated <ahref="acintro.html#how-it-works">AutoConnectAux</a> at the sketch executing time. Usually, it is a collection of <ahref="acelements.html">AutoConnectElement</a>. In addition to this, you can generate a menu from only AutoConnectAux, without AutoConnectElements.<br>In other words, you can easily create a built-in menu featuring the WiFi connection facility embedding the legacy web pages.</p>
<h2id="basic-mechanism-of-menu-generation">Basic mechanism of menu generation<aclass="headerlink"href="#basic-mechanism-of-menu-generation"title="Permanent link">¶</a></h2>
<p>The sketch can display the <ahref="menu.html">AutoConnect menu</a> by following three patterns depending on AutoConnect-API usage.</p>
<dl>
@ -763,9 +777,8 @@
<h2id="place-the-item-for-the-legacy-sketches-on-the-menu">Place the item for the legacy sketches on the menu<aclass="headerlink"href="#place-the-item-for-the-legacy-sketches-on-the-menu"title="Permanent link">¶</a></h2>
<p>To implement this with your sketch, use only the <ahref="apiaux.html#autoconnectaux">AutoConnectAux</a> constructed with the title and URI of that page. <ahref="acelements.html">AutoConnectElements</a> is not required.</p>
<p>The AutoConnect library package contains an example sketch for ESP8266WebServer known as FSBrowser. Its example is a sample implementation that supports AutoConnect without changing the structure of the original FSBrowser and has the menu item for <strong>Edit</strong> and <strong>List</strong>.</p>
### <iclass="fa fa-caret-right"></i> Cast items of your sketch own into the AutocCnnect menu
### <iclass="fa fa-caret-right"></i> Cast the legacy HTML pages as the add-on menu items
If your sketch is handling your own web page, you can call that page from the [AutoConnect menu](menu.md). Unlike the custom Web pages by [AutoConnectAux](apiaux.md#autoconnectaux), this allows AutoConnect menu to legacy web pages registered by *ESP8266WebServer::on*/*WebServer::on* function.
If your sketch handles web pages, you can embed the pages into the AutoConnect menu with keeping the WiFi connection feature. Unlike the custom Web pages by [AutoConnectAux](apiaux.md#autoconnectaux), this allows to legacy web pages registered by *ESP8266WebServer::on* or *WebServer::on* function.
To implement this with your sketch, use only the [AutoConnectAux](apiaux.md#autoconnectaux) constructed with the URI of that page. [AutoConnectElements](acelements.md) is not required. The basic procedure for this as follows.
To implement embedding the your sketch web pages, use only the [AutoConnectAux](apiaux.md#autoconnectaux) constructed with the URI of that page. [AutoConnectElements](acelements.md) is not required. The basic procedure for this as follows:
1. Declare AutoConnectAux for each legacy page. It includes the URI of the page and item string which will display in the AutoConnect menu.
2. Sketch legacy page handlers.
2. Sketch the legacy page handlers.
3. Register those handler functions to ESP8266WebServer/WebServer with the **on** function.
4. Register AutoConnectAux declared with #1 to AutoConnect using [AutoConnect::join](api.md#join) function. It serves as a menu item.
5. [Begin](api.md#begin) the portal.
6. Performs [AutoConnect::handleClient](api.md#handleClient) in the **loop** function.
For details see the [Constructing menu](menuize.md) section of Examples page.
For details see the [Constructing the menu](menuize.md) section of Examples page.
### <iclass="fa fa-caret-right"></i> Change menu title
@ -66,9 +66,9 @@ You can change the HOME path using the AutoConnect API. The [**AutoConnect::home
## <iclass="fa fa-bars"></i> Extend AutoConnect menu with your sketches
The AutoConnect menu can contain custom items of your own sketch. It works for the custom Web pages by [AutoConnectAux](acintro.md), addition to the request handler for ESP8266WebServer class that is registered by the ESP8266WebServer::on function or WebServer::on for ESP32. That is, you can make it as a menu item to invoke a legacy web page. The below screenshot is the result of adding an example sketch for the ESP8266WebServer library known as [FSBrowser](https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/FSBrowser) to the AutoConnect menu item. It adds Edit and List items with little modification of the legacy sketch code.
The AutoConnect menu can contain HTML pages of your sketch as custom items. It works for HTML pages implemented by **ESP8266WebServer::on** handler or **WebServer::on** handler for ESP32. That is, you can make it as menu items to invoke the legacy web page. The below screenshot is the result of adding an example sketch for the ESP8266WebServer library known as [FSBrowser](https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/FSBrowser) to the AutoConnect menu item. It adds Edit and List items with little modification of the legacy sketch code.
The procedure to extend the AutoConnect menu is described in the [Advanced usage section](advancedusage.md#cast-items-of-your-sketch-own-into-the-autoccnnect-menu).
You can extend the AutoConnect menu to match legacy sketches and according to the procedure described in the [Advanced Usage section](advancedusage.md#cast-the-legacy-html-pages-as-the-add-on-menu-items).
AutoConnect generates a menu dynamically depending on the instantiated [AutoConnectAux](acintro.md#how-it-works) at the sketch executing time. Usually, it is a collection of [AutoConnectElement](acelements.md). In addition to this, you can generate a menu from only AutoConnectAux, without AutoConnectElements. That is, you can easily make the built-in menu with legacy sketches of yours.
AutoConnect generates a menu dynamically depending on the instantiated [AutoConnectAux](acintro.md#how-it-works) at the sketch executing time. Usually, it is a collection of [AutoConnectElement](acelements.md). In addition to this, you can generate a menu from only AutoConnectAux, without AutoConnectElements.<br>In other words, you can easily create a built-in menu featuring the WiFi connection facility embedding the legacy web pages.
## Basic mechanism of menu generation
@ -25,7 +25,7 @@ The AutoConnect library package contains an example sketch for ESP8266WebServer