<p>Furthermore, to convert an entity that is not an AutoConnectElement to its native type, you must <ahref="https://en.cppreference.com/w/cpp/language/reinterpret_cast">re-interpret</a> that type with c++.</p>
<p>Furthermore, to convert an entity that is not an AutoConnectElement to its native type, you must <ahref="https://en.cppreference.com/w/cpp/language/reinterpret_cast">re-interpret</a> that type with c++. Or, you can be coding the sketch more easily with using the <ahref="apielements.html#ast62"><strong>as<T></strong></a> function.</p>
<p>AutoConnectButton generates an HTML <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">button</span><spanstyle="color: #a6e22e">type</span><spanstyle="color: #f92672">=</span><spanstyle="color: #e6db74">"button"</span><spanstyle="color: #f8f8f2">></span></code> tag and locates a clickable button to a custom Web page. Currently AutoConnectButton corresponds only to name, value, an <em>onclick</em> attribute of HTML button tag. An <em>onclick</em> attribute is generated from an <code>action</code> member variable of the AutoConnectButton, which is mostly used with a JavaScript to activate a script.</p>
<p>AutoConnectButton generates an HTML <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">button</span><spanstyle="color: #a6e22e">type</span><spanstyle="color: #f92672">=</span><spanstyle="color: #e6db74">"button"</span><spanstyle="color: #f8f8f2">></span></code> tag and locates a clickable button to a custom Web page. Currently AutoConnectButton corresponds only to name, value, an <em>onclick</em> attribute of HTML button tag. An <em>onclick</em> attribute is generated from an <code>action</code> member variable of the AutoConnectButton, which is mostly used with a JavaScript to activate a script.</p>
<p>A checked is a Boolean value and indicates the checked status of the checkbox. The value of the checked checkbox element is packed in the query string and sent.</p>
<p>A checked is a Boolean value and indicates the checked status of the checkbox. The value of the checked checkbox element is packed in the query string and sent.</p>
<p>AutoConnectFile generates asn HTML <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">input</span><spanstyle="color: #a6e22e">type</span><spanstyle="color: #f92672">=</span><spanstyle="color: #e6db74">"file"</span><spanstyle="color: #f8f8f2">></span></code> tag and a <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">label</span><spanstyle="color: #f8f8f2">></span></code> tag. AutoConnectFile enables file upload from the client through the web browser to ESP8266/ESP32 module. You can select the flash in the module, external SD device or any output destination as the storage of the uploaded file.</p>
<p>It is the <code>name</code> of the AutoConnectFile element and matches the name attribute of the input tag. It also becomes the parameter name of the query string when submitted.</p>
<p>File name to be upload. The value contains the value entered by the client browser to the <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">input</span><spanstyle="color: #a6e22e">type</span><spanstyle="color: #f92672">=</span><spanstyle="color: #e6db74">"file"</span><spanstyle="color: #f8f8f2">></span></code> tag and is read-only. Even If you give a value to the constructor, it does not affect as an initial value like a default file name.</p>
<p>A <code>label</code> 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.</p>
<p>Specifies the destination to save the uploaded file. The destination can be specified the following values in the <em>ACFile_t</em> enumeration type.</p>
<ul>
<li><strong><code>AC_File_FS</code></strong> : Save as the SPIFFS file in flash of ESP8266/ESP32 module.</li>
<li><strong><code>AC_File_SD</code></strong> : Save to an external SD device connected to ESP8266/ESP32 module.</li>
<li><strong><code>AC_File_Extern</code></strong> : Pass the content of the uploaded file to the uploader which is declared by the sketch individually. Its uploader must inherit <ahref="acupload.html#to-upload-to-a-device-other-than-flash-or-sd"><strong>AutoConnectUploadHandler</strong></a> class and implements <em>_open</em>, <em>_write</em> and <em>_close</em> function.</li>
</ul>
<divclass="admonition note">
<pclass="admonition-title">Built-in uploader is ready.</p>
<p>AutoConnect already equips the built-in uploader for saving to the SPIFFS as AC_File_FS and the external SD as AC_File_SD. It is already implemented inside AutoConnect and will store uploaded file automatically.</p>
<p>AutoConnectInput generates 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 and a <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">label</span><spanstyle="color: #f8f8f2">></span></code> tag. It can also have a placeholder. The value of the input box is passed to the destination in the query string and can be retrieved programmatically. You can also update from the sketches.</p>
<p>AutoConnectInput generates 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 and a <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">label</span><spanstyle="color: #f8f8f2">></span></code> tag. It can also have a placeholder. The value of the input box is passed to the destination in the query string and can be retrieved programmatically. You can also update from the sketches.</p>
<p>It is the <code>name</code> of the AutoConnectInput element and matches the name attribute, the id attribute of the input tag. It also becomes the parameter name of the query string when submitted.</p>
<p>It is the <code>name</code> of the AutoConnectInput element and matches the name attribute, the id attribute of the input tag. It also becomes the parameter name of the query string when submitted.</p>
<p>It becomes a string value of the <code>value</code> 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. The text entered from the custom Web page will be grouped in the query string of the form submission and the string set before accessing the page will be displayed as the initial value.</p>
<p>It becomes a string value of the <code>value</code> 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. The text entered from the custom Web page will be grouped in the query string of the form submission and the string set before accessing the page will be displayed as the initial value.</p>
<p>A <code>label</code> 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.</p>
<p>A <code>label</code> 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.</p>
<p>A <code>pattern</code> specifies a <ahref="https://www.w3schools.com/js/js_regexp.asp">regular expression</a> that the AutoConnectInput element's value is checked against on form submission. If it is invalid, the background color will change, but it will be sent even if the data format does not match. To check whether the entered value matches the pattern, use the <ahref="apielements.html#isvalid">isValid</a> function.</p>
<p>A <code>pattern</code> specifies a <ahref="https://www.w3schools.com/js/js_regexp.asp">regular expression</a> that the AutoConnectInput element's value is checked against on form submission. If it is invalid, the background color will change, but it will be sent even if the data format does not match. To check whether the entered value matches the pattern, use the <ahref="apielements.html#isvalid">isValid</a> function.</p>
@ -1712,15 +1834,15 @@ Only <i class="far fa-square"></i> will be displayed if a label is not specified
<p>It is the <code>name</code> of the AutoConnectRadio element and matches the name attribute of the input tags. It also becomes the parameter name of the query string when submitted.</p>
<p>It is the <code>name</code> of the AutoConnectRadio element and matches the name attribute of the input tags. It also becomes the parameter name of the query string when submitted.</p>
<p>A <code>values</code> is an array of String type for the radio button options which as actually <ahref="https://en.cppreference.com/w/cpp/container/vector">std::vector</a>. It is an initialization list can be used. The input tags will be generated from each entry in the values, the amount of which is the same as the number of items in <code>values</code>.</p>
<p>A <code>values</code> is an array of String type for the radio button options which as actually <ahref="https://en.cppreference.com/w/cpp/container/vector">std::vector</a>. It is an initialization list can be used. The input tags will be generated from each entry in the values, the amount of which is the same as the number of items in <code>values</code>.</p>
<p>A label is an optional string. A label will be arranged in the left or top of the radio buttons according to the <strong>order</strong>. 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 radio buttons and the label are connected by the id attribute.</p>
<p>A label is an optional string. A label will be arranged in the left or top of the radio buttons according to the <strong>order</strong>. 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 radio buttons and the label are connected by the id attribute.</p>
<p>A <code>order</code> specifies the direction to arrange the radio buttons. It is a value of type <code>ACArrange_t</code> and accepts one of the following:</p>
<p>A <code>order</code> specifies the direction to arrange the radio buttons. It is a value of type <code>ACArrange_t</code> and accepts one of the following:</p>
@ -1736,28 +1858,28 @@ Only <i class="far fa-square"></i> will be displayed if a label is not specified
<p>An <code>options</code> is an array of String type for the options which as actually <ahref="https://en.cppreference.com/w/cpp/container/vector">std::vector</a> for an HTML <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">option</span><spanstyle="color: #f8f8f2">></span></code> tag. It is an initialization list can be used. The option tags will be generated from each entry in the options, the amount of which is the same as the number of items in an <code>options</code>.</p>
<p>An <code>options</code> is an array of String type for the options which as actually <ahref="https://en.cppreference.com/w/cpp/container/vector">std::vector</a> for an HTML <codeclass="codehilite"><spanstyle="color: #f8f8f2"><</span><spanstyle="color: #f92672">option</span><spanstyle="color: #f8f8f2">></span></code> tag. It is an initialization list can be used. The option tags will be generated from each entry in the options, the amount of which is the same as the number of items in an <code>options</code>.</p>
<p>A <code>label</code> is an optional string. A label is always arranged on the left side of the drop-down list. 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 select tag and the label are connected by the id attribute.</p>
<p>A <code>label</code> is an optional string. A label is always arranged on the left side of the drop-down list. 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 select tag and the label are connected by the id attribute.</p>
<p>AutoConnectSubmit generates 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">"button"</span><spanstyle="color: #f8f8f2">></span></code> tag attached <codeclass="codehilite">onclick</code> attribute. The native code of the <codeclass="codehilite">onclick</code> attribute is the submission of the form with the <strong>POST</strong> method.</p>
<p>AutoConnectSubmit generates 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">"button"</span><spanstyle="color: #f8f8f2">></span></code> tag attached <codeclass="codehilite">onclick</code> attribute. The native code of the <codeclass="codehilite">onclick</code> attribute is the submission of the form with the <strong>POST</strong> method.</p>
<p>It becomes a string of the <code>value</code> 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">"button"</span><spanstyle="color: #f8f8f2">></span></code> tag. The <code>value</code> will be displayed as a label of the button.</p>
<p>It becomes a string of the <code>value</code> 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">"button"</span><spanstyle="color: #f8f8f2">></span></code> tag. The <code>value</code> will be displayed as a label of the button.</p>
<small><strong><code>AutoConnectText text("text", "Publishing the WiFi signal strength to MQTT channel. RSSI value of ESP8266 to the channel created on ThingSpeak", "font-family:serif;color:#4682b4;");</code></strong></small></p>
<small><strong><code>AutoConnectText text("text", "Publishing the WiFi signal strength to MQTT channel. RSSI value of ESP8266 to the channel created on ThingSpeak", "font-family:serif;color:#4682b4;");</code></strong></small></p>
<p><small>On the page:</small><br><imgsrc="images/actext.png"></p>
<p><small>On the page:</small><br><imgsrc="images/actext.png"></p>
<p>A <code>format</code> is a pointer to a null-terminated multibyte string specifying how to interpret the value. It specifies the conversion format when outputting values. The format string conforms to C-style printf library functions, but depends on the espressif sdk implementation. The conversion specification is valid only in <strong>%s</strong> format. (Left and Right justification, width are also valid.)</p>
<h2id="how-to-coding-for-the-elements">How to coding for the elements<aclass="headerlink"href="#how-to-coding-for-the-elements"title="Permanent link">¶</a></h2>
<h2id="how-to-coding-for-the-elements">How to coding for the elements<aclass="headerlink"href="#how-to-coding-for-the-elements"title="Permanent link">¶</a></h2>
<h3id="declaration-for-the-elements-in-sketches"><iclass="fa fa-edit"></i> Declaration for the elements in Sketches<aclass="headerlink"href="#declaration-for-the-elements-in-sketches"title="Permanent link">¶</a></h3>
<h3id="declaration-for-the-elements-in-sketches"><iclass="fa fa-edit"></i> Declaration for the elements in Sketches<aclass="headerlink"href="#declaration-for-the-elements-in-sketches"title="Permanent link">¶</a></h3>
<p>Variables of each AutoConnetElement can be declared with macros. By using the macros, you can treat element name that is String type as variable in sketches.<supid="fnref:2"><aclass="footnote-ref"href="#fn:2"rel="footnote">2</a></sup></p>
<p>Variables of each AutoConnetElement can be declared with macros. By using the macros, you can treat element name that is String type as variable in sketches.<supid="fnref:2"><aclass="footnote-ref"href="#fn:2"rel="footnote">2</a></sup></p>
<p>The <ahref="apiaux.html#getelement"><strong>getElement</strong></a> function returns an AutoConnectElement with the specified name as a key. When you use this function, you need to know the type of AutoConnectElement in advance. To retrieve an AutoConnectElement by specifying its type, use the following method.</p>
<p>The <ahref="apiaux.html#getelement"><strong>getElement</strong></a> function returns an AutoConnectElement with the specified name as a key. When you use this function, you need to know the type of AutoConnectElement in advance and specify its type <T> to an argument of the getElement. A type of <T> can be specified as follows.</p>
<p>You can also use the <ahref="apiaux.html#operator">operator <strong><code>[]</code></strong> of AutoConnectAux</a> as another way to get the desired element. An operator <strong><code>[]</code></strong> is a shortcut for <ahref="apiaux.html#getelement">getElement</a> function with the reference casting and makes simplify the sketch code and treats like an array with the elements placed on a custom Web page. Its argument is the name of the element to be acquired similarly to getElement function. In the sketch, by combining the <ahref="apielements.html#ast62"><strong>AutoConnectElement::as<T></strong></a> function with the operator <code>[]</code>, you can access the AutoConnectElements reference according to its actual type. For example, the following sketch code returns the same as a reference of AutoConnectText element as the <code>caption</code>.</p>
<pclass="admonition-title">Need cast to convert to the actual type</p>
<p>An operator <code>[]</code> returns a referene of an AutoConnectElement. It is necessary to convert the type according to the actual element type with <ahref="apielements.html#ast62">AutoConnectElement::as<T></a> functon.
<p>To get all the AutoConnectElements in an AutoConnectAux object use the <ahref="apiaux.html#getelements"><strong>getElements</strong></a> function. This function returns the vector of the reference wrapper as <strong>AutoConnectElementVT</strong> to all AutoConnectElements registered in the AutoConnectAux.</p>
<p>To get all the AutoConnectElements in an AutoConnectAux object use the <ahref="apiaux.html#getelements"><strong>getElements</strong></a> function. This function returns the vector of the reference wrapper as <strong>AutoConnectElementVT</strong> to all AutoConnectElements registered in the AutoConnectAux.</p>
<li><strong>value</strong> : The file name of the upload file will be stored. The <code>value</code> is read-only and will be ignored if specified.</li>
</ul>
</dd>
<dd>
<ul>
<li><strong>label</strong> : Specifies a label of the file selection box. Its placement is always to the left of the file selection box.</li>
</ul>
</dd>
<dd>
<ul>
<li><strong>store</strong> : Specifies the destination to save the uploaded file. Its value accepts one of the following:<p>
<b>fs</b> : Save as the SPIFFS file in flash of ESP8266/ESP32 module.<br>
<b>sd</b> : Save to an external SD device connected to ESP8266/ESP32 module.<br>
<b>extern</b> : Pass the content of the uploaded file to the uploader which is declared by the sketch individually. Its uploader must inherit <ahref="acupload.html#to-upload-to-a-device-other-than-flash-or-sd"><strong>AutoConnectUploadHandler</strong></a> class and implements <em>_open</em>, <em>_write</em> and <em>_close</em> function.</p></li>
<li><strong>style</strong> : Specifies the qualification style to give to the content and can use the style attribute format as it is.</li>
<li><strong>style</strong> : Specifies the qualification style to give to the content and can use the style attribute format as it is.</li>
</ul>
</ul>
</dd>
</dd>
<dd>
<ul>
<li><strong>format</strong> : Specifies how to interpret the value. It specifies the conversion format when outputting values. The format string conforms to the C-style printf library functions, but depends on the espressif sdk implementation. The conversion specification is valid only for <strong>%s</strong> format. (Left and Right justification, width are also valid.)</li>
</ul>
</dd>
</dl>
</dl>
<divclass="admonition caution">
<divclass="admonition caution">
<pclass="admonition-title">AutoConnect's JSON parsing process is not perfect</p>
<pclass="admonition-title">AutoConnect's JSON parsing process is not perfect</p>
<p>It is based on ArduinoJson, but the process is simplified to save memory. As a result, even if there is an unnecessary key, it will not be an error. It is ignored.</p>
<p>It is based on analysis by ArduinoJson, but the semantic analysis is simplified to save memory. Consequently, it is not an error that a custom Web page JSON document to have unnecessary keys. It will be ignored.</p>
<h3id="loading-from-the-streamed-file"><iclass="fa fa-caret-right"></i> Loading from the streamed file<aclass="headerlink"href="#loading-from-the-streamed-file"title="Permanent link">¶</a></h3>
<p>AutoConnect supports loading of JSON document from the following instances:</p>
<p>AutoConnect supports loading of JSON document from the following instances:</p>
<ul>
<ul>
<li>String</li>
<li>String</li>
@ -1399,6 +1510,20 @@ An example of using each function is as follows.
<spanstyle="color: #f8f8f2">aux.close();</span>
<spanstyle="color: #f8f8f2">aux.close();</span>
</pre></div></p>
</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>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>
<h3id="adjust-the-json-document-buffer-size"><iclass="fa fa-caret-right"></i> Adjust the JSON document buffer size<aclass="headerlink"href="#adjust-the-json-document-buffer-size"title="Permanent link">¶</a></h3>
<p>AutoConnect uses ArduinoJson library's dynamic buffer to parse JSON documents. Its dynamic buffer allocation scheme depends on the version 5 or version 6 of ArduinoJson library. Either version must have enough buffer to parse the custom web page's JSON document successfully. AutoConnect has the following three constants internally to complete the parsing as much as possible in both ArduinoJson version. These constants are macro defined in <ahref="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnectDefs.h">AutoConnectDefs.h</a>.</p>
<p>If memory insufficiency occurs during JSON document parsing, you can adjust these constants to avoid insufficiency by using the <ahref="https://arduinojson.org/v6/assistant/">JsonAssistant</a> with deriving the required buffer size in advance.</p>
<p>This is a unit size constant of <ahref="https://arduinojson.org/v5/faq/what-are-the-differences-between-staticjsonbuffer-and-dynamicjsonbuffer/">DynamicJsonBuffer</a> and works when the library used is ArduinoJson version 5. A buffer size of the JSON document increases with this unit. This value relates to the impact of the fragmented heap area. If it is too large, may occur run-out of memory.</p>
<p>This is a size of <ahref="https://arduinojson.org/v6/api/dynamicjsondocument/">DynamicJsonDocument</a> for ArduinoJson version 6. This buffer is not automatically expanding, and the size determines the limit.</p>
<p>For ESP32 module equips with PSRAM, you can allocate the JSON document buffer to PSRAM. Buffer allocation to PSRAM will enable when <strong>PSRAM:Enabled</strong> option selected in the Arduino IDE's Board Manager menu. It is available since ArduinoJson 6.10.0.</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>
<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>
<divclass="footnote">
<divclass="footnote">
@ -1491,7 +1616,7 @@ An example of using each function is as follows.
<p>Registering the "not found" handler is a different way than ESP8266WebServer/WebServer. The <em>onNotFound</em> of ESP8266WebServer/WebServer does not work with AutoConnect. AutoConnect overrides <em>ESP8266WebServer::onNotFound</em>/<em>WebServer::onNotFound</em> to handle a captive portal. To register "not found" handler, use <ahref="api.html#onnotfound"><em>AutoConnect::onNotFound</em></a>.</p>
<p>Registering the "not found" handler is a different way than ESP8266WebServer (WebServer as ESP32). The <em>onNotFound</em> of ESP8266WebServer/WebServer does not work with AutoConnect. AutoConnect overrides <em>ESP8266WebServer::onNotFound</em>/<em>WebServer::onNotFound</em> to handle a captive portal. To register "not found" handler, use <ahref="api.html#onnotfound"><em>AutoConnect::onNotFound</em></a>.</p>
<h3id="access-to-saved-credentials"><iclass="fa fa-caret-right"></i> Access to saved credentials<aclass="headerlink"href="#access-to-saved-credentials"title="Permanent link">¶</a></h3>
<p>AutoConnect stores the established WiFi connection in the EEPROM of the ESP8266/ESP32 module and equips the class to access it from the sketch. You can read, write or erase the credentials using this class individually. It's <ahref="credit.html#autoconnectcredential">AutoConnectCredential</a> class which provides the access method to the saved credentials in EEPROM. Refer to section <ahref="credit.html">Saved credentail access</a> for details.</p>
<p>When the captive portal is started, SoftAP starts and the STA is disconnected. The current SSID setting memorized in ESP8266 will be lost but then the reconnect behavior of ESP32 is somewhat different from this.</p>
<p>When the captive portal is started, SoftAP starts and the STA is disconnected. The current SSID setting memorized in ESP8266 will be lost but then the reconnect behavior of ESP32 is somewhat different from this.</p>
<p>The <ahref="https://github.com/espressif/arduino-esp32/blob/a0f0bd930cfd2d607bf3d3288f46e2d265dd2e11/libraries/WiFi/src/WiFiSTA.h#L46"><em>WiFiSTAClass::disconnect</em></a> function implemented in the arduino-esp32 has extended parameters than the ESP8266's arduino-core. The second parameter of WiFi.disconnect on the arduino-esp32 core that does not exist in the <ahref="https://github.com/esp8266/Arduino/blob/7e1bdb225da8ab337373517e6a86a99432921a86/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp#L296">ESP8266WiFiSTAClass</a> has the effect of deleting the currently connected WiFi configuration and its default value is "false". On the ESP32 platform, even if WiFi.disconnect is executed, WiFi.begin() without the parameters in the next turn will try to connect to that AP. That is, automatic reconnection is implemented in arduino-esp32 already. Although this behavior appears seemingly competent, it is rather a disadvantage in scenes where you want to change the access point each time. When explicitly disconnecting WiFi from the Disconnect menu, AutoConnect will erase the AP connection settings saved by arduino-esp32 core. AutoConnect's automatic reconnection is a mechanism independent from the automatic reconnection of the arduino-esp32 core.</p>
<p>The <ahref="https://github.com/espressif/arduino-esp32/blob/a0f0bd930cfd2d607bf3d3288f46e2d265dd2e11/libraries/WiFi/src/WiFiSTA.h#L46"><em>WiFiSTAClass::disconnect</em></a> function implemented in the arduino-esp32 has extended parameters than the ESP8266's arduino-core. The second parameter of WiFi.disconnect on the arduino-esp32 core that does not exist in the <ahref="https://github.com/esp8266/Arduino/blob/7e1bdb225da8ab337373517e6a86a99432921a86/libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp#L296">ESP8266WiFiSTAClass</a> has the effect of deleting the currently connected WiFi configuration and its default value is "false". On the ESP32 platform, even if WiFi.disconnect is executed, WiFi.begin() without the parameters in the next turn will try to connect to that AP. That is, automatic reconnection is implemented in arduino-esp32 already. Although this behavior appears seemingly competent, it is rather a disadvantage in scenes where you want to change the access point each time. When explicitly disconnecting WiFi from the Disconnect menu, AutoConnect will erase the AP connection settings saved by arduino-esp32 core. AutoConnect's automatic reconnection is a mechanism independent from the automatic reconnection of the arduino-esp32 core.</p>
@ -1267,6 +1270,16 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
<h3id="change-the-menu-labels"><iclass="fa fa-caret-right"></i> Change the menu labels<aclass="headerlink"href="#change-the-menu-labels"title="Permanent link">¶</a></h3>
<p>You can change the label of the AutoConnect menu item by rewriting the default label letter in <ahref="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnectLabels.h">AutoConnectLabels.h</a> macros. However, changing menu items letter influences all the sketch's build scenes.</p>
<divclass="codehilite"style="background: #272822"><prestyle="line-height: 125%"><span></span><spanstyle="color: #75715e">#define AUTOCONNECT_MENULABEL_CONFIGNEW "Configure new AP"</span>
<h3id="combination-with-mdns"><iclass="fa fa-caret-right"></i> Combination with mDNS<aclass="headerlink"href="#combination-with-mdns"title="Permanent link">¶</a></h3>
<h3id="combination-with-mdns"><iclass="fa fa-caret-right"></i> Combination with mDNS<aclass="headerlink"href="#combination-with-mdns"title="Permanent link">¶</a></h3>
<p>With <ahref="https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266mDNS">mDNS library</a>, you can access to ESP8266 by name instead of IP address after connection. The sketch can start the MDNS responder after <ahref="api.html#begin"><em>AutoConnect::begin</em></a>.</p>
<p>With <ahref="https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266mDNS">mDNS library</a>, you can access to ESP8266 by name instead of IP address after connection. The sketch can start the MDNS responder after <ahref="api.html#begin"><em>AutoConnect::begin</em></a>.</p>
<p>Run the AutoConnect site using the externally ensured ESP8266WebServer for ESP8266 or WebServer for ESP32.</p>
<p>Run the AutoConnect site using the externally ensured ESP8266WebServer for ESP8266 or WebServer for ESP32.</p>
<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.
<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">
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dt><strong>Parameter</strong></dt>
<dd><spanclass="apidef">webServer</span><spanclass="apidesc">A reference of ESP8266WebServer or WebServer instance.</span></dd>
<dd><spanclass="apidef">webServer</span><spanclass="apidesc">A reference of ESP8266WebServer or WebServer instance.</span></dd>
</dl></p>
</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>
<h2id="public-member-functions"><iclass="fa fa-code"></i> Public member functions<aclass="headerlink"href="#public-member-functions"title="Permanent link">¶</a></h2>
@ -1120,7 +1091,7 @@
</pre></div>
</pre></div>
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>.
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">
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dt><strong>Parameter</strong></dt>
<dd><spanclass="apidef">uri</span><spanclass="apidesc">A string of the URI.</span></dd>
<dd><spanclass="apidef">uri</span><spanclass="apidesc">A string of the URI.</span></dd>
<dt><strong>Return value</strong></dt>
<dt><strong>Return value</strong></dt>
<dd>A Pointer of the AutoConnectAux instance.</dd>
<dd>A Pointer of the AutoConnectAux instance.</dd>
@ -1160,7 +1131,7 @@ The captive portal will not be started if the connection has been established wi
<dd><spanclass="apidef">false</span><spanclass="aidesc">Configuration parameter is invalid, some values out of range.</span></dd>
<dd><spanclass="apidef">false</span><spanclass="aidesc">Configuration parameter is invalid, some values out of range.</span></dd>
<p>Process the AutoConnect menu interface. The handleClient() function of the ESP8266WebServer/WebServer hosted by AutoConnect is also called from within AutoConnect, and the client request handlers contained in the user sketch are also handled.</p>
<p>Process the AutoConnect menu interface. The handleClient() function of the ESP8266WebServer/WebServer hosted by AutoConnect is also called from within AutoConnect, and the client request handlers contained in the user sketch are also handled.</p>
<p>Returns the reference of the ESP8266WebServer/WebServer which is allocated in AutoConnect automatically.
<p>Returns the reference of the ESP8266WebServer/WebServer which is allocated in AutoConnect automatically.
@ -1226,7 +1197,7 @@ or<br />
</pre></div>
</pre></div>
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.
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">
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dt><strong>Parameter</strong></dt>
<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>
<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>
<dd><spanclass="apidef">addons</span><spanclass="apidesc">Reference to AutoConnectElement collection.</span></dt>
<dd><spanclass="apidef">addons</span><spanclass="apidesc">Reference to AutoConnectElement collection.</span></dt>
</dl></p>
</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>
<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 reference to the element specified by <strong>name</strong>. An operator <code>[]</code> is a shortcut for <ahref="apiaux.html#getelement">getElement</a> function with the reference casting. Unlike getElement, which returns a pointer to that element, an operator <code>[]</code> returns a reference to that element. You also need to cast the return value to the actual type, just like the getElement function.
<dlclass="apidl">
<dt><strong>Parameter</strong></dt>
<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 to AutoConnectElement. It is different from the actual element type.</dd>
@ -998,7 +1006,7 @@ Add an element to the AutoConnectAux. An added element is displayed on the custo
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.
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">
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<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">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#autoconnectfile">AutoConnectFile</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>
<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>
<dt><strong>Return value</strong></dt><dd>A reference of the AutoConnectElements. If a type is not specified returns a pointer.</dd>
</dl></p>
</dl></p>
@ -1029,7 +1037,7 @@ Get vector of reference of all elements.
</pre></div>
</pre></div>
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.
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">
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dt><strong>Parameter</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>
<dd><spanclass="apidef">in</span><spanclass="apidesc">Specifies the JSON document to be load. The load function can input the following objects.</p>
<ul>
<ul>
<li>String : Read-only String</li>
<li>String : Read-only String</li>
@ -1088,7 +1096,7 @@ The outermost <code>[</code>, <code>]</code> is missing.</p>
</pre></div>
</pre></div>
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>.
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">
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dt><strong>Parameter</strong></dt>
<dd><spanclass="apidef">true</span><spanclass="apidesc">Show on the menu.</span></dd>
<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>
<dd><spanclass="apidef">false</span><spanclass="apidesc">Hidden on the menu.</span></dd>
</dl></p>
</dl></p>
@ -1122,12 +1130,36 @@ Called even before generating HTML and after generated.</dd></li>
Register the upload handler of the AutoConnectAux.
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dd><spanclass="apidef">T</span><spanclass="apidesc">Specifies a class name of the custom uploader inherited from <ahref="acupload.html#upload-handler-base-class">AutoConnectUploadHandler</a> class. Refer to the <ahref="acupload.html#to-upload-to-a-device-other-than-flash-or-sd">appendix</a> for details.</span></dd>
<dd><spanclass="apidef">handler</span><spanclass="apidesc">Specifies the custom uploader inherited from <ahref="acupload.html#upload-handler-base-class">AutoConnectUploadHandler</a> class. Refer to the <ahref="acupload.html#to-upload-to-a-device-other-than-flash-or-sd">appendix</a> for details.</span></dd>
<dd><spanclass="apidef">uploadFunc</span><spanclass="apidesc">A function that behaves when request to upload with the AutoConnectAux page. UploadFuncT type is defined by the following declaration.<pclass="apidesc"><code>void(const String&, const HTTPUpload&)</code></p><p>A data structure of the upload file as HTTPUpload. It is defined in the ESP8266WebServer (the WebServer for ESP32) library as follows:</p>
</p>Refer to '<ahref="acupload.html#to-upload-to-a-device-other-than-flash-or-sd">To upload to a device other than Flash or SD</a>' in section <ahref="acupload.html">appendix</a> for details.</span></dd>
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.
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">
<dlclass="apidl">
<dt><strong>Parameters</strong></dt>
<dt><strong>Parameter</strong></dt>
<dd><spanclass="apidef">name</span><spanclass="apidesc">Specifies the name of AutoConnectElements to be released.</span></dd>
<dd><spanclass="apidef">name</span><spanclass="apidesc">Specifies the name of AutoConnectElements to be released.</span></dd>
!function(e,r){"function"==typeofdefine&&define.amd?define(r):"object"==typeofexports?module.exports=r():r()(e.lunr)}(this,function(){returnfunction(t){if(void0===t)thrownewError("Lunr is not present. Please include / require Lunr before this script.");if(void0===t.stemmerSupport)thrownewError("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");vari="2"==t.version[0];t.th=function(){this.pipeline.reset(),this.pipeline.add(t.th.trimmer),i?this.tokenizer=t.th.tokenizer:(t.tokenizer&&(t.tokenizer=t.th.tokenizer),this.tokenizerFn&&(this.tokenizerFn=t.th.tokenizer))},t.th.wordCharacters="[-]",t.th.trimmer=t.trimmerSupport.generateTrimmer(t.th.wordCharacters),t.Pipeline.registerFunction(t.th.trimmer,"trimmer-th");varn=t.wordcut;n.init(),t.th.tokenizer=function(e){if(!arguments.length||null==e||null==e)return[];if(Array.isArray(e))returne.map(function(e){returni?newt.Token(e):e});varr=e.toString().replace(/^\s+/,"");returnn.cut(r).split("|")}}});
<li>Supports allocating JsonDocument buffer to PSRAM on ESP32 with ArduinoJson 6.10.0 or later.</li>
<li>Supports <ahref="apiaux.html#operator"><strong>operator<code>[]</code></strong></a> as a shortcut for AutoConnectAux::getElement function.</li>
<li>Supports <ahref="apielements.html#ast62"><strong>AutoConnectElement::as<T></strong></a> function to easily coding for conversion from an AutoConnectElement to an actual type.</li>
<li>Supports new element type <ahref="acelements.html#autoconnectfile"><strong>AutoConnectFile</strong></a> and built-in file uploader.</li>
<li>Supports a <ahref="acelements.html#format"><strong>format attribute</strong></a> with the AutoConnectText element.</li>
<li>Fixed blank page responds with Configure new.</li>
<li>Changed menu labels placement in source files structure.</li>
<p>Use <ahref="https://www.arduino.cc/reference/en/language/variables/conversion/intcast/">int()</a> or <ahref="https://www.arduino.cc/reference/en/language/variables/data-types/string/functions/toint/">toInt() of String</a>.</p>
<p>Use <ahref="https://www.arduino.cc/reference/en/language/variables/conversion/intcast/">int()</a> or <ahref="https://www.arduino.cc/reference/en/language/variables/data-types/string/functions/toint/">toInt() of String</a>.</p>
<p>Use <ahref="https://www.arduino.cc/reference/en/language/variables/conversion/floatcast/">float()</a> or <ahref="https://www.arduino.cc/reference/en/language/variables/data-types/string/functions/tofloat/">toFloat() of String</a>.</p>
<p>Use <ahref="https://www.arduino.cc/reference/en/language/variables/conversion/floatcast/">float()</a> or <ahref="https://www.arduino.cc/reference/en/language/variables/data-types/string/functions/tofloat/">toFloat() of String</a>.</p>
<h3id="date-time"><iclass="fa fa-exchange"></i> Date & Time<aclass="headerlink"href="#date-time"title="Permanent link">¶</a></h3>
<h3id="date-time"><iclass="fa fa-exchange"></i> Date & Time<aclass="headerlink"href="#date-time"title="Permanent link">¶</a></h3>
<p>The easiest way is to use the <ahref="https://www.pjrc.com/teensy/td_libs_Time.html">Arduino Time Library</a>. Sketches must accommodate differences in date and time formats depending on the time zone. You can absorb the difference in DateTime format by using <code>sscanf</code> function.<supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup></p>
<p>The easiest way is to use the <ahref="https://www.pjrc.com/teensy/td_libs_Time.html">Arduino Time Library</a>. Sketches must accommodate differences in date and time formats depending on the time zone. You can absorb the difference in DateTime format by using <code>sscanf</code> function.<supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup></p>
<h3id="ip-address"><iclass="fa fa-exchange"></i> IP address<aclass="headerlink"href="#ip-address"title="Permanent link">¶</a></h3>
<h3id="ip-address"><iclass="fa fa-exchange"></i> IP address<aclass="headerlink"href="#ip-address"title="Permanent link">¶</a></h3>
<p>To convert a String to an IP address, use <strong>IPAddress::fromString</strong>. To stringize an instance of an IP address, use <strong>IPAddress::toString</strong>.</p>
<p>To convert a String to an IP address, use <strong>IPAddress::fromString</strong>. To stringize an instance of an IP address, use <strong>IPAddress::toString</strong>.</p>
<ahref="#public-member-functions"title=" Public member functions"class="md-nav__link">
Public member functions
</a>
</li>
<liclass="md-nav__item">
<ahref="#data-structures"title=" Data structures"class="md-nav__link">
Data structures
</a>
</li>
</ul>
</nav>
</li>
</li>
<liclass="md-nav__item">
<liclass="md-nav__item">
@ -1207,7 +1112,7 @@ For AutoConnect menus to work properly, call <a href="api.html#handlerequest"><e
<h2id="how-change-esp8266ap-for-ssid-name-in-captive-portal"><iclass="fa fa-question-circle"></i> How change esp8266ap for SSID name in Captive portal?<aclass="headerlink"href="#how-change-esp8266ap-for-ssid-name-in-captive-portal"title="Permanent link">¶</a></h2>
<h2id="how-change-esp8266ap-for-ssid-name-in-captive-portal"><iclass="fa fa-question-circle"></i> How change esp8266ap for SSID name in Captive portal?<aclass="headerlink"href="#how-change-esp8266ap-for-ssid-name-in-captive-portal"title="Permanent link">¶</a></h2>
<p>You can change both by using <ahref="apiconfig.html#apid">AutoConnectConfig::apid</a> and <ahref="apiconfig.html#psk">AutoConnectConfig::psk</a>. Refer to section <ahref="advancedusage.html#change-ssid-and-password-for-softap">Change SSID and Password for SoftAP</a> in <ahref="advancedusage.html">Advanced usage</a>.</p>
<p>You can change both by using <ahref="apiconfig.html#apid">AutoConnectConfig::apid</a> and <ahref="apiconfig.html#psk">AutoConnectConfig::psk</a>. Refer to section <ahref="advancedusage.html#change-ssid-and-password-for-softap">Change SSID and Password for SoftAP</a> in <ahref="advancedusage.html">Advanced usage</a>.</p>
<h2id="how-change-http-port"><iclass="fa fa-question-circle"></i> How change HTTP port?<aclass="headerlink"href="#how-change-http-port"title="Permanent link">¶</a></h2>
<h2id="how-change-http-port"><iclass="fa fa-question-circle"></i> How change HTTP port?<aclass="headerlink"href="#how-change-http-port"title="Permanent link">¶</a></h2>
<p>HTTP port number is defined as a macro in <ahref="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnectDefs.h#L112">AutoConnect.h</a> header file. You can change it directly with several editors and must re-compile.</p>
<p>HTTP port number is defined as a macro in <ahref="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnectDefs.h#L112">AutoConnectDefs.h</a> header file. You can change it directly with several editors and must re-compile.</p>
<h2id="how-erase-the-credentials-saved-in-eeprom"><iclass="fa fa-question-circle"></i> How erase the credentials saved in EEPROM?<aclass="headerlink"href="#how-erase-the-credentials-saved-in-eeprom"title="Permanent link">¶</a></h2>
<h2id="how-erase-the-credentials-saved-in-eeprom"><iclass="fa fa-question-circle"></i> How erase the credentials saved in EEPROM?<aclass="headerlink"href="#how-erase-the-credentials-saved-in-eeprom"title="Permanent link">¶</a></h2>
<p>Make some sketches for erasing the EEPROM area, or some erasing utility is needed. You can prepare the sketch to erase the saved credential with <em>AutoConnectCredential</em>. The <em>AutoConnectCrendential</em> class provides the access method to the saved credential in EEPROM and library source file is including it.</p>
<p>Make some sketches for erasing the EEPROM area, or some erasing utility is needed. You can prepare the sketch to erase the saved credential with <em>AutoConnectCredential</em>. The <em>AutoConnectCrendential</em> class provides the access method to the saved credential in EEPROM and library source file is including it. Refer to '<ahref="credit.html#saved-credential-in-eeprom">Saved credential access</a>' on section <ahref="credit.html">Appendix</a> for details.</p>
<p>A class description of AutoConnectCredential is follows.</p>
<h3id="include-header"><iclass="fa fa-code"></i> Include header<aclass="headerlink"href="#include-header"title="Permanent link">¶</a></h3>
<p>AutoConnectCredential default constructor. The default offset value is 0. If the offset value is 0, the credential storage area starts from the top of the EEPROM. AutoConnect sometimes overwrites data when using this area with user sketch.</p>
<p>Specify offset from the top of the EEPROM for the credential storage area together. The offset value is from 0 to the flash sector size.</p>
<h3id="public-member-functions"><iclass="fa fa-code"></i> Public member functions<aclass="headerlink"href="#public-member-functions"title="Permanent link">¶</a></h3>
<ul>
<li>
<p>uint8_t <strong>entries()</strong><br/>
Returns number of entries as contained credentials.</p>
A data structure of the credential saving area in EEPROM as the below. <supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup></li>
</ul>
<table>
<thead>
<tr>
<th>Byte offset</th>
<th>Length</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>8</td>
<td>AC_CREDT</td>
</tr>
<tr>
<td>8</td>
<td>1</td>
<td>Number of contained entries (uint8_t)</td>
</tr>
<tr>
<td>9</td>
<td>2</td>
<td>Container size, excluding size of AC_CREDT and size of the number of entries(width for uint16_t type).</td>
</tr>
<tr>
<td>11</td>
<td>variable</td>
<td>SSID terminated by 0x00. Max length is 32 bytes.</td>
</tr>
<tr>
<td>variable</td>
<td>variable</td>
<td>Password plain text terminated by 0x00. Max length is 64 bytes.</td>
</tr>
<tr>
<td>variable</td>
<td>6</td>
<td>BSSID</td>
</tr>
<tr>
<td>variable</td>
<td></td>
<td>Contained the next entries. (Continuation SSID+Password+BSSID)</td>
</tr>
<tr>
<td>variable</td>
<td>1</td>
<td>0x00. End of container.</td>
</tr>
</tbody>
</table>
<divclass="admonition hint">
<divclass="admonition hint">
<pclass="admonition-title">Hint</p>
<pclass="admonition-title">Hint</p>
<p>With the <ahref="https://github.com/Hieromon/ESPShaker"><strong>ESPShaker</strong></a>, you can access EEPROM interactively from the serial monitor, and of course you can erase saved credentials.</p>
<p>With the <ahref="https://github.com/Hieromon/ESPShaker"><strong>ESPShaker</strong></a>, you can access EEPROM interactively from the serial monitor, and of course you can erase saved credentials.</p>
<h3id="4-reports-the-issue-to-autoconnect-github-repository">4. Reports the issue to AutoConnect Github repository<aclass="headerlink"href="#4-reports-the-issue-to-autoconnect-github-repository"title="Permanent link">¶</a></h3>
<h3id="4-reports-the-issue-to-autoconnect-github-repository">4. Reports the issue to AutoConnect Github repository<aclass="headerlink"href="#4-reports-the-issue-to-autoconnect-github-repository"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 to start the problem diagnostics as follows:<supid="fnref:3"><aclass="footnote-ref"href="#fn:3"rel="footnote">3</a></sup></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 to start the problem diagnostics as follows:<supid="fnref:3"><aclass="footnote-ref"href="#fn:3"rel="footnote">2</a></sup></p>
<liclass="task-list-item"><inputtype="checkbox"disabled/> Arduino core version Including the upstream commit ID if necessary</li>
<liclass="task-list-item"><inputtype="checkbox"disabled/> Arduino core version Including the upstream commit ID if necessary</li>
@ -1424,14 +1219,11 @@ wdt reset
<divclass="footnote">
<divclass="footnote">
<hr/>
<hr/>
<ol>
<ol>
<liid="fn:1">
<p>There may be 0xff as an invalid data in the credential saving area. The 0xff area would be reused. <aclass="footnote-backref"href="#fnref:1"rev="footnote"title="Jump back to footnote 1 in the text">↩</a></p>
</li>
<liid="fn:2">
<liid="fn:2">
<p><code>PageBuilder.h</code> exists in the <code>libraries/PageBuilder/src</code> directory under your sketch folder. <aclass="footnote-backref"href="#fnref:2"rev="footnote"title="Jump back to footnote 2 in the text">↩</a></p>
<p><code>PageBuilder.h</code> exists in the <code>libraries/PageBuilder/src</code> directory under your sketch folder. <aclass="footnote-backref"href="#fnref:2"rev="footnote"title="Jump back to footnote 1 in the text">↩</a></p>
</li>
</li>
<liid="fn:3">
<liid="fn:3">
<p>Without this information, the reproducibility of the problem is reduced, making diagnosis and analysis difficult. <aclass="footnote-backref"href="#fnref:3"rev="footnote"title="Jump back to footnote 3 in the text">↩</a></p>
<p>Without this information, the reproducibility of the problem is reduced, making diagnosis and analysis difficult. <aclass="footnote-backref"href="#fnref:3"rev="footnote"title="Jump back to footnote 2 in the text">↩</a></p>
@ -1011,14 +984,10 @@ Install third-party platform using the <em>Boards Manager</em> of Arduino IDE. P
Install third-party platform using the <em>Boards Manager</em> of Arduino IDE. You can add multiple URLs into <em>Additional Board Manager URLs</em> field, separating them with commas. Package URL is <ahref="https://dl.espressif.com/dl/package_esp32_index.json">https://dl.espressif.com/dl/package_esp32_index.json</a> for ESP32.</p>
Install third-party platform using the <em>Boards Manager</em> of Arduino IDE. You can add multiple URLs into <em>Additional Board Manager URLs</em> field, separating them with commas. Package URL is <ahref="https://dl.espressif.com/dl/package_esp32_index.json">https://dl.espressif.com/dl/package_esp32_index.json</a> for ESP32.</p>
<p>The <ahref="https://github.com/Hieromon/PageBuilder">PageBuilder</a> library to build HTML for ESP8266WebServer is needed.<br/>
<p>The <ahref="https://github.com/Hieromon/PageBuilder">PageBuilder</a> library to build HTML for ESP8266WebServer is needed.<br/>
To install the PageBuilder library into your Arduino IDE, you can use the <em>Library Manager</em>. Select the board of ESP8266 series in the Arduino IDE, open the library manager and search keyword '<strong>PageBuilder</strong>' with the topic '<strong>Communication</strong>', then you can see the <em>PageBuilder</em>. The latest version is required <strong>1.3.2</strong><strong>later</strong>.<supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup></p>
To install the PageBuilder library into your Arduino IDE, you can use the <em>Library Manager</em>. Select the board of ESP8266 series in the Arduino IDE, open the library manager and search keyword '<strong>PageBuilder</strong>' with the topic '<strong>Communication</strong>', then you can see the <em>PageBuilder</em>. The latest version is required <strong>1.3.3</strong><strong>later</strong>.<supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup></p>
<p>By adding the <ahref="https://github.com/bblanchon/ArduinoJson">ArduinoJson</a> library, AutoConnect will be able to handle the <ahref="acintro.html"><strong>custom Web pages</strong></a> described with JSON. With AutoConnect v0.9.7 you can insert user-owned web pages that can consist of representative HTML elements as styled TEXT, INPUT, BUTTON, CHECKBOX, SELECT, SUBMIT and invoke them from the AutoConnect menu. These HTML elements can be added by sketches using the AutoConnect API. Further it possible importing the custom Web pages declarations described with JSON which stored in PROGMEM, SPIFFS, or SD. <ahref="https://arduinojson.org/v5/doc/">ArduinoJson version 5</a> is required to use this feature.<supid="fnref:2"><aclass="footnote-ref"href="#fn:2"rel="footnote">2</a></sup></p>
<p>By adding the <ahref="https://github.com/bblanchon/ArduinoJson">ArduinoJson</a> library, AutoConnect will be able to handle the <ahref="acintro.html"><strong>custom Web pages</strong></a> described with JSON. Since AutoConnect v0.9.7 you can insert user-owned web pages that can consist of representative HTML elements as styled TEXT, INPUT, BUTTON, CHECKBOX, SELECT, SUBMIT and invoke them from the AutoConnect menu. These HTML elements can be added by sketches using the AutoConnect API. Further it possible importing the custom Web pages declarations described with JSON which stored in PROGMEM, SPIFFS, or SD. <ahref="https://arduinojson.org/">ArduinoJson</a> is required to use this feature.<supid="fnref:2"><aclass="footnote-ref"href="#fn:2"rel="footnote">2</a></sup> AutoConnect can work with ArduinoJson both <ahref="https://arduinojson.org/v5/doc/">version 5</a> and <ahref="https://arduinojson.org/v6/doc/">version 6</a>.</p>
<divclass="admonition info">
<pclass="admonition-title">AutoConnect supports ArduinoJson version 5 only</p>
<p>ArduinoJson version 6 is just released, Arduino Library Manager installs the ArduinoJson version 6 by default. Open the Arduino Library Manager and make sure that ArduinoJson version 5 is installed.</p>
</div>
<h3id="install-the-autoconnect">Install the AutoConnect<aclass="headerlink"href="#install-the-autoconnect"title="Permanent link">¶</a></h3>
<h3id="install-the-autoconnect">Install the AutoConnect<aclass="headerlink"href="#install-the-autoconnect"title="Permanent link">¶</a></h3>
<p>Clone or download from the <ahref="https://github.com/Hieromon/AutoConnect">AutoConnect GitHub repository</a>.</p>
<p>Clone or download from the <ahref="https://github.com/Hieromon/AutoConnect">AutoConnect GitHub repository</a>.</p>
<p><imgsrc="images/gitrepo.png"width="640"/></p>
<p><imgsrc="images/gitrepo.png"width="640"/></p>
@ -1038,7 +1007,7 @@ To install the PageBuilder library into your Arduino IDE, you can use the <em>Li
<hr/>
<hr/>
<ol>
<ol>
<liid="fn:1">
<liid="fn:1">
<p>Since AutoConnect v0.9.7, PageBuilder v1.3.2 later is required. <aclass="footnote-backref"href="#fnref:1"rev="footnote"title="Jump back to footnote 1 in the text">↩</a></p>
<p>Since AutoConnect v0.9.8, PageBuilder v1.3.3 later is required. <aclass="footnote-backref"href="#fnref:1"rev="footnote"title="Jump back to footnote 1 in the text">↩</a></p>
</li>
</li>
<liid="fn:2">
<liid="fn:2">
<p>Using the AutoConnect API natively allows you to sketch custom Web pages without JSON. <aclass="footnote-backref"href="#fnref:2"rev="footnote"title="Jump back to footnote 2 in the text">↩</a></p>
<p>Using the AutoConnect API natively allows you to sketch custom Web pages without JSON. <aclass="footnote-backref"href="#fnref:2"rev="footnote"title="Jump back to footnote 2 in the text">↩</a></p>
@ -1113,7 +1082,7 @@ To install the PageBuilder library into your Arduino IDE, you can use the <em>Li
<p>Several parameters as follows of <ahref="apiconfig.html">AutoConnectConfig</a> affect the behavior of <ahref="api.html#begin">AutoConnect::begin</a> function. Each parameter affects the behaves in interacted order with the priority and apply to the logic sequence of AutoConnect::begin.</p>
<p>Several parameters as follows of <ahref="apiconfig.html">AutoConnectConfig</a> affect the behavior of <ahref="api.html#begin">AutoConnect::begin</a> function. Each parameter affects the behaves in interacted order with the priority and apply to the logic sequence of <ahref="api.html#begin">AutoConnect::begin</a>.</p>
<ul>
<ul>
<li><ahref="apiconfig.html#immediatestart">immediateStart</a> : The captive portal start immediately, without first WiFi.begin.</li>
<li><ahref="apiconfig.html#immediatestart">immediateStart</a> : The captive portal start immediately, without first WiFi.begin.</li>
<li><ahref="apiconfig.html#autoreconnect">autoReconenct</a> : Attempt re-connect with past SSID by saved credential.</li>
<li><ahref="apiconfig.html#autoreconnect">autoReconenct</a> : Attempt re-connect with past SSID by saved credential.</li>
@ -767,9 +742,9 @@
</ul>
</ul>
<p>You can use these parameters in combination with sketch requirements and need to understand correctly the behavior caused by the parameters. The following chart shows the AutoConnect::begin logic sequence including the effect of these parameters.</p>
<p>You can use these parameters in combination with sketch requirements and need to understand correctly the behavior caused by the parameters. The following chart shows the AutoConnect::begin logic sequence including the effect of these parameters.</p>
<p>For example, AutoConnect::begin will not exits without the <strong>portalTimeout</strong> while the connection not establishes, but WebServer will start to work. A DNS server that detects the probe of the captive portal is also effective. So, your sketch may work seemingly, but it will close with inside a loop of the AutoConnect::begin function. Especially when invoking AutoConnect::begin in the <strong>setup()</strong>, execution control does not pass to the <strong>loop()</strong>.</p>
<p>For example, <ahref="api.html#begin">AutoConnect::begin</a> will not exits without the <ahref="apiconfig.html#portaltimeout"><strong>portalTimeout</strong></a> while the connection not establishes, but WebServer will start to work. A DNS server that detects the probe of the captive portal is also effective. So, your sketch may work seemingly, but it will close with inside a loop of the <ahref="api.html#begin">AutoConnect::begin</a> function. Especially when invoking <ahref="api.html#begin">AutoConnect::begin</a> in the <strong>setup()</strong>, execution control does not pass to the <strong>loop()</strong>.</p>
<p>As different scenes, you may use the <strong>immediateStart</strong> effectively. Equipped the external switch to activate the captive portal with the ESP module, combined with the <strong>portalTime</strong> and the <strong>retainPortal</strong> it will become WiFi active connection feature. You can start AutoConnect::begin at any point in the <strong>loop()</strong>, which allows your sketch can behave both the offline mode and the online mode.</p>
<p>As different scenes, you may use the <ahref="apiconfig.html#immediatestart"><strong>immediateStart</strong></a> effectively. Equipped the external switch to activate the captive portal with the ESP module, combined with the <ahref="apiconfig.html#portaltimeout"><strong>portalTime</strong></a> and the <ahref="apiconfig.html#retainportal"><strong>retainPortal</strong></a> it will become WiFi active connection feature. You can start <ahref="api.html#begin">AutoConnect::begin</a> at any point in the <strong>loop()</strong>, which allows your sketch can behave both the offline mode and the online mode.</p>
<p>The <strong>retainPortal</strong> option allows the DNS server to continue operation after exiting from AutoConnect::begin. AutoConnect traps captive portal detection from the client and redirects it to the AutoConnect menu. That trap will answer all unresolved addresses with SoftAP's IP address. If the URI handler for the source request is undefined, it returns a 302 response with <code>SoftAPIP/_ac</code> to the client. This is the mechanism of AutoConnect's captive portal. Captive portal probes will frequently occur while you are attempting on the client device's WiFi connection Apps and these implementations are varied each OS, so it not realistic to identify all probing URIs. Therefore, while retainPortal is enabled, it is not preferable to executing the sketch under the WiFi connection Apps on the client device. (Probably not work correctly) You need to exit from the WiFi connection Apps once.</p>
<p>The <ahref="apiconfig.html#retainportal"><strong>retainPortal</strong></a> option allows the DNS server to continue operation after exiting from <ahref="api.html#begin">AutoConnect::begin</a>. AutoConnect traps captive portal detection from the client and redirects it to the AutoConnect menu. That trap will answer all unresolved addresses with SoftAP's IP address. If the URI handler for the source request is undefined, it returns a 302 response with <code>SoftAPIP/_ac</code> to the client. This is the mechanism of AutoConnect's captive portal. Captive portal probes will frequently occur while you are attempting on the client device's WiFi connection Apps and these implementations are varied each OS, so it not realistic to identify all probing URIs. Therefore, while retainPortal is enabled, it is not preferable to executing the sketch under the WiFi connection Apps on the client device. (Probably not work correctly) You need to exit from the WiFi connection Apps once.</p>
<p>Please consider these kinds of influence when you make sketches.</p>
<p>Please consider these kinds of influence when you make sketches.</p>