Under the work of v0.9.7 documentation

pull/41/head
Hieromon Ikasamo 6 years ago
parent 2433fa5d19
commit e909a8bab8
  1. 42
      mkdocs/acelements.md
  2. 17
      mkdocs/acintro.md
  3. 817
      mkdocs/images/ac_declaration.svg

@ -11,8 +11,6 @@ Representative HTML elements for making the custom Web page are provided as Auto
- [AutoConnectSubmit](#autoconnectsubmit): Submit button - [AutoConnectSubmit](#autoconnectsubmit): Submit button
- [AutoConnectText](#autoconnecttext): Style attributed text - [AutoConnectText](#autoconnecttext): Style attributed text
Each element has a common attribute and its own attributes.
## Layout on custom Web page ## 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. 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.
@ -35,7 +33,7 @@ AutoConnectElement(const char* name, const char* value)
### <i class="fa fa-caret-right"></i> name ### <i class="fa fa-caret-right"></i> name
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:
```cpp hl_lines="4 10" ```cpp hl_lines="4 10"
AutoConnectAux customPage("/custom_page", "Custom page"); AutoConnectAux customPage("/custom_page", "Custom page");
@ -149,11 +147,25 @@ A label is an optional string. If you specify a label, an `id` attribute is atta
### <i class="fa fa-caret-right"></i> checked ### <i class="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
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.
### <i class="fa fa-edit"></i> Constructor
```cpp
AutoConnectInput(const char* name, const char* value, const char* label, const char* placeholder)
```
### <i class="fa fa-caret-right"></i> name
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.
### <i class="fa fa-caret-right"></i> value
## AutoConnectRadio ## AutoConnectRadio
@ -167,23 +179,25 @@ AutoConnectInput genarates an HTML `input type="text"` tag and a `label` tag. It
### Definition in sketch ### 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.
ACButton( *name* \[, *value* \] \[, *action* \] ) ACElement ( *name* <small>\[</small> , *value* <small>\]</small> )
ACCheckbox( *name* \[, *value* \] \[, *label* \] \[, **true** | **false** \] ) ACButton ( *name* <small>\[</small> , *value* <small>\]</small> <small>\[</small> , *action* <small>\]</small> )
ACCheckbox ( *name* <small>\[</small> , *value* <small>\]</small> <small>\[</small> , *label* <small>\]</small> <small>\[</small> , **true** | **false** <small>\]</small> )
ACInput( *name* \[, *value* \] \[, *placeholder* \] \[, *label* \] ) ACInput ( *name* <small>\[</small> , *value* <small>\]</small> <small>\[</small> , *label* <small>\]</small> <small>\[</small> , *placeholder* <small>\]</small> )
ACRadio( *name* \[, *values* \] \[, *label* \] \[, **AC\_Horitontal** | **AC\_Vertical** \] \[, *checked* ] ) ACRadio ( *name* <small>\[</small> , *values* <small>\]</small> <small>\[</small> , *label* <small>\]</small> <small>\[</small> , **AC\_Horitontal** | **AC\_Vertical** <small>\]</small> <small>\[</small> , *checked* <small>\]</small> )
ACSelect( *name* \[, *options* \] \[, *label* \] ) ACSelect ( *name* <small>\[</small> , *options* <small>\]</small> <small>\[</small> , *label* <small>\]</small> )
ACSubmit( *name* \[, *value* \] \[, *uri* \] ) ACSubmit ( *name* <small>\[</small> , *value* <small>\]</small> <small>\[</small> , *uri* <small>\]</small> )
ACText( *name* \[, *value* \] \[, *style* \] ) ACText ( *name* <small>\[</small> , *value* <small>\]</small> <small>\[</small> , *style* <small>\]</small> )
### Variant for AutoConnectElements ### Variant for AutoConnectElements

@ -1,14 +1,12 @@
## What it is ## What it is
<span style="margin-left:20px;float:right;width:320px;height:550px;"><img data-gifffer="../images/aux_ov.gif" data-gifffer-width="320" data-gifffer-height="550" /></span> <span style="margin-left:20px;margin-bottom:10px;float:right;width:280px;height:497px;"><img data-gifffer="../images/aux_ov.gif" data-gifffer-width="280" data-gifffer-height="497" /></span>
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. 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 ## 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. 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.
<p align="center"><img align="center" width="560px" src="../images/ac_objects.svg"></p>
<img src="../images/ac_objects.svg">
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. 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.
<img src="../images/ac_declaration.svg"> <img src="../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 ## Custom Web pages in AutoConnect menu
<ul class="horizontal-list"> <ul class="horizontal-list">
<li><img style="margin:0 20px auto;float:left;width:320px;height:360px;" src="../images/ac_auxmenu.png"> <li><img style="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 <a href="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.<sup id="fnref:1"><a class="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> Custom Web pages as AutoConnectAux are integrated into the <a href="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.<sup id="fnref:1"><a class="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> </ul>
[^1]:There is no overlay in the actual menu. [^1]:There is no overlay in the actual menu.
## Multiple custom Web pages ## 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 &#39;*portal*&#39;. 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.
<img align="center" width="520px" src="../images/ac_auxjoin_multi.svg"> <img align="center" width="520px" src="../images/ac_auxjoin_multi.svg">
<ul class="horizontal-list"> <ul class="horizontal-list">
<li><span style="margin-left:20px;float:right;width:320px;height:550px;"><img data-gifffer="../images/aux_menu.gif" data-gifffer-width="320" data-gifffer-height="550" /></span><b>False</b> is specified as the third parameter of &#39;<i>aux2</i>&#39; 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&#39;s menu is displayed only in the last two lines. Because &#39;<i>aux1</i>&#39; and &#39;<i>aux2</i>&#39; in this example have a pair of page transitions. The sketch of this animation is written to transition to &#39;<i>aux2</i>&#39; by the utility of the <a href="acelements.html#autoconnectsubmit"><b>AutoConnectSubmit</b></a> element owned by &#39;<i>aux1</i>&#39;.<sup id="fnref:2"><a class="footnote-ref" href="#fn:2" rel="footnote">2</a></sup><br>An &#39;<i>aux2</i>&#39; page transitions only from the submit button of &#39;<i>aux1</i>&#39;. 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 &#39;<i>aux2</i>&#39; from AutoConnect menu lines. The third parameter of the AutoConnectAux constructor is used for this purpose.</li> <li><p style="margin:0 20px 0 -20px"><span style="margin-left:20px;float:right;width:280px;height:497px;"><img data-gifffer="../images/aux_menu.gif" data-gifffer-width="280" data-gifffer-height="497" /></span>In the above code, the third parameter of &#39;<i>aux2</i>&#39; 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&#39;s menu is displayed only in the last two lines. The sketch of this animation is written to transition to &#39;<i>aux2</i>&#39; by the utility of the <a href="acelements.html#autoconnectsubmit"><b>AutoConnectSubmit</b></a> element owned by &#39;<i>aux1</i>&#39;.<sup id="fnref:2"><a class="footnote-ref" href="#fn:2" rel="footnote">2</a></sup><br>An &#39;<i>aux2</i>&#39; page transitions only from the &#39;<i>aux1</i>&#39;. 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 &#39;<i>aux2</i>&#39; from AutoConnect menu lines. The utility of the third parameter of the AutoConnectAux constructor is that.</p></li>
</ul> </ul>
[^2]: [^2]:
@ -77,7 +76,7 @@ So, the basic procedure is as follows.
## Write the custom Web page with JSON ## 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. 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.
**custom_page.json** **custom_page.json**

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Loading…
Cancel
Save