- [AutoConnectText](#autoconnecttext): Style attributed text
Each element has a common attribute and its own attributes.
## Layout on custom Web page
You can specify the direction to arrange the radio buttons as [**AutoConnectRadio**](#autoconnectradio) vertically or horizontally. Other elements are arranged vertically in the order of addition to AutoConnectAux. This basic layout depends on the CSS of the AutoConnect menu so it can not be changed drastically.
Every element has a name. **Name** is the String data type. To access its element in the sketches you can identify by the name. Its method is useful for loading elements in JSON. In the load function of AutoConnectElement(s) described [**later**](acjson.md), these objects are not created in advance by sketches. Therefore, access to the attribute of that element by name as follows:
Each element has a name. **Name** is the String data type. To access its element in the sketches you can identify by the name. Its method is useful for loading elements in JSON. In the load function of AutoConnectElement(s) described [**later**](acjson.md), these objects are not created in advance by sketches. Therefore, access to the attribute of that element by the **name** as follows:
@ -149,11 +147,25 @@ A label is an optional string. If you specify a label, an `id` attribute is atta
### <iclass="fa fa-caret-right"></i> checked
A checked is a Boolean value and indicates the checked status of the checkbox.
A checked is a Boolean value and indicates the checked status of the checkbox. The value of the checkbox element checked is packed in the query string and sent.
## AutoConnectInput
AutoConnectInput genarates an HTML `input type="text"` tag and a `label` tag. It can also have a placeholder.
AutoConnectInput genarates an HTML `input type="text"` tag and a `label` 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.
It is the name of the AutoConnectInput element and matches the name attribute of the input tag. It also becomes the parameter name of the query string when submitted.
### <iclass="fa fa-caret-right"></i> value
## AutoConnectRadio
@ -167,23 +179,25 @@ AutoConnectInput genarates an HTML `input type="text"` tag and a `label` tag. It
### Definition in sketch
Each element can be defined by a macro. By using the macro, you can treat element names that are String types as variables in sketches.
Each element can be defined by a macro. By using the macro, you can treat element names that are String types as variables in sketches.[^2]
ACElement( *name* \[, *value* \] )
[^2]: The square brackets in the syntax are optional parameters. The stroke is a selection parameter.
AutoConnect can handle custom Web pages prepared by user sketches individually. Custom Web pages are displayed in the [AutoConnect menu](menu.md) and can be used from there. It can also have input-output parameters and handle it with sketches. For example, you can program some sketches that publish messages by entering the URI or unique ID of the MQTT broker on a custom page. You do not need to code the processing to handle the web page, it retrieves the input parameters and passes to the MQTT broker connection API is only.
## How it works
Custom Web pages are dynamically created by AutoConnect. The Classes and APIs necessary for dynamic creation are provided. **AutoConnectAux** is an object dependent on AutoConnect, which provides an easy way to incorporate custom Web pages like the one on the right figure into AutoConnect. The elements that make up a custom web page are provided as an [**AutoConnectElement**](acelements.md) class. Furthermore, an input box, a check box, a submit button, etc. are implemented by classes derived from AutoConnectElement.
AutoConnectAux is a container for AutoConnectElements. To make a custom Web page, create elements that make up the page and put it in the AutoConnectAux object. Joining that AutoConnectAux object to AutoConnect will integrate the custom Web page into the AutoConnect menu.
<imgsrc="../images/ac_declaration.svg">
@ -18,20 +16,21 @@ The above figure shows a code sequence that declares AutoConnectElements and put
## Custom Web pages in AutoConnect menu
<ulclass="horizontal-list">
<li><imgstyle="margin:0 20px auto;float:left;width:320px;height:360px;"src="../images/ac_auxmenu.png">
Custom Web pages as AutoConnectAux are integrated into the <ahref="menu.html">AutoConnect menu</a>. AutoConnectAux object owns title and URI as member variables. It also has an indicator to show on the AutoConnect menu. You give the title and URI of the custom web page to the AutoConnectAux object with Sketch. Then the title of the custom Web page is displayed at the bottom of the AutoConnect menu as the left figure.<supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup> It is a hyperlink as URI you given to the page and taps it will display the page composed of AutoConnectElements. The title is also shown to top left corner of the custom page, and a hyperlink to AutoConnect statistical screen is contained.</li>
<li><imgstyle="margin:0 20px 0 -20px;float:left;width:300px;height:343px;"src="../images/ac_auxmenu.png">
Custom Web pages as AutoConnectAux are integrated into the <ahref="menu.html">AutoConnect menu</a>. AutoConnectAux object contains member variables which are URI and the title. It also has an indicator to show on the AutoConnect menu. You give the title and URI of the custom web page to the AutoConnectAux object with Sketch. Then the title of the custom Web page would be displayed at the bottom of the AutoConnect menu as the left figure.<supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup> It is a hyperlink as URI you given to the custom Web page and taps it will display a page composed of AutoConnectElements. Also, a title will display in the upper left corner of the page, which includes a hyperlink to the AutoConnect statistics screen.</li>
</ul>
[^1]:There is no overlay in the actual menu.
## Multiple custom Web pages
You can create multiple custom pages, integrate them into the AutoConnect menu, and specify pages to invokes from the menu. The following code combines three AutoConnectAuxs to a AutoConnect object as '*portal*'.
You can create multiple custom Web pages and specify which pages you can invoke from the menu.<br>
In the sketch below, it shows the sequence of codes to integrate three custom Web pages into one and embed them into the menu.
<li><spanstyle="margin-left:20px;float:right;width:320px;height:550px;"><imgdata-gifffer="../images/aux_menu.gif"data-gifffer-width="320"data-gifffer-height="550"/></span><b>False</b> is specified as the third parameter of '<i>aux2</i>' in the above code. The third parameter of the AutoConnectAux constructor is an indicator of whether it's shown to the AutoConnect menu. Right animation is the execution result of the above code. You will see that the custom web page's menu is displayed only in the last two lines. Because '<i>aux1</i>' and '<i>aux2</i>' in this example have a pair of page transitions. The sketch of this animation is written to transition to '<i>aux2</i>' by the utility of the <ahref="acelements.html#autoconnectsubmit"><b>AutoConnectSubmit</b></a> element owned by '<i>aux1</i>'.<supid="fnref:2"><aclass="footnote-ref"href="#fn:2"rel="footnote">2</a></sup><br>An '<i>aux2</i>' page transitions only from the submit button of '<i>aux1</i>'. It is a page that saves the parameters you entered on the previous page as shown in mqttRSSI in the library example. It is to want to hide '<i>aux2</i>' from AutoConnect menu lines. The third parameter of the AutoConnectAux constructor is used for this purpose.</li>
<li><pstyle="margin:0 20px 0 -20px"><spanstyle="margin-left:20px;float:right;width:280px;height:497px;"><imgdata-gifffer="../images/aux_menu.gif"data-gifffer-width="280"data-gifffer-height="497"/></span>In the above code, the third parameter of '<i>aux2</i>' is <b>false</b>. The third parameter of the AutoConnectAux constructor is an indicator of whether it's shown to the AutoConnect menu. Right animation is the execution result of the above code. You will see that the custom Web page's menu is displayed only in the last two lines. The sketch of this animation is written to transition to '<i>aux2</i>' by the utility of the <ahref="acelements.html#autoconnectsubmit"><b>AutoConnectSubmit</b></a> element owned by '<i>aux1</i>'.<supid="fnref:2"><aclass="footnote-ref"href="#fn:2"rel="footnote">2</a></sup><br>An '<i>aux2</i>' page transitions only from the '<i>aux1</i>'. It is a page that saves the parameters you entered on the previous page as shown in mqttRSSI in the library example. It is to want to hide '<i>aux2</i>' from AutoConnect menu lines. The utility of the third parameter of the AutoConnectAux constructor is that.</p></li>
</ul>
[^2]:
@ -77,7 +76,7 @@ So, the basic procedure is as follows.
## Write the custom Web page with JSON
You can also write the custom Web page in JSON without using sketch codes.[^3] It is possible to describe the entire page in JSON and can be described for each element also. The JSON description can be saved in SPIFFS or SD and read using AutoConnect's [**load**](api.md#load) function. If you take this approach, you can further reduce the above basic steps. However, this method consumes a lot of memory.
You can write the custom Web page in JSON without using sketch codes.[^3] It is possible to describe the entire page in JSON and can be described for each element also. The JSON description can be saved in SPIFFS or SD and read using AutoConnect's [**load**](api.md#load) function. If you take this approach, you can further reduce the above basic steps. However, this method consumes a lot of memory.
The following JSON code and sketch will execute the custom Web page as the example in the above figure. That is, the sketch of this code and footnote[^2] is equivalent.