diff --git a/docs/api/index.html b/docs/api/index.html index 2585bc2..f0d8a1c 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -1165,13 +1165,13 @@

begin

bool begin()
 
-
bool begin(const char* ssid, const char* passphraase)
+
bool begin(const char* ssid, const char* passphrase)
 
-
bool begin(const char* ssid, const char* passphraase, unsigned long timeout)
+
bool begin(const char* ssid, const char* passphrase, unsigned long timeout)
 

-

Starts establishing the WiFi connection.
-AutoConnect first invokes WiFi.begin. If the case of SSID and Password missing, its WiFi.begin has no SSID and Password. The WiFi mode at this time is WIFI_STA. Then ESP8266WebServer/WebServer will be started immediately after the first WiFi.begin regardless of the result.

-

The captive portal will not be started if the connection has been established with first WiFi.begin. If the connection cannot establish, switch to WIFI_AP_STA mode and activate SoftAP. Then DNS server starts. +

Starts establishing the WiFi connection. The WiFi mode at this time is WIFI_STA.
+AutoConnect first invokes WiFi.begin. If the ssid and the passphrase are missing, its WiFi.begin has no SSID and Password. Regardless of the result, ESP8266WebServer/WebServer will start immediately after the first WiFi.begin.
+The captive portal will not be started if the connection has been established with first WiFi.begin. If the connection cannot establish, switch to WIFI_AP_STA mode and activate SoftAP. Then DNS server starts.

Parameters
ssidSSID to be connected.
@@ -1209,7 +1209,7 @@ AutoConnect first invokes WiFi.begin. If the case of SSID and Password
void handleClient()
 
-

Process the AutoConnect menu interface. The handleClient() function of the ESP8266WebServer/WebServer hosted by AutoConnect is also called from within AutoConnect and client requests contained in the user sketch handler are also handled.

+

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.

handleRequest

void handleRequest()
 
diff --git a/docs/basicusage/index.html b/docs/basicusage/index.html index 01dc8d9..58ef7f5 100644 --- a/docs/basicusage/index.html +++ b/docs/basicusage/index.html @@ -683,16 +683,16 @@
  1. Include headers, ESP8266WebServer.h/WebServer.h and AutoConnect.h
  2. -
  3. Declare ESP8266WebServer variable.
  4. -
  5. Declare AutoConnect variable.
  6. -
  7. Implements the URL handler with the function().
  8. +
  9. Declare an ESP8266WebServer variable for ESP8266 or a WebServer variable for ESP32.
  10. +
  11. Declare an AutoConnect variable.
  12. +
  13. Implement the URL handlers provided for the on method of ESP8266WebServer/WebServer with the function().
  14. setup()
    - 5.1 Sets URL handler function() to ESP8266WebServer/WebServer byESP8266WebServer::on/WebServer::on.
    + 5.1 Sets URL handler the function() to ESP8266WebServer/WebServer byESP8266WebServer::on/WebServer::on.
    5.2 Starts AutoConnect::begin().
    5.3 Check WiFi connection status.
  15. loop()
    - 6.1 Invokes AutoConnect::handleClient(), or invokes ESP8266WebServer::handleClient()/WebServer::handleClient then AutoConnect::handleRequest().
    - 6.2 Do the process for actual sketch.
  16. + 6.1 Do the process for actual sketch.
    + 6.2 Invokes AutoConnect::handleClient(), or invokes ESP8266WebServer::handleClient()/WebServer::handleClient then AutoConnect::handleRequest().

2. Declare AutoConnect object

@@ -715,10 +715,10 @@ or

3. No need WiFI.begin(...)

AutoConnect internally performs WiFi.begin to establish a WiFi connection. There is no need for a general process to establish a connection using WiFi.begin with a sketch code.

4. Alternate ESP8266WebServer::begin() and WebServer::begin()

-

AutoConnect::begin executes ESP8266WebServer::begin/WebServer::begin internally too and it starts the DNS server to behave as a Captive portal. So it is not needed to call ESP8266WebServer::begin/WebServer::begin with the sketch.

+

AutoConnect::begin executes ESP8266WebServer::begin/WebServer::begin internally too and it starts the DNS server to behave as a Captive portal. So it is not needed to call ESP8266WebServer::begin/WebServer::begin in the sketch.

Why DNS Server starts

-

AutoConnect traps the detection of the captive portal and achieves a connection with the WLAN interactively by the AutoConnect menu. It responds SoftAP address to all DNS queries temporarily to trap. When the WLAN connection establishes, then stops DNS server.

+

AutoConnect traps the detection of the captive portal and achieves a connection with the WLAN interactively by the AutoConnect menu. It responds SoftAP address to all DNS queries temporarily to trap. Once a WiFi connection establishes, the DNS server contributed by AutoConnect stops.

5. AutoConnect::begin with SSID and Password

SSID and Password can also specify by AutoConnect::begin. ESP8266/ESP32 uses provided SSID and Password explicitly. If the connection false with specified SSID with Password then a captive portal is activated. SSID and Password are not present, ESP8266 SDK will attempt to connect using the still effectual SSID and password. Usually, it succeeds.

@@ -740,7 +740,7 @@ or

None AutoConnect menu not available.
To use AutoConnect menu, need AutoConnect::handleRequest().
also to use ESP8266WebServer/WebServer natively, need AutoConnect::host(). -AutoConnect menu available.
To use ESP8266WebServer natively, need AutoConnect::host(). +AutoConnect menu available.
To use ESP8266WebServer/WebServer natively, need AutoConnect::host(). Reference to ESP8266WebServer/WebServer diff --git a/docs/examples/index.html b/docs/examples/index.html index d7d359d..936b0b6 100644 --- a/docs/examples/index.html +++ b/docs/examples/index.html @@ -683,7 +683,7 @@

Declare only AutoConnect, performs handleClient.

Used with MQTT as a client application

-

The effect of AutoConnect is not only for ESP8266 as the Web server. It has advantages for something WiFi client as well. For example, AutoConnect is also effective for publishing MQTT messages from various measurement points. Even if the SSID is different for each measurement point, it is not necessary to modify the sketch.

+

The effect of AutoConnect is not only for ESP8266/ESP32 as the web server. It has advantages for something WiFi client as well. For example, AutoConnect is also effective for publishing MQTT messages from various measurement points. Even if the SSID is different for each measurement point, it is not necessary to modify the sketch.

This example tries to publish the WiFi signal strength of ESP8266 with MQTT. It uses the ThingSpeak for MQTT broker. ESP8266 publishes the RSSI value to the channel created on ThingSpeak as MQTT client. This example is well suited to demonstrate the usefulness of AutoConnect, as RSSI values are measured at each access point usually. Just adding a few lines of code makes it unnecessary to upload sketches with the different SSIDs rewrite for each access point.

Advance procedures

diff --git a/docs/gettingstarted/index.html b/docs/gettingstarted/index.html index 3b52b15..ee872dc 100644 --- a/docs/gettingstarted/index.html +++ b/docs/gettingstarted/index.html @@ -573,7 +573,7 @@
-

The above code can be applied to ESP8266. To apply to ESP32, replace ESP8266WebServer class with WebServer and include WiFi.h and WebServer.h appropriately.

+

The above code can be applied to ESP8266. To apply to ESP32, replace ESP8266WebServer class with WebServer and include WiFi.h and WebServer.h of arduino-esp32 appropriately.

Run at first

After about 30 seconds, if the ESP8266 cannot connect to nearby Wi-Fi spot, you pull out your smartphone and open Wi-Fi settings from the Settings Apps. You can see the esp8266ap 1 in the list of "CHOOSE A NETWORK...". Then tap the esp8266ap and enter password 12345678, a something screen pops up automatically as shown below.

@@ -600,7 +600,7 @@ Or, "RESET" can be selected. The ESP8266 resets and reboots. Af
  1. -

    When applied to ESP32, esp32ap 

    +

    When applied to ESP32, SSID will appear as esp32ap

diff --git a/docs/menu/index.html b/docs/menu/index.html index b9c2de0..57b6ebb 100644 --- a/docs/menu/index.html +++ b/docs/menu/index.html @@ -549,10 +549,10 @@

The AutoConnect menu is developed using the LuxBar which is licensed under the MIT License. See the License.

Where the from

-

The AutoConnect menu appears when you access the AutoConnect root path. It is assigned "/_ac" located on ESP8266/ESP32 local IP address by default. This location can be changed in the sketch. The following screen will appear at access to http://{localIP}/_ac as the root path. This is the statistics of the current WiFi connection. You can access the menu from the here, to invoke it tap at right on top. (e.g. http://192.168.244.1/_ac for SoftAP mode.)

+

The AutoConnect menu appears when you access the AutoConnect root path. It is assigned "/_ac" located on the local IP address of ESP8266/ESP32 module by default. This location can be changed in the sketch. The following screen will appear at access to http://{localIP}/_ac as the root path. This is the statistics of the current WiFi connection. You can access the menu from the here, to invoke it tap at right on top. (e.g. http://192.168.244.1/_ac for SoftAP mode.)

-

What's local IP?

+

What's the local IP?

A local IP means Local IP at connection established or SoftAP's IP.

Right on top

@@ -566,17 +566,17 @@

Configure new AP

-

Scan all available access point and display it. Strength and security of the detected AP are marked. The is indicated for the SSID that needs a security key. "Hidden:" means the number of hidden SSIDs discovered.
-Enter SSID and Passphrase and tap "apply" to starts a connection.

+

Scan all available access point in the vicinity and display it. Strength and security of the detected AP are marked. The is indicated for the SSID that needs a security key. "Hidden:" means the number of hidden SSIDs discovered.
+Enter SSID and Passphrase and tap "apply" to starts WiFi connection.

Open SSIDs

-

Once it was established connection, its SSID and Password will be stored to the EEPROM of ESP8266/ESP32 automatically. The Open SSIDs menu reads the saved SSID credentials from the EEPROM. The stored credential data are listed by the SSID as shown below. Its label is a clickable button. Tap the SSID button, starts connection it.

+

Once it was established WiFi connection, its SSID and password will be saved in EEPROM of ESP8266/ESP32 automatically. The Open SSIDs menu reads the saved SSID credentials from the EEPROM. The stored credential data are listed by the SSID as shown below. Its label is a clickable button. Tap the SSID button, starts WiFi connection it.

Disconnect

Disconnect ESP8266/ESP32 from the current connection. It can also reset the ESP8266/ESP32 automatically after disconnection by instructing with using API in the sketch.

After tapping "Disconnect", you will not be able to reach the AutoConnect menu. Once disconnected, you will need to set the SSID again for connecting the WLAN.

Reset...

-

Reset the ESP8266/ESP32, it will start rebooting. After rebooting complete, the ESP8266/ESP32 module begins establishing the previous connection with WIFI_STA mode, and esp8266ap or esp32ap of an access point will disappear from WLAN.

+

Reset the ESP8266/ESP32 module, it will start rebooting. After rebooting complete, the ESP8266/ESP32 module begins establishing the previous connection with WIFI_STA mode, and esp8266ap or esp32ap of an access point will disappear from WLAN.

Not every ESP8266 module will be rebooted normally

diff --git a/docs/search/search_index.json b/docs/search/search_index.json index a3ee598..4d8691f 100644 --- a/docs/search/search_index.json +++ b/docs/search/search_index.json @@ -67,12 +67,12 @@ }, { "location": "/gettingstarted/index.html", - "text": "Let's do the most simple sketch\n\u00b6\n\n\nOpen the Arduino IDE, write the following sketch and upload it. The feature of this sketch is that the SSID and Password are not coded.\n\n\n#include\n \n // Replace with WiFi.h for ESP32\n\n\n#include\n \n // Replace with WebServer.h for ESP32\n\n\n#include\n \n\n\n\n\nESP8266WebServer\n \nServer\n;\n \n// Replace with WebServer for ESP32\n\n\nAutoConnect\n \nPortal\n(\nServer\n);\n\n\n\nvoid\n \nrootPage\n()\n \n{\n\n \nchar\n \ncontent\n[]\n \n=\n \n\"Hello, world\"\n;\n\n \nServer\n.\nsend\n(\n200\n,\n \n\"text/plain\"\n,\n \ncontent\n);\n\n\n}\n\n\n\nvoid\n \nsetup\n()\n \n{\n\n \ndelay\n(\n1000\n);\n\n \nSerial\n.\nbegin\n(\n115200\n);\n\n \nSerial\n.\nprintln\n();\n\n\n \nServer\n.\non\n(\n\"/\"\n,\n \nrootPage\n);\n\n \nif\n \n(\nPortal\n.\nbegin\n())\n \n{\n\n \nSerial\n.\nprintln\n(\n\"WiFi connected: \"\n \n+\n \nWiFi\n.\nlocalIP\n().\ntoString\n());\n\n \n}\n\n\n}\n\n\n\nvoid\n \nloop\n()\n \n{\n\n \nPortal\n.\nhandleClient\n();\n\n\n}\n\n\n\n\n\n\n\nThe above code can be applied to ESP8266. To apply to ESP32, replace \nESP8266WebServer\n class with \nWebServer\n and include \nWiFi.h\n and \nWebServer.h\n appropriately.\n\n\n\n\n Run at first\n\u00b6\n\n\nAfter about 30 seconds, if the ESP8266 cannot connect to nearby Wi-Fi spot, you pull out your smartphone and open \nWi-Fi settings\n from the \nSettings\n Apps. You can see the \nesp8266ap\n \n1\n in the list of \n\"CHOOSE A NETWORK...\"\n. Then tap the esp8266ap and enter password \n12345678\n, a something screen pops up automatically as shown below.\n\n\n\n\nThis is the AutoConnect statistics screen. This screen displays the current status of the established connection, WiFi mode, IP address, free memory size, and etc. Also, the \nhamburger icon\n is the control menu of AutoConnect seems at the upper right. By tap the hamburger icon, the control menu appears as the below.\n\n\n Join to the new access point\n\u00b6\n\n\nHere, tap \n\"Configure new AP\"\n to connect the new access point then the SSID configuration screen would be shown. Enter the \nSSID\n and \nPassphrase\n and tap \napply\n to start connecting the access point.\n\n\n\n\n Connection establishment\n\u00b6\n\n\nAfter connection established, the current status screen will appear. It is already connected to WLAN with WiFi mode as WIFI_AP_STA and the IP connection status is displayed there including the SSID. Then at this screen, you have two options for the next step.\n\n\nFor one, continues execution of the sketch while keeping this connection. You can access ESP8266 via browser through the established IP address after cancel to \"\nLog in\n\" by upper right on the screen.\n\nOr, \"\nRESET\n\" can be selected. The ESP8266 resets and reboots. After that, immediately before the connection will be restored automatically with WIFI_STA mode.\n\n\n\n\n Run for usually\n\u00b6\n\n\nThe IP address of ESP8266 would be displayed on the serial monitor after connection restored. Please access its address from the browser. The \"Hello, world\" page will respond. It's the page that was handled by in the sketch with \"\non\n\" function of \nESP8266WebServer\n.\n\n\n\n\n\n window.onload = function() {\n Gifffer();\n }\n\n\n\n\n\n\n\n\n\n\n\n\nWhen applied to ESP32, \nesp32ap\n\u00a0\n\u21a9", + "text": "Let's do the most simple sketch\n\u00b6\n\n\nOpen the Arduino IDE, write the following sketch and upload it. The feature of this sketch is that the SSID and Password are not coded.\n\n\n#include\n \n // Replace with WiFi.h for ESP32\n\n\n#include\n \n // Replace with WebServer.h for ESP32\n\n\n#include\n \n\n\n\n\nESP8266WebServer\n \nServer\n;\n \n// Replace with WebServer for ESP32\n\n\nAutoConnect\n \nPortal\n(\nServer\n);\n\n\n\nvoid\n \nrootPage\n()\n \n{\n\n \nchar\n \ncontent\n[]\n \n=\n \n\"Hello, world\"\n;\n\n \nServer\n.\nsend\n(\n200\n,\n \n\"text/plain\"\n,\n \ncontent\n);\n\n\n}\n\n\n\nvoid\n \nsetup\n()\n \n{\n\n \ndelay\n(\n1000\n);\n\n \nSerial\n.\nbegin\n(\n115200\n);\n\n \nSerial\n.\nprintln\n();\n\n\n \nServer\n.\non\n(\n\"/\"\n,\n \nrootPage\n);\n\n \nif\n \n(\nPortal\n.\nbegin\n())\n \n{\n\n \nSerial\n.\nprintln\n(\n\"WiFi connected: \"\n \n+\n \nWiFi\n.\nlocalIP\n().\ntoString\n());\n\n \n}\n\n\n}\n\n\n\nvoid\n \nloop\n()\n \n{\n\n \nPortal\n.\nhandleClient\n();\n\n\n}\n\n\n\n\n\n\n\nThe above code can be applied to ESP8266. To apply to ESP32, replace \nESP8266WebServer\n class with \nWebServer\n and include \nWiFi.h\n and \nWebServer.h\n of arduino-esp32 appropriately.\n\n\n\n\n Run at first\n\u00b6\n\n\nAfter about 30 seconds, if the ESP8266 cannot connect to nearby Wi-Fi spot, you pull out your smartphone and open \nWi-Fi settings\n from the \nSettings\n Apps. You can see the \nesp8266ap\n \n1\n in the list of \n\"CHOOSE A NETWORK...\"\n. Then tap the esp8266ap and enter password \n12345678\n, a something screen pops up automatically as shown below.\n\n\n\n\nThis is the AutoConnect statistics screen. This screen displays the current status of the established connection, WiFi mode, IP address, free memory size, and etc. Also, the \nhamburger icon\n is the control menu of AutoConnect seems at the upper right. By tap the hamburger icon, the control menu appears as the below.\n\n\n Join to the new access point\n\u00b6\n\n\nHere, tap \n\"Configure new AP\"\n to connect the new access point then the SSID configuration screen would be shown. Enter the \nSSID\n and \nPassphrase\n and tap \napply\n to start connecting the access point.\n\n\n\n\n Connection establishment\n\u00b6\n\n\nAfter connection established, the current status screen will appear. It is already connected to WLAN with WiFi mode as WIFI_AP_STA and the IP connection status is displayed there including the SSID. Then at this screen, you have two options for the next step.\n\n\nFor one, continues execution of the sketch while keeping this connection. You can access ESP8266 via browser through the established IP address after cancel to \"\nLog in\n\" by upper right on the screen.\n\nOr, \"\nRESET\n\" can be selected. The ESP8266 resets and reboots. After that, immediately before the connection will be restored automatically with WIFI_STA mode.\n\n\n\n\n Run for usually\n\u00b6\n\n\nThe IP address of ESP8266 would be displayed on the serial monitor after connection restored. Please access its address from the browser. The \"Hello, world\" page will respond. It's the page that was handled by in the sketch with \"\non\n\" function of \nESP8266WebServer\n.\n\n\n\n\n\n window.onload = function() {\n Gifffer();\n }\n\n\n\n\n\n\n\n\n\n\n\n\nWhen applied to ESP32, SSID will appear as \nesp32ap\n.\u00a0\n\u21a9", "title": "Getting started" }, { "location": "/gettingstarted/index.html#lets-do-the-most-simple-sketch", - "text": "Open the Arduino IDE, write the following sketch and upload it. The feature of this sketch is that the SSID and Password are not coded. #include // Replace with WiFi.h for ESP32 #include // Replace with WebServer.h for ESP32 #include ESP8266WebServer Server ; // Replace with WebServer for ESP32 AutoConnect Portal ( Server ); void rootPage () { \n char content [] = \"Hello, world\" ; \n Server . send ( 200 , \"text/plain\" , content ); } void setup () { \n delay ( 1000 ); \n Serial . begin ( 115200 ); \n Serial . println (); \n\n Server . on ( \"/\" , rootPage ); \n if ( Portal . begin ()) { \n Serial . println ( \"WiFi connected: \" + WiFi . localIP (). toString ()); \n } } void loop () { \n Portal . handleClient (); } The above code can be applied to ESP8266. To apply to ESP32, replace ESP8266WebServer class with WebServer and include WiFi.h and WebServer.h appropriately.", + "text": "Open the Arduino IDE, write the following sketch and upload it. The feature of this sketch is that the SSID and Password are not coded. #include // Replace with WiFi.h for ESP32 #include // Replace with WebServer.h for ESP32 #include ESP8266WebServer Server ; // Replace with WebServer for ESP32 AutoConnect Portal ( Server ); void rootPage () { \n char content [] = \"Hello, world\" ; \n Server . send ( 200 , \"text/plain\" , content ); } void setup () { \n delay ( 1000 ); \n Serial . begin ( 115200 ); \n Serial . println (); \n\n Server . on ( \"/\" , rootPage ); \n if ( Portal . begin ()) { \n Serial . println ( \"WiFi connected: \" + WiFi . localIP (). toString ()); \n } } void loop () { \n Portal . handleClient (); } The above code can be applied to ESP8266. To apply to ESP32, replace ESP8266WebServer class with WebServer and include WiFi.h and WebServer.h of arduino-esp32 appropriately.", "title": "Let's do the most simple sketch" }, { @@ -92,17 +92,17 @@ }, { "location": "/gettingstarted/index.html#run-for-usually", - "text": "The IP address of ESP8266 would be displayed on the serial monitor after connection restored. Please access its address from the browser. The \"Hello, world\" page will respond. It's the page that was handled by in the sketch with \" on \" function of ESP8266WebServer . \n window.onload = function() {\n Gifffer();\n } When applied to ESP32, esp32ap \u00a0 \u21a9", + "text": "The IP address of ESP8266 would be displayed on the serial monitor after connection restored. Please access its address from the browser. The \"Hello, world\" page will respond. It's the page that was handled by in the sketch with \" on \" function of ESP8266WebServer . \n window.onload = function() {\n Gifffer();\n } When applied to ESP32, SSID will appear as esp32ap .\u00a0 \u21a9", "title": " Run for usually" }, { "location": "/menu/index.html", - "text": "Luxbar\n\n\nThe AutoConnect menu is developed using the \nLuxBar\n which is licensed under the MIT License. See the \nLicense\n.\n\n\n\n\n Where the from\n\u00b6\n\n\nThe AutoConnect menu appears when you access the \nAutoConnect root path\n. It is assigned \"\n/_ac\n\" located on ESP8266/ESP32 \nlocal IP address\n by default. This location can be changed in the sketch. The following screen will appear at access to \nhttp://{localIP}/_ac\n as the root path. This is the statistics of the current WiFi connection. You can access the menu from the here, to invoke it tap \n at right on top. (e.g. \nhttp://192.168.244.1/_ac\n for SoftAP mode.)\n\n\n\n\n\n\nWhat's local IP?\n\n\nA local IP means Local IP at connection established or SoftAP's IP.\n\n\n\n\n Right on top\n\u00b6\n\n\nCurrently, AutoConnect supports four menus. Undermost menu as \"HOME\" returns to the home path of its sketch.\n\n\n\n\nConfigure new AP\n: Configure SSID and Password for new access point.\n\n\nOpen SSIDs\n: Opens the past SSID which has been established connection from EEPROM.\n\n\nDisconnect\n: Disconnects current connection.\n\n\nReset...\n: Rest the ESP8266/ESP32 module.\n\n\nHOME\n: Return to user home page.\n\n\n\n\n\n\n Configure new AP\n\u00b6\n\n\nScan all available access point and display it. Strength and security of the detected AP are marked. The \n is indicated for the SSID that needs a security key. \"\nHidden:\n\" means the number of hidden SSIDs discovered.\n\nEnter SSID and Passphrase and tap \"\napply\n\" to starts a connection. \n\n\n\n\n Open SSIDs\n\u00b6\n\n\nOnce it was established connection, its SSID and Password will be stored to the EEPROM of ESP8266/ESP32 automatically. The \nOpen SSIDs\n menu reads the saved SSID credentials from the EEPROM. The stored credential data are listed by the SSID as shown below. Its label is a clickable button. Tap the SSID button, starts connection it.\n\n\n\n\n Disconnect\n\u00b6\n\n\nDisconnect ESP8266/ESP32 from the current connection. It can also reset the ESP8266/ESP32 automatically after disconnection by instructing with using \nAPI\n in the sketch.\n\n\nAfter tapping \"Disconnect\", you will not be able to reach the AutoConnect menu. Once disconnected, you will need to set the SSID again for connecting the WLAN. \n\n\n Reset...\n\u00b6\n\n\nReset the ESP8266/ESP32, it will start rebooting. After rebooting complete, the ESP8266/ESP32 module begins establishing the previous connection with WIFI_STA mode, and \nesp8266ap\n or \nesp32ap\n of an access point will disappear from WLAN.\n\n\n\n\n\n\nNot every ESP8266 module will be rebooted normally\n\n\nThe Reset menu is using the \nESP.reset()\n function for ESP8266. This is an almost hardware reset. In order to resume the sketch normally, the \nstate of GPIO0\n is important. Since this depends on the circuit implementation for each module, not every module will be rebooted normally. See also \nFAQ\n.", + "text": "Luxbar\n\n\nThe AutoConnect menu is developed using the \nLuxBar\n which is licensed under the MIT License. See the \nLicense\n.\n\n\n\n\n Where the from\n\u00b6\n\n\nThe AutoConnect menu appears when you access the \nAutoConnect root path\n. It is assigned \"\n/_ac\n\" located on the \nlocal IP address\n of ESP8266/ESP32 module by default. This location can be changed in the sketch. The following screen will appear at access to \nhttp://{localIP}/_ac\n as the root path. This is the statistics of the current WiFi connection. You can access the menu from the here, to invoke it tap \n at right on top. (e.g. \nhttp://192.168.244.1/_ac\n for SoftAP mode.)\n\n\n\n\n\n\nWhat's the local IP?\n\n\nA local IP means Local IP at connection established or SoftAP's IP.\n\n\n\n\n Right on top\n\u00b6\n\n\nCurrently, AutoConnect supports four menus. Undermost menu as \"HOME\" returns to the home path of its sketch.\n\n\n\n\nConfigure new AP\n: Configure SSID and Password for new access point.\n\n\nOpen SSIDs\n: Opens the past SSID which has been established connection from EEPROM.\n\n\nDisconnect\n: Disconnects current connection.\n\n\nReset...\n: Rest the ESP8266/ESP32 module.\n\n\nHOME\n: Return to user home page.\n\n\n\n\n\n\n Configure new AP\n\u00b6\n\n\nScan all available access point in the vicinity and display it. Strength and security of the detected AP are marked. The \n is indicated for the SSID that needs a security key. \"\nHidden:\n\" means the number of hidden SSIDs discovered.\n\nEnter SSID and Passphrase and tap \"\napply\n\" to starts WiFi connection. \n\n\n\n\n Open SSIDs\n\u00b6\n\n\nOnce it was established WiFi connection, its SSID and password will be saved in EEPROM of ESP8266/ESP32 automatically. The \nOpen SSIDs\n menu reads the saved SSID credentials from the EEPROM. The stored credential data are listed by the SSID as shown below. Its label is a clickable button. Tap the SSID button, starts WiFi connection it.\n\n\n\n\n Disconnect\n\u00b6\n\n\nDisconnect ESP8266/ESP32 from the current connection. It can also reset the ESP8266/ESP32 automatically after disconnection by instructing with using \nAPI\n in the sketch.\n\n\nAfter tapping \"Disconnect\", you will not be able to reach the AutoConnect menu. Once disconnected, you will need to set the SSID again for connecting the WLAN. \n\n\n Reset...\n\u00b6\n\n\nReset the ESP8266/ESP32 module, it will start rebooting. After rebooting complete, the ESP8266/ESP32 module begins establishing the previous connection with WIFI_STA mode, and \nesp8266ap\n or \nesp32ap\n of an access point will disappear from WLAN.\n\n\n\n\n\n\nNot every ESP8266 module will be rebooted normally\n\n\nThe Reset menu is using the \nESP.reset()\n function for ESP8266. This is an almost hardware reset. In order to resume the sketch normally, the \nstate of GPIO0\n is important. Since this depends on the circuit implementation for each module, not every module will be rebooted normally. See also \nFAQ\n.", "title": "AutoConnect menu" }, { "location": "/menu/index.html#where-the-from", - "text": "The AutoConnect menu appears when you access the AutoConnect root path . It is assigned \" /_ac \" located on ESP8266/ESP32 local IP address by default. This location can be changed in the sketch. The following screen will appear at access to http://{localIP}/_ac as the root path. This is the statistics of the current WiFi connection. You can access the menu from the here, to invoke it tap at right on top. (e.g. http://192.168.244.1/_ac for SoftAP mode.) What's local IP? A local IP means Local IP at connection established or SoftAP's IP.", + "text": "The AutoConnect menu appears when you access the AutoConnect root path . It is assigned \" /_ac \" located on the local IP address of ESP8266/ESP32 module by default. This location can be changed in the sketch. The following screen will appear at access to http://{localIP}/_ac as the root path. This is the statistics of the current WiFi connection. You can access the menu from the here, to invoke it tap at right on top. (e.g. http://192.168.244.1/_ac for SoftAP mode.) What's the local IP? A local IP means Local IP at connection established or SoftAP's IP.", "title": " Where the from" }, { @@ -112,12 +112,12 @@ }, { "location": "/menu/index.html#configure-new-ap", - "text": "Scan all available access point and display it. Strength and security of the detected AP are marked. The is indicated for the SSID that needs a security key. \" Hidden: \" means the number of hidden SSIDs discovered. \nEnter SSID and Passphrase and tap \" apply \" to starts a connection.", + "text": "Scan all available access point in the vicinity and display it. Strength and security of the detected AP are marked. The is indicated for the SSID that needs a security key. \" Hidden: \" means the number of hidden SSIDs discovered. \nEnter SSID and Passphrase and tap \" apply \" to starts WiFi connection.", "title": " Configure new AP" }, { "location": "/menu/index.html#open-ssids", - "text": "Once it was established connection, its SSID and Password will be stored to the EEPROM of ESP8266/ESP32 automatically. The Open SSIDs menu reads the saved SSID credentials from the EEPROM. The stored credential data are listed by the SSID as shown below. Its label is a clickable button. Tap the SSID button, starts connection it.", + "text": "Once it was established WiFi connection, its SSID and password will be saved in EEPROM of ESP8266/ESP32 automatically. The Open SSIDs menu reads the saved SSID credentials from the EEPROM. The stored credential data are listed by the SSID as shown below. Its label is a clickable button. Tap the SSID button, starts WiFi connection it.", "title": " Open SSIDs" }, { @@ -127,12 +127,12 @@ }, { "location": "/menu/index.html#reset", - "text": "Reset the ESP8266/ESP32, it will start rebooting. After rebooting complete, the ESP8266/ESP32 module begins establishing the previous connection with WIFI_STA mode, and esp8266ap or esp32ap of an access point will disappear from WLAN. Not every ESP8266 module will be rebooted normally The Reset menu is using the ESP.reset() function for ESP8266. This is an almost hardware reset. In order to resume the sketch normally, the state of GPIO0 is important. Since this depends on the circuit implementation for each module, not every module will be rebooted normally. See also FAQ .", + "text": "Reset the ESP8266/ESP32 module, it will start rebooting. After rebooting complete, the ESP8266/ESP32 module begins establishing the previous connection with WIFI_STA mode, and esp8266ap or esp32ap of an access point will disappear from WLAN. Not every ESP8266 module will be rebooted normally The Reset menu is using the ESP.reset() function for ESP8266. This is an almost hardware reset. In order to resume the sketch normally, the state of GPIO0 is important. Since this depends on the circuit implementation for each module, not every module will be rebooted normally. See also FAQ .", "title": " Reset..." }, { "location": "/basicusage/index.html", - "text": "Simple usage\n\u00b6\n\n\n Embed to the sketches\n\u00b6\n\n\nHow embed the AutoConnect to the sketches you have. Most simple approach to applying AutoConnect for the existing sketches, follow the below steps. The below sketch is for ESP8266. For ESP32, replace \nESP8266WebServer\n with \nWebServer\n and \nESP8266WiFi.h\n with \nWiFi.h\n respectively.\n\n\n\n\n\n \nInsert \n#include\n \n\n to behind of \n#include\n \n\n.\n\n \nInsert \nAutoConnect\n \nPORTAL(WEBSERVER);\n to behind of \nESP8266WebServer\n \nWEBSERVER;\n declaration.\n1\n\n \nRemove \nWiFi.\nbegin\n(\nSSID\n,\nPSK\n)\n and the subsequent logic for the connection status check.\n\n \nReplace \nWEBSERVER\n.\nbegin\n()\n to \nPORTAL\n.\nbegin\n()\n.\n2\n\n \nReplace \nWEBSERVER\n.\nhandleClient\n()\n to \nPORTAL\n.\nhandleClient\n()\n.\n3\n\n \nIf the connection checks logic is needed, you can check the return value according to \nPORTAL\n.\nbegin\n()\n with \ntrue\n or \nfalse\n.\n\n\n\n\n\nBasic usage\n\u00b6\n\n\n Basic logic sequence for the user sketches\n\u00b6\n\n\n1. A typical logic sequence\n\u00b6\n\n\n\n\n\n\nInclude headers,\n \nESP8266WebServer.h\n/\nWebServer.h\n and \nAutoConnect.h\n \n\n\nDeclare ESP8266WebServer variable.\n \n\n\nDeclare AutoConnect variable.\n \n\n\nImplements the URL handler with the \nfunction()\n.\n \n\n\nsetup()\n\n 5.1 \nSets URL handler \nfunction()\n to ESP8266WebServer/WebServer by\nESP8266WebServer::on\n/\nWebServer::on\n.\n\n 5.2 \nStarts \nAutoConnect::begin()\n.\n\n 5.3 \nCheck WiFi connection status.\n \n\n\nloop()\n\n 6.1 \nInvokes \nAutoConnect::handleClient()\n, or invokes \nESP8266WebServer::handleClient()\n/\nWebServer::handleClient\n then \nAutoConnect::handleRequest()\n.\n\n 6.2 \nDo the process for actual sketch.\n \n\n\n\n\n\n\n2. Declare AutoConnect object\n\u00b6\n\n\nTwo options\n are available for \nAutoConnect constructor\n.\n\n\nAutoConnect\n \nVARIABLE\n(\n&\nESP8266WebServer\n);\n \n// For ESP8266\n\n\nAutoConnect\n \nVARIABLE\n(\n&\nWebServer\n);\n \n// For ESP32\n\n\n\nor\n\n\nAutoConnect\n \nVARIABLE\n;\n\n\n\n\n\n\n\n\n\nThe parameter with an ESP8266WebServer/WebServer variable:\n An ESP8266WebServer/WebServer object variable must be declared. AutoConnect uses its variable to handles the \nAutoConnect menu\n.\n\n\n\n\n\n\nWith no parameter:\n The sketch does not declare ESP8266WebServer/WebServer object. In this case, AutoConnect allocates an instance of the ESP8266WebServer/WebServer internally. The logic sequence of the sketch is somewhat different as the above. To register a URL handler function by \nESP8266WebServer::on\n or \nWebServer::on\n should be performed after \nAutoConnect::begin\n.\n\n\n\n\n\n\n3. No need WiFI.begin(...)\n\u00b6\n\n\nAutoConnect internally performs \nWiFi.begin\n to establish a WiFi connection. There is no need for a general process to establish a connection using \nWiFi.begin\n with a sketch code.\n\n\n4. Alternate ESP8266WebServer::begin() and WebServer::begin()\n\u00b6\n\n\nAutoConnect::begin\n executes \nESP8266WebServer::begin\n/\nWebServer::begin\n internally too and it starts the DNS server to behave as a Captive portal. So it is not needed to call \nESP8266WebServer::begin\n/\nWebServer::begin\n with the sketch.\n\n\n\n\nWhy DNS Server starts\n\n\nAutoConnect traps the detection of the captive portal and achieves a connection with the WLAN interactively by the AutoConnect menu. It responds SoftAP address to all DNS queries temporarily to trap. When the WLAN connection establishes, then stops DNS server.\n\n\n\n\n5. AutoConnect::begin with SSID and Password\n\u00b6\n\n\nSSID and Password can also specify by \nAutoConnect::begin\n. ESP8266/ESP32 uses provided SSID and Password explicitly. If the connection false with specified SSID with Password then a captive portal is activated. SSID and Password are not present, ESP8266 SDK will attempt to connect using the still effectual SSID and password. Usually, it succeeds.\n\n\n6. Use ESP8266WebServer::on and WebServer::on to handle URL\n\u00b6\n\n\nAutoConnect is designed to coexist with the process for handling the web pages by user sketches. The page processing function which will send an HTML to the client invoked by the \"\non::ESP8266WebServer\n\" or the \"\non::WebServer\n\" function is the same as when using ESP8266WebServer/WebServer natively.\n\n\n7. Use either ESP8266WebServer::handleClient()/WebServer::handleClient() or AutoConnect::handleClient()\n\u00b6\n\n\nBoth classes member function name is the same: \nhandleClient\n, but the behavior is different. Using the AutoConnect embedded along with ESP8266WebServer::handleClient/WebServer::handleClient has limitations. Refer to the below section for details. \n\n\n ESP8266WebServer/WebServer hosted or parasitic\n\u00b6\n\n\nThe interoperable process with an ESP8266WebServer/WebServer depends on the parameters of the \nAutoConnect constructor\n.\n\n\n\n\n\n\n\n\nDeclaration parameter for the constructor\n\n\nUse ESP8266WebServer::handleClient or WebServer::handleClient only\n\n\nUse AutoConnect::handleClient\n\n\n\n\n\n\n\n\n\n\nNone\n\n\nAutoConnect menu not available.\nTo use AutoConnect menu, need \nAutoConnect::handleRequest()\n.\nalso to use ESP8266WebServer/WebServer natively, need \nAutoConnect::host()\n.\n\n\nAutoConnect menu available.\nTo use ESP8266WebServer natively, need \nAutoConnect::host()\n.\n\n\n\n\n\n\nReference to ESP8266WebServer/WebServer\n\n\nAutoConnect menu not available.\nTo use AutoConnect menu, need \nAutoConnect::handleRequest()\n.\n\n\nAutoConnect menu available.\n\n\n\n\n\n\n\n\n\n\n\n\nBy declaration for the AutoConnect variable with no parameter\n: The ESP8266WebServer/WebServer instance is hosted by AutoConnect automatically then the sketches use \nAutoConnect::host\n as API to get it after \nAutoConnect::begin\n performed.\n\n\n\n\n\n\nBy declaration for the AutoConnect variable with the reference of ESP8266WebServer/WebServer\n: AutoConnect will use it. The sketch can use it is too.\n\n\n\n\n\n\nIn use ESP8266WebServer::handleClient()/WebServer::handleClient()\n: AutoConnect menu can be dispatched but not works normally. It is necessary to call \nAutoConnect::handleRequest\n after \nESP8255WebServer::handleClient\n/\nWebServer::handleClient\n invoking.\n\n\n\n\n\n\nIn use \nAutoConnect::handleClient()\n: The handleClient() process and the AutoConnect menu is available without calling \nESP8266WebServer::handleClient\n.\n\n\n\n\n\n\n\n\nWhy AutoConnect::handleRequest is needed when using ESP8266WebServer::handleClient/WebServer::handleClient\n\n\nThe AutoConnect menu function may affect WiFi connection state. It follows that the menu process must execute outside \nESP8266WebServer::handleClient\n and \nWebServer::handleClient\n.\n\n\nAutoConnect::handleClient\n is equivalent \nESP8266WebServer::handleClient\n and \nWEbServer::handleClient\n included \nAutoConnect::handleRequest\n.\n\n\n\n\n\n\n\n\n\n\n\n\nEach \nVARIABLE\n conforms to the actual declaration in the sketches.\u00a0\n\u21a9\n\n\n\n\n\n\nWiFi SSID and Password can be specified AutoConnect::begin() too.\u00a0\n\u21a9\n\n\n\n\n\n\nReplacement the \nhandleClient\n method is not indispensable. AutoConnect can still connect with the captive portal as it is ESP8266WebServer::handleClient. But it can \nnot valid AutoConnect menu\n.\u00a0\n\u21a9", + "text": "Simple usage\n\u00b6\n\n\n Embed to the sketches\n\u00b6\n\n\nHow embed the AutoConnect to the sketches you have. Most simple approach to applying AutoConnect for the existing sketches, follow the below steps. The below sketch is for ESP8266. For ESP32, replace \nESP8266WebServer\n with \nWebServer\n and \nESP8266WiFi.h\n with \nWiFi.h\n respectively.\n\n\n\n\n\n \nInsert \n#include\n \n\n to behind of \n#include\n \n\n.\n\n \nInsert \nAutoConnect\n \nPORTAL(WEBSERVER);\n to behind of \nESP8266WebServer\n \nWEBSERVER;\n declaration.\n1\n\n \nRemove \nWiFi.\nbegin\n(\nSSID\n,\nPSK\n)\n and the subsequent logic for the connection status check.\n\n \nReplace \nWEBSERVER\n.\nbegin\n()\n to \nPORTAL\n.\nbegin\n()\n.\n2\n\n \nReplace \nWEBSERVER\n.\nhandleClient\n()\n to \nPORTAL\n.\nhandleClient\n()\n.\n3\n\n \nIf the connection checks logic is needed, you can check the return value according to \nPORTAL\n.\nbegin\n()\n with \ntrue\n or \nfalse\n.\n\n\n\n\n\nBasic usage\n\u00b6\n\n\n Basic logic sequence for the user sketches\n\u00b6\n\n\n1. A typical logic sequence\n\u00b6\n\n\n\n\n\n\nInclude headers,\n \nESP8266WebServer.h\n/\nWebServer.h\n and \nAutoConnect.h\n \n\n\nDeclare an ESP8266WebServer variable for ESP8266 or a WebServer variable for ESP32.\n \n\n\nDeclare an AutoConnect variable.\n \n\n\nImplement the URL handlers provided for the \non\n method of ESP8266WebServer/WebServer with the \nfunction()\n.\n \n\n\nsetup()\n\n 5.1 \nSets URL handler the \nfunction()\n to ESP8266WebServer/WebServer by\nESP8266WebServer::on\n/\nWebServer::on\n.\n\n 5.2 \nStarts \nAutoConnect::begin()\n.\n\n 5.3 \nCheck WiFi connection status.\n \n\n\nloop()\n\n 6.1 \nDo the process for actual sketch.\n\n 6.2 \nInvokes \nAutoConnect::handleClient()\n, or invokes \nESP8266WebServer::handleClient()\n/\nWebServer::handleClient\n then \nAutoConnect::handleRequest()\n.\n \n\n\n\n\n\n\n2. Declare AutoConnect object\n\u00b6\n\n\nTwo options\n are available for \nAutoConnect constructor\n.\n\n\nAutoConnect\n \nVARIABLE\n(\n&\nESP8266WebServer\n);\n \n// For ESP8266\n\n\nAutoConnect\n \nVARIABLE\n(\n&\nWebServer\n);\n \n// For ESP32\n\n\n\nor\n\n\nAutoConnect\n \nVARIABLE\n;\n\n\n\n\n\n\n\n\n\nThe parameter with an ESP8266WebServer/WebServer variable:\n An ESP8266WebServer/WebServer object variable must be declared. AutoConnect uses its variable to handles the \nAutoConnect menu\n.\n\n\n\n\n\n\nWith no parameter:\n The sketch does not declare ESP8266WebServer/WebServer object. In this case, AutoConnect allocates an instance of the ESP8266WebServer/WebServer internally. The logic sequence of the sketch is somewhat different as the above. To register a URL handler function by \nESP8266WebServer::on\n or \nWebServer::on\n should be performed after \nAutoConnect::begin\n.\n\n\n\n\n\n\n3. No need WiFI.begin(...)\n\u00b6\n\n\nAutoConnect internally performs \nWiFi.begin\n to establish a WiFi connection. There is no need for a general process to establish a connection using \nWiFi.begin\n with a sketch code.\n\n\n4. Alternate ESP8266WebServer::begin() and WebServer::begin()\n\u00b6\n\n\nAutoConnect::begin\n executes \nESP8266WebServer::begin\n/\nWebServer::begin\n internally too and it starts the DNS server to behave as a Captive portal. So it is not needed to call \nESP8266WebServer::begin\n/\nWebServer::begin\n in the sketch.\n\n\n\n\nWhy DNS Server starts\n\n\nAutoConnect traps the detection of the captive portal and achieves a connection with the WLAN interactively by the AutoConnect menu. It responds SoftAP address to all DNS queries temporarily to trap. Once a WiFi connection establishes, the DNS server contributed by AutoConnect stops.\n\n\n\n\n5. AutoConnect::begin with SSID and Password\n\u00b6\n\n\nSSID and Password can also specify by \nAutoConnect::begin\n. ESP8266/ESP32 uses provided SSID and Password explicitly. If the connection false with specified SSID with Password then a captive portal is activated. SSID and Password are not present, ESP8266 SDK will attempt to connect using the still effectual SSID and password. Usually, it succeeds.\n\n\n6. Use ESP8266WebServer::on and WebServer::on to handle URL\n\u00b6\n\n\nAutoConnect is designed to coexist with the process for handling the web pages by user sketches. The page processing function which will send an HTML to the client invoked by the \"\non::ESP8266WebServer\n\" or the \"\non::WebServer\n\" function is the same as when using ESP8266WebServer/WebServer natively.\n\n\n7. Use either ESP8266WebServer::handleClient()/WebServer::handleClient() or AutoConnect::handleClient()\n\u00b6\n\n\nBoth classes member function name is the same: \nhandleClient\n, but the behavior is different. Using the AutoConnect embedded along with ESP8266WebServer::handleClient/WebServer::handleClient has limitations. Refer to the below section for details. \n\n\n ESP8266WebServer/WebServer hosted or parasitic\n\u00b6\n\n\nThe interoperable process with an ESP8266WebServer/WebServer depends on the parameters of the \nAutoConnect constructor\n.\n\n\n\n\n\n\n\n\nDeclaration parameter for the constructor\n\n\nUse ESP8266WebServer::handleClient or WebServer::handleClient only\n\n\nUse AutoConnect::handleClient\n\n\n\n\n\n\n\n\n\n\nNone\n\n\nAutoConnect menu not available.\nTo use AutoConnect menu, need \nAutoConnect::handleRequest()\n.\nalso to use ESP8266WebServer/WebServer natively, need \nAutoConnect::host()\n.\n\n\nAutoConnect menu available.\nTo use ESP8266WebServer/WebServer natively, need \nAutoConnect::host()\n.\n\n\n\n\n\n\nReference to ESP8266WebServer/WebServer\n\n\nAutoConnect menu not available.\nTo use AutoConnect menu, need \nAutoConnect::handleRequest()\n.\n\n\nAutoConnect menu available.\n\n\n\n\n\n\n\n\n\n\n\n\nBy declaration for the AutoConnect variable with no parameter\n: The ESP8266WebServer/WebServer instance is hosted by AutoConnect automatically then the sketches use \nAutoConnect::host\n as API to get it after \nAutoConnect::begin\n performed.\n\n\n\n\n\n\nBy declaration for the AutoConnect variable with the reference of ESP8266WebServer/WebServer\n: AutoConnect will use it. The sketch can use it is too.\n\n\n\n\n\n\nIn use ESP8266WebServer::handleClient()/WebServer::handleClient()\n: AutoConnect menu can be dispatched but not works normally. It is necessary to call \nAutoConnect::handleRequest\n after \nESP8255WebServer::handleClient\n/\nWebServer::handleClient\n invoking.\n\n\n\n\n\n\nIn use \nAutoConnect::handleClient()\n: The handleClient() process and the AutoConnect menu is available without calling \nESP8266WebServer::handleClient\n.\n\n\n\n\n\n\n\n\nWhy AutoConnect::handleRequest is needed when using ESP8266WebServer::handleClient/WebServer::handleClient\n\n\nThe AutoConnect menu function may affect WiFi connection state. It follows that the menu process must execute outside \nESP8266WebServer::handleClient\n and \nWebServer::handleClient\n.\n\n\nAutoConnect::handleClient\n is equivalent \nESP8266WebServer::handleClient\n and \nWEbServer::handleClient\n included \nAutoConnect::handleRequest\n.\n\n\n\n\n\n\n\n\n\n\n\n\nEach \nVARIABLE\n conforms to the actual declaration in the sketches.\u00a0\n\u21a9\n\n\n\n\n\n\nWiFi SSID and Password can be specified AutoConnect::begin() too.\u00a0\n\u21a9\n\n\n\n\n\n\nReplacement the \nhandleClient\n method is not indispensable. AutoConnect can still connect with the captive portal as it is ESP8266WebServer::handleClient. But it can \nnot valid AutoConnect menu\n.\u00a0\n\u21a9", "title": "Basic usage" }, { @@ -157,7 +157,7 @@ }, { "location": "/basicusage/index.html#1-a-typical-logic-sequence", - "text": "Include headers, ESP8266WebServer.h / WebServer.h and AutoConnect.h Declare ESP8266WebServer variable. Declare AutoConnect variable. Implements the URL handler with the function() . setup() \n 5.1 Sets URL handler function() to ESP8266WebServer/WebServer by ESP8266WebServer::on / WebServer::on . \n 5.2 Starts AutoConnect::begin() . \n 5.3 Check WiFi connection status. loop() \n 6.1 Invokes AutoConnect::handleClient() , or invokes ESP8266WebServer::handleClient() / WebServer::handleClient then AutoConnect::handleRequest() . \n 6.2 Do the process for actual sketch.", + "text": "Include headers, ESP8266WebServer.h / WebServer.h and AutoConnect.h Declare an ESP8266WebServer variable for ESP8266 or a WebServer variable for ESP32. Declare an AutoConnect variable. Implement the URL handlers provided for the on method of ESP8266WebServer/WebServer with the function() . setup() \n 5.1 Sets URL handler the function() to ESP8266WebServer/WebServer by ESP8266WebServer::on / WebServer::on . \n 5.2 Starts AutoConnect::begin() . \n 5.3 Check WiFi connection status. loop() \n 6.1 Do the process for actual sketch. \n 6.2 Invokes AutoConnect::handleClient() , or invokes ESP8266WebServer::handleClient() / WebServer::handleClient then AutoConnect::handleRequest() .", "title": "1. A typical logic sequence" }, { @@ -172,7 +172,7 @@ }, { "location": "/basicusage/index.html#4-alternate-esp8266webserverbegin-and-webserverbegin", - "text": "AutoConnect::begin executes ESP8266WebServer::begin / WebServer::begin internally too and it starts the DNS server to behave as a Captive portal. So it is not needed to call ESP8266WebServer::begin / WebServer::begin with the sketch. Why DNS Server starts AutoConnect traps the detection of the captive portal and achieves a connection with the WLAN interactively by the AutoConnect menu. It responds SoftAP address to all DNS queries temporarily to trap. When the WLAN connection establishes, then stops DNS server.", + "text": "AutoConnect::begin executes ESP8266WebServer::begin / WebServer::begin internally too and it starts the DNS server to behave as a Captive portal. So it is not needed to call ESP8266WebServer::begin / WebServer::begin in the sketch. Why DNS Server starts AutoConnect traps the detection of the captive portal and achieves a connection with the WLAN interactively by the AutoConnect menu. It responds SoftAP address to all DNS queries temporarily to trap. Once a WiFi connection establishes, the DNS server contributed by AutoConnect stops.", "title": "4. Alternate ESP8266WebServer::begin() and WebServer::begin()" }, { @@ -192,7 +192,7 @@ }, { "location": "/basicusage/index.html#esp8266webserverwebserver-hosted-or-parasitic", - "text": "The interoperable process with an ESP8266WebServer/WebServer depends on the parameters of the AutoConnect constructor . Declaration parameter for the constructor Use ESP8266WebServer::handleClient or WebServer::handleClient only Use AutoConnect::handleClient None AutoConnect menu not available. To use AutoConnect menu, need AutoConnect::handleRequest() . also to use ESP8266WebServer/WebServer natively, need AutoConnect::host() . AutoConnect menu available. To use ESP8266WebServer natively, need AutoConnect::host() . Reference to ESP8266WebServer/WebServer AutoConnect menu not available. To use AutoConnect menu, need AutoConnect::handleRequest() . AutoConnect menu available. By declaration for the AutoConnect variable with no parameter : The ESP8266WebServer/WebServer instance is hosted by AutoConnect automatically then the sketches use AutoConnect::host as API to get it after AutoConnect::begin performed. By declaration for the AutoConnect variable with the reference of ESP8266WebServer/WebServer : AutoConnect will use it. The sketch can use it is too. In use ESP8266WebServer::handleClient()/WebServer::handleClient() : AutoConnect menu can be dispatched but not works normally. It is necessary to call AutoConnect::handleRequest after ESP8255WebServer::handleClient / WebServer::handleClient invoking. In use AutoConnect::handleClient() : The handleClient() process and the AutoConnect menu is available without calling ESP8266WebServer::handleClient . Why AutoConnect::handleRequest is needed when using ESP8266WebServer::handleClient/WebServer::handleClient The AutoConnect menu function may affect WiFi connection state. It follows that the menu process must execute outside ESP8266WebServer::handleClient and WebServer::handleClient . AutoConnect::handleClient is equivalent ESP8266WebServer::handleClient and WEbServer::handleClient included AutoConnect::handleRequest . Each VARIABLE conforms to the actual declaration in the sketches.\u00a0 \u21a9 WiFi SSID and Password can be specified AutoConnect::begin() too.\u00a0 \u21a9 Replacement the handleClient method is not indispensable. AutoConnect can still connect with the captive portal as it is ESP8266WebServer::handleClient. But it can not valid AutoConnect menu .\u00a0 \u21a9", + "text": "The interoperable process with an ESP8266WebServer/WebServer depends on the parameters of the AutoConnect constructor . Declaration parameter for the constructor Use ESP8266WebServer::handleClient or WebServer::handleClient only Use AutoConnect::handleClient None AutoConnect menu not available. To use AutoConnect menu, need AutoConnect::handleRequest() . also to use ESP8266WebServer/WebServer natively, need AutoConnect::host() . AutoConnect menu available. To use ESP8266WebServer/WebServer natively, need AutoConnect::host() . Reference to ESP8266WebServer/WebServer AutoConnect menu not available. To use AutoConnect menu, need AutoConnect::handleRequest() . AutoConnect menu available. By declaration for the AutoConnect variable with no parameter : The ESP8266WebServer/WebServer instance is hosted by AutoConnect automatically then the sketches use AutoConnect::host as API to get it after AutoConnect::begin performed. By declaration for the AutoConnect variable with the reference of ESP8266WebServer/WebServer : AutoConnect will use it. The sketch can use it is too. In use ESP8266WebServer::handleClient()/WebServer::handleClient() : AutoConnect menu can be dispatched but not works normally. It is necessary to call AutoConnect::handleRequest after ESP8255WebServer::handleClient / WebServer::handleClient invoking. In use AutoConnect::handleClient() : The handleClient() process and the AutoConnect menu is available without calling ESP8266WebServer::handleClient . Why AutoConnect::handleRequest is needed when using ESP8266WebServer::handleClient/WebServer::handleClient The AutoConnect menu function may affect WiFi connection state. It follows that the menu process must execute outside ESP8266WebServer::handleClient and WebServer::handleClient . AutoConnect::handleClient is equivalent ESP8266WebServer::handleClient and WEbServer::handleClient included AutoConnect::handleRequest . Each VARIABLE conforms to the actual declaration in the sketches.\u00a0 \u21a9 WiFi SSID and Password can be specified AutoConnect::begin() too.\u00a0 \u21a9 Replacement the handleClient method is not indispensable. AutoConnect can still connect with the captive portal as it is ESP8266WebServer::handleClient. But it can not valid AutoConnect menu .\u00a0 \u21a9", "title": " ESP8266WebServer/WebServer hosted or parasitic" }, { @@ -287,7 +287,7 @@ }, { "location": "/api/index.html", - "text": "Include headers\n\u00b6\n\n\n AutoConnect.h\n\u00b6\n\n\n#include\n \n\n\n\n\n\n\nDefined macros\n\u00b6\n\n\n#define AC_DEBUG \n// Monitor message output activation\n\n\n#define AC_DEBUG_PORT Serial \n// Default message output device\n\n\n#define AUTOCONNECT_AP_IP 0x01F4A8C0 \n// Default SoftAP IP\n\n\n#define AUTOCONNECT_AP_GW 0x01F4A8C0 \n// Default SoftAP Gateway IP\n\n\n#define AUTOCONNECT_AP_NM 0x00FFFFFF \n// Default subnet mask\n\n\n#define AUTOCONNECT_DNSPORT 53 \n// Default DNS port at captive portal\n\n\n#define AUTOCONNECT_HTTPPORT 80 \n// Default HTTP\n\n\n#define AUTOCONNECT_MENU_TITLE \"AutoConnect\" \n// Default AutoConnect menu title\n\n\n#define AUTOCONNECT_STARTUPTIME 10 \n// Default waiting time[s] for after reset\n\n\n#define AUTOCONNECT_URI \"/_ac\" \n// Default AutoConnect root path\n\n\n#define AUTOCONNECT_TIMEOUT 30000 \n// Default connection timeout[ms]\n\n\n\n\n\nAutoConnect API\n\u00b6\n\n\n Constructors\n\u00b6\n\n\nAutoConnect\n\u00b6\n\n\nAutoConnect\n()\n\n\n\n\n\n\n\nAutoConnect default constructor. This entry internally allocates the ESP8266WebServer for ESP8266 or WebServer for ESP32 and is activated internally.\n\n\n\n\nFor ESP8266\n\n\n\n\nAutoConnect\n(\nESP8266WebServer\n&\n \nwebServer\n)\n\n\n\n\n\n\n\nFor ESP32\n\n\n\n\nAutoConnect\n(\nWebServer\n&\n \nwebServer\n)\n\n\n\n\n\nRun the AutoConnect site using the externally ensured ESP8266WebServer for ESP8266 or WebServer for ESP32.\n\n\nThe \nhandleClient\n function of AutoConnect can include the response of the URI handler added by the user using the \"\non\n\" function of ESP8266WebServer/WebServer. If ESP8266WebServer/WebServer is assigned internally by AutoConnect, the sketch can obtain that reference with the \nhost\n function.\n\n\n \nParameters\n\n \nwebServer\nA reference of ESP8266WebServer or WebServer instance.\n\n\n\n\n Public member functions\n\u00b6\n\n\nbegin\n\u00b6\n\n\nbool\n \nbegin\n()\n\n\n\n\nbool\n \nbegin\n(\nconst\n \nchar\n*\n \nssid\n,\n \nconst\n \nchar\n*\n \npassphraase\n)\n\n\n\n\nbool\n \nbegin\n(\nconst\n \nchar\n*\n \nssid\n,\n \nconst\n \nchar\n*\n \npassphraase\n,\n \nunsigned\n \nlong\n \ntimeout\n)\n\n\n\n\nStarts establishing the WiFi connection.\n\nAutoConnect first invokes \nWiFi.begin\n. If the case of SSID and Password missing, its \nWiFi.begin\n has no SSID and Password. The WiFi mode at this time is WIFI_STA. Then ESP8266WebServer/WebServer will be started immediately after the first \nWiFi.begin\n regardless of the result.\n\n\nThe captive portal will not be started if the connection has been established with first \nWiFi.begin\n. If the connection cannot establish, switch to WIFI_AP_STA mode and activate SoftAP. Then DNS server starts.\n\n\n \nParameters\n\n \nssid\nSSID to be connected.\n\n \npassphrase\nPassword for connection.\n\n \ntimeout\nA time out value in milliseconds for waiting connection.\n\n \nReturn value\n\n \ntrue\nConnection established, AutoConnect service started with WIFI_STA mode.\n\n \nfalse\nCould not connected, Captive portal started with WIFI_AP_STA mode.\n\n\n\n\nconfig\n\u00b6\n\n\nbool\n \nconfig\n(\nAutoConnectConfig\n&\n \nconfig\n)\n\n\n\n\nbool\n \nconfig\n(\nconst\n \nchar\n*\n \nap\n,\n \nconst\n \nchar\n*\n \npassword\n \n=\n \nnullptr\n)\n\n\n\n\nSet SoftAP's WiFi configuration and static IP configuration. \n\n\n \nParameters\n\n \nconfig\nReference to \nAutoConnectConfig\n containing SoftAP's parameters and static IP parameters.\n\n \nap\nSSID for SoftAP. The default value is \nesp8266ap\n for ESP8266, \nesp32ap\n for ESP32.\n\n \npassword\nPassword for SodtAP. The default value is \n12345678\n.\n\n \nReturn value\n\n \ntrue\nSuccessfully configured.\n\n \nfalse\nConfiguration parameter is invalid, some values out of range.\n\n\n\n\nend\n\u00b6\n\n\nvoid\n \nend\n()\n\n\n\n\n\nStops AutoConnect captive portal service. Release ESP8266WebServer/WebServer and DNSServer. \n\n\n\n\nAttention to end\n\n\nThe end function releases the instance of ESP8266WebServer/WebServer and DNSServer. It can not process them after the end function.\n\n\n\n\nhandleClient\n\u00b6\n\n\nvoid\n \nhandleClient\n()\n\n\n\n\n\nProcess the AutoConnect menu interface. The handleClient() function of the ESP8266WebServer/WebServer hosted by AutoConnect is also called from within AutoConnect and client requests contained in the user sketch handler are also handled.\n\n\nhandleRequest\n\u00b6\n\n\nvoid\n \nhandleRequest\n()\n\n\n\n\n\nHandling for the AutoConnect menu request.\n\n\n\n\nAbout used in combination with handleClient\n\n\nThe handleRequest function is not supposed to use with AutoConnect::handleClient. It should be used with ESP8266WebServer::handleClient or WebServer::handleClient.\n\n\n\n\nhome\n\u00b6\n\n\nvoid\n \nhome\n(\nString\n \nuri\n)\n\n\n\n\n\nPut a user site's home URI. The URI specified by home is linked from \"HOME\" in the AutoConnect menu.\n\n\n \nParameters\n\n \nuri\n A URI string of user site's home path.\n\n\n\n\nhost\n\u00b6\n\n\nReturns the reference of the ESP8266WebServer/WebServer which is allocated in AutoConnect automatically.\n\n\n\n\nFor ESP8266\n\n\n\n\nESP8266WebServer\n&\n \nhost\n()\n\n\n\n\n\n\n\nFor ESP32\n\n\n\n\nWebServer\n&\n \nhost\n()\n\n\n\n\n\n \nReturn value\n\n \nA reference of the ESP8266WebServer/WebServer.\n\n\n\n\n\n\n&reference is not a pointer\n\n\nA reference cannot be re-assigned, and must be assigned at initialization. It's like as bind as alias. \n\n\nESP8266WebServer\n&\n \nserver\n \n=\n \nportal\n.\nhost\n();\n\n\nserver\n.\nhandleClient\n();\n\n\n\nor\n\n\nportal\n.\nhost\n().\nhandleClient\n();\n\n\n\n\n\n\nonDetect\n\u00b6\n\n\nvoid\n \nonDetect\n(\nDetectExit_ft\n \nfn\n)\n\n\n\nRegister the function which will call from AutoConnect at the start of the captive portal.\n\n\n \nParameters\n\n \nfn\nFunction called at the captive portal start.\n\n\n\n\n\nAn \nfn\n specifies the function called when the captive portal starts. Its prototype declaration is defined as \"\nDetectExit_ft\n\".\n\n\ntypedef\n \nstd\n::\nfunction\n<\nbool\n(\nIPAddress\n \nsoftapIP\n)\n>\n \nDetectExit_ft\n\n\n\n\n\n \nParameters\n\n \nsoftapIP\nAn IP address of SoftAP for the captive portal.\n\n \nRetuen value\n\n \ntrue\nContinues captive portal handling.\n\n \nfalse\nCancel the captive portal. AutoConnect::begin function will return with a false.\n\n\n\n\nonNotFound\n\u00b6\n\n\n\n\nFor ESP8266\n\n\n\n\nvoid\n \nonNotFound\n(\nESP8266WebServer\n::\nTHandlerFunction\n \nfn\n)\n\n\n\n\n\n\n\nFor ESP32\n\n\n\n\nvoid\n \nonNotFound\n(\nWebServer\n::\nTHandlerFunction\n \nfn\n)\n\n\n\nRegister the handler function for undefined URL request detected.\n\n\n \nParameters\n\n \nfn\nA function of the \"not found\" handler.\n\n\n\n\nAutoConnectConfig API\n\u00b6\n\n\n Constructor\n\u00b6\n\n\nAutoConnectConfig\n\u00b6\n\n\nAutoConnectConfig\n();\n\n\n\n\nAutoConnectConfig\n(\nconst\n \nchar\n*\n \nap\n,\n \nconst\n \nchar\n*\n \npassword\n);\n\n\n\n\n\n \nParameters\n\n \nap\nSSID for SoftAP. The length should be up to 31. The default value is \nesp8266ap\n for ESP8266, \nesp32ap\n for ESP32.\n\n \npassword\nPassword for SodtAP. The length should be from 8 to up to 63. The default value is \n12345678\n.\n\n\n\n\n Public member variables\n\u00b6\n\n\napid\n\u00b6\n\n\nSoftAP's SSID.\n\n\n \nType\n\n \nString\n\n\n\n\napip\n\u00b6\n\n\nSets IP address for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.\n\n\n \nType\n\n \nIPAddress\nThe default value is \n192.168.244.1\n\n\n\n\nautoReconnect\n\u00b6\n\n\nAutomatically will try to reconnect with the past established access point (BSSID) when the current configured SSID in ESP8266/ESP32 could not be connected. By enabling this option, \nAutoConnect::begin()\n function will attempt to reconnect to a known access point using credentials stored in the EEPROM, even if the connection failed by current SSID.\n\nIf the connection fails, starts the captive portal in SoftAP + STA mode.\n\n\n\n \nType\n\n \nbool\n\n \nValue\n\n \ntrue\nReconnect automatically.\n\n \nfalse\nStarts Captive Portal in SoftAP + STA mode without trying to reconnect. This is the default.\n\n\n\n\nWhen the autoReconnect option is enabled, an automatic connection will behave if the following conditions are satisfied.\n\n\n\n\nInvokes \nAutoConnect::begin\n without user name and password parameter as \nbegin()\n.\n\n\nIf one of the saved BSSIDs (not the SSID) of the credentials matches the BSSID detected by the network scan.\n\n\n\n\nautoReset\n\u00b6\n\n\nReset ESP8266 module automatically after WLAN disconnected.\n\n\n \nType\n\n \nbool\n\n \nValue\n\n \ntrue\nReset after WiFi disconnected automatically.\n\n \nfalse\nNo reset.\n\n\n\n\nautoRise\n\u00b6\n\n\nCaptive portal activation switch. False for disabling the captive portal. It prevents starting the captive portal even if the connection at the first \nWiFi.begin\n fails.\n\n\n \nType\n\n \nbool\n\n \nValue\n\n \ntrue\nEnable the captive portal. This is the default.\n\n \nfalse\nDisable the captive portal.\n\n\n\n\nautoSave\n\u00b6\n\n\nThe credential saved automatically at the connection establishment.\n\n\n \nType\n\n \nAC_SAVECREDENTIAL_t\n\n \nValue\n\n \nAC_SAVECREDENTIAL_AUTO\nThe credential saved automatically. This is the default.\n\n \nAC_SAVECREDENTIAL_NEVER\nThe credential no saved.\n\n\n\n\nboundaryOffset\n\u00b6\n\n\nSets the offset address of the credential storage area for EEPROM. This value must be between greater than 4 and less than flash sector size. (4096 by SDK)\n\nThe default value is 0.\n\n\n \nType\n\n \nuint16_t\n\n\n\n\n\n\nIt will conflict with user data.\n\n\nIf the sketch leaves this offset at zero, it will conflict the storage area of credentials with the user sketch owned data. It needs to use the behind of credential area.\n\n\n\n\nchannel\n\u00b6\n\n\nThe channel number of WIFi when SoftAP starts.\n\n\n \nType\n\n \nuint8_t\n\n \nValue\n\n \n1 ~ 14. The default value is 1.\n\n\n\n\n\n\nHow do I choose Channel\n\n\nEspressif Systems had announced the \napplication note\n about Wi-Fi channel selection.\n\n\n\n\ndns1\n\u00b6\n\n\nSet primary DNS server address when using static IP address.\n\n\n \nType\n\n \nIPAddress\n\n\n\n\ndns2\n\u00b6\n\n\nSet secondary DNS server address when using static IP address.\n\n\n \nType\n\n \nIPAddress\n\n\n\n\ngateway\n\u00b6\n\n\nSets gateway address for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.\n\n\n \nType\n\n \nIPAddress\nThe default value is \n192.168.244.1\n\n\n\n\nhidden\n\u00b6\n\n\nSets SoftAP to hidden SSID.\n\n\n \nType\n\n \nuint8_t\n\n \nValue\n\n \n0\nSSID will be appeared. This is the default.\n\n \n1\nSSID will be hidden.\n\n\n\n\nhomeUri\n\u00b6\n\n\nSets the home path of user sketch. This path would be linked from 'HOME' in the AutoConnect menu.\n\n\n \nType\n\n \nString\n\n\n\n\nnetmask\n\u00b6\n\n\nSets subnet mask for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.\n\n\n \nType\n\n \nIPAddress\nThe default value is \n255.255.255.0\n\n\n\n\npsk\n\u00b6\n\n\nSets password for SoftAP. The length should be from 8 to up to 63. The default value is \n12345678\n.\n\n\n \nType\n\n \nString\n\n\n\n\nstaip\n\u00b6\n\n\nSet a static IP address. The IP will behave with STA mode.\n\n\n \nType\n\n \nIPAddress\n\n\n\n\nstaGateway\n\u00b6\n\n\nSet the gateway address when using static IP address.\n\n\n \nType\n\n \nIPAddress\n\n\n\n\nstaNetmask\n\u00b6\n\n\nSet the subnetmask when using static IP address.\n\n\n \nType\n\n \nIPAddress\n\n\n\n\n AutoConnectConfig example\n\u00b6\n\n\nAutoConenct\n \nPortal\n;\n\n\nAutoConenctConfig\n \nConfig\n(\n\"\"\n,\n \n\"passpass\"\n);\n \n// SoftAp name is determined at runtime\n\n\nConfig\n.\napid\n \n=\n \nESP\n.\nhostname\n();\n \n// Retrieve host name to SotAp identification\n\n\nConfig\n.\napip\n \n=\n \nIPAddress\n(\n192\n,\n168\n,\n10\n,\n101\n);\n \n// Sets SoftAP IP address\n\n\nConfig\n.\ngateway\n \n=\n \nIPAddress\n(\n192\n,\n168\n,\n10\n,\n1\n);\n \n// Sets WLAN router IP address\n\n\nConfig\n.\nnetmask\n \n=\n \nIPAddress\n(\n255\n,\n255\n,\n255\n,\n0\n);\n \n// Sets WLAN scope\n\n\nConfig\n.\nautoReconnect\n \n=\n \ntrue\n;\n \n// Enable auto-reconnect\n\n\nConfig\n.\nautoSave\n \n=\n \nAC_SAVECREDENTIAL_NEVER\n;\n \n// No save credential\n\n\nCOnfig\n.\nboundaryOffet\n \n=\n \n64\n;\n \n// Reserve 64 bytes for the user data in EEPROM. \n\n\nConfig\n.\nhomeUri\n \n=\n \n\"/index.html\"\n \n// Sets home path of the sketch application\n\n\nConfig\n.\nstaip\n \n=\n \nIPAddress\n(\n192\n,\n168\n,\n10\n,\n10\n);\n \n// Sets static IP\n\n\nConfig\n.\nstaGateway\n \n=\n \nIPAddress\n(\n192\n,\n168\n,\n10\n,\n1\n);\n \n// Sets WiFi router address\n\n\nConfig\n.\nstaNetmask\n \n=\n \nIPAddress\n(\n255\n,\n255\n,\n255\n,\n0\n);\n \n// Sets WLAN scope\n\n\nConfig\n.\ndns1\n \n=\n \nIPAddress\n(\n192\n,\n168\n,\n10\n,\n1\n);\n \n// Sets primary DNS address\n\n\nPortal\n.\nconfig\n(\nConfig\n);\n \n// Configure AutoConnect\n\n\nPortal\n.\nbegin\n();\n \n// Starts and behaves captive portal\n\n\n\n\n\n Something extra\n\u00b6\n\n\nThe library presents two PNG icons which can be used to embed a hyperlink to the AutoConnect menu.\n\n\n\n\nBar type \n\n\nCog type \n\n\n\n\nTo reference the icon, use the \nAUTOCONNECT_LINK\n macro in the sketch. It expands into the string literal as an HTML \n\n tag with PNG embedded of the AutoConnect menu hyperlinks. Icon type is specified by the parameter of the macro.\n\n\n\n \nBAR_24\nBars icon, 24x24.\n\n \nBAR_32\nBars icon, 32x32.\n\n \nBAR_48\nBars icon, 48x48.\n\n \nCOG_24\nCog icon, 24x24.\n\n \nCOG_32\nCog icon, 32x32.\n\n\n\n\n\n\n\nUsage\n\n\nString\n \nhtml\n \n=\n \n\"\"\n;\n\n\nhtml\n \n+=\n \nAUTOCONNECT_LINK\n(\nBAR_32\n);\n\n\nhtml\n \n+=\n \n\"\"\n;\n\n\nserver\n.\nsend\n(\n200\n,\n \n\"text/html\"\n,\n \nhtml\n);", + "text": "Include headers\n\u00b6\n\n\n AutoConnect.h\n\u00b6\n\n\n#include\n \n\n\n\n\n\n\nDefined macros\n\u00b6\n\n\n#define AC_DEBUG \n// Monitor message output activation\n\n\n#define AC_DEBUG_PORT Serial \n// Default message output device\n\n\n#define AUTOCONNECT_AP_IP 0x01F4A8C0 \n// Default SoftAP IP\n\n\n#define AUTOCONNECT_AP_GW 0x01F4A8C0 \n// Default SoftAP Gateway IP\n\n\n#define AUTOCONNECT_AP_NM 0x00FFFFFF \n// Default subnet mask\n\n\n#define AUTOCONNECT_DNSPORT 53 \n// Default DNS port at captive portal\n\n\n#define AUTOCONNECT_HTTPPORT 80 \n// Default HTTP\n\n\n#define AUTOCONNECT_MENU_TITLE \"AutoConnect\" \n// Default AutoConnect menu title\n\n\n#define AUTOCONNECT_STARTUPTIME 10 \n// Default waiting time[s] for after reset\n\n\n#define AUTOCONNECT_URI \"/_ac\" \n// Default AutoConnect root path\n\n\n#define AUTOCONNECT_TIMEOUT 30000 \n// Default connection timeout[ms]\n\n\n\n\n\nAutoConnect API\n\u00b6\n\n\n Constructors\n\u00b6\n\n\nAutoConnect\n\u00b6\n\n\nAutoConnect\n()\n\n\n\n\n\n\n\nAutoConnect default constructor. This entry internally allocates the ESP8266WebServer for ESP8266 or WebServer for ESP32 and is activated internally.\n\n\n\n\nFor ESP8266\n\n\n\n\nAutoConnect\n(\nESP8266WebServer\n&\n \nwebServer\n)\n\n\n\n\n\n\n\nFor ESP32\n\n\n\n\nAutoConnect\n(\nWebServer\n&\n \nwebServer\n)\n\n\n\n\n\nRun the AutoConnect site using the externally ensured ESP8266WebServer for ESP8266 or WebServer for ESP32.\n\n\nThe \nhandleClient\n function of AutoConnect can include the response of the URI handler added by the user using the \"\non\n\" function of ESP8266WebServer/WebServer. If ESP8266WebServer/WebServer is assigned internally by AutoConnect, the sketch can obtain that reference with the \nhost\n function.\n\n\n \nParameters\n\n \nwebServer\nA reference of ESP8266WebServer or WebServer instance.\n\n\n\n\n Public member functions\n\u00b6\n\n\nbegin\n\u00b6\n\n\nbool\n \nbegin\n()\n\n\n\n\nbool\n \nbegin\n(\nconst\n \nchar\n*\n \nssid\n,\n \nconst\n \nchar\n*\n \npassphrase\n)\n\n\n\n\nbool\n \nbegin\n(\nconst\n \nchar\n*\n \nssid\n,\n \nconst\n \nchar\n*\n \npassphrase\n,\n \nunsigned\n \nlong\n \ntimeout\n)\n\n\n\n\nStarts establishing the WiFi connection. The WiFi mode at this time is WIFI_STA.\n\nAutoConnect first invokes \nWiFi.begin\n. If the \nssid\n and the \npassphrase\n are missing, its \nWiFi.begin\n has no SSID and Password. Regardless of the result, ESP8266WebServer/WebServer will start immediately after the first \nWiFi.begin\n.\n\nThe captive portal will not be started if the connection has been established with first \nWiFi.begin\n. If the connection cannot establish, switch to WIFI_AP_STA mode and activate SoftAP. Then DNS server starts.\n\n\n \nParameters\n\n \nssid\nSSID to be connected.\n\n \npassphrase\nPassword for connection.\n\n \ntimeout\nA time out value in milliseconds for waiting connection.\n\n \nReturn value\n\n \ntrue\nConnection established, AutoConnect service started with WIFI_STA mode.\n\n \nfalse\nCould not connected, Captive portal started with WIFI_AP_STA mode.\n\n\n\n\nconfig\n\u00b6\n\n\nbool\n \nconfig\n(\nAutoConnectConfig\n&\n \nconfig\n)\n\n\n\n\nbool\n \nconfig\n(\nconst\n \nchar\n*\n \nap\n,\n \nconst\n \nchar\n*\n \npassword\n \n=\n \nnullptr\n)\n\n\n\n\nSet SoftAP's WiFi configuration and static IP configuration. \n\n\n \nParameters\n\n \nconfig\nReference to \nAutoConnectConfig\n containing SoftAP's parameters and static IP parameters.\n\n \nap\nSSID for SoftAP. The default value is \nesp8266ap\n for ESP8266, \nesp32ap\n for ESP32.\n\n \npassword\nPassword for SodtAP. The default value is \n12345678\n.\n\n \nReturn value\n\n \ntrue\nSuccessfully configured.\n\n \nfalse\nConfiguration parameter is invalid, some values out of range.\n\n\n\n\nend\n\u00b6\n\n\nvoid\n \nend\n()\n\n\n\n\n\nStops AutoConnect captive portal service. Release ESP8266WebServer/WebServer and DNSServer. \n\n\n\n\nAttention to end\n\n\nThe end function releases the instance of ESP8266WebServer/WebServer and DNSServer. It can not process them after the end function.\n\n\n\n\nhandleClient\n\u00b6\n\n\nvoid\n \nhandleClient\n()\n\n\n\n\n\nProcess 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.\n\n\nhandleRequest\n\u00b6\n\n\nvoid\n \nhandleRequest\n()\n\n\n\n\n\nHandling for the AutoConnect menu request.\n\n\n\n\nAbout used in combination with handleClient\n\n\nThe handleRequest function is not supposed to use with AutoConnect::handleClient. It should be used with ESP8266WebServer::handleClient or WebServer::handleClient.\n\n\n\n\nhome\n\u00b6\n\n\nvoid\n \nhome\n(\nString\n \nuri\n)\n\n\n\n\n\nPut a user site's home URI. The URI specified by home is linked from \"HOME\" in the AutoConnect menu.\n\n\n \nParameters\n\n \nuri\n A URI string of user site's home path.\n\n\n\n\nhost\n\u00b6\n\n\nReturns the reference of the ESP8266WebServer/WebServer which is allocated in AutoConnect automatically.\n\n\n\n\nFor ESP8266\n\n\n\n\nESP8266WebServer\n&\n \nhost\n()\n\n\n\n\n\n\n\nFor ESP32\n\n\n\n\nWebServer\n&\n \nhost\n()\n\n\n\n\n\n \nReturn value\n\n \nA reference of the ESP8266WebServer/WebServer.\n\n\n\n\n\n\n&reference is not a pointer\n\n\nA reference cannot be re-assigned, and must be assigned at initialization. It's like as bind as alias. \n\n\nESP8266WebServer\n&\n \nserver\n \n=\n \nportal\n.\nhost\n();\n\n\nserver\n.\nhandleClient\n();\n\n\n\nor\n\n\nportal\n.\nhost\n().\nhandleClient\n();\n\n\n\n\n\n\nonDetect\n\u00b6\n\n\nvoid\n \nonDetect\n(\nDetectExit_ft\n \nfn\n)\n\n\n\nRegister the function which will call from AutoConnect at the start of the captive portal.\n\n\n \nParameters\n\n \nfn\nFunction called at the captive portal start.\n\n\n\n\n\nAn \nfn\n specifies the function called when the captive portal starts. Its prototype declaration is defined as \"\nDetectExit_ft\n\".\n\n\ntypedef\n \nstd\n::\nfunction\n<\nbool\n(\nIPAddress\n \nsoftapIP\n)\n>\n \nDetectExit_ft\n\n\n\n\n\n \nParameters\n\n \nsoftapIP\nAn IP address of SoftAP for the captive portal.\n\n \nRetuen value\n\n \ntrue\nContinues captive portal handling.\n\n \nfalse\nCancel the captive portal. AutoConnect::begin function will return with a false.\n\n\n\n\nonNotFound\n\u00b6\n\n\n\n\nFor ESP8266\n\n\n\n\nvoid\n \nonNotFound\n(\nESP8266WebServer\n::\nTHandlerFunction\n \nfn\n)\n\n\n\n\n\n\n\nFor ESP32\n\n\n\n\nvoid\n \nonNotFound\n(\nWebServer\n::\nTHandlerFunction\n \nfn\n)\n\n\n\nRegister the handler function for undefined URL request detected.\n\n\n \nParameters\n\n \nfn\nA function of the \"not found\" handler.\n\n\n\n\nAutoConnectConfig API\n\u00b6\n\n\n Constructor\n\u00b6\n\n\nAutoConnectConfig\n\u00b6\n\n\nAutoConnectConfig\n();\n\n\n\n\nAutoConnectConfig\n(\nconst\n \nchar\n*\n \nap\n,\n \nconst\n \nchar\n*\n \npassword\n);\n\n\n\n\n\n \nParameters\n\n \nap\nSSID for SoftAP. The length should be up to 31. The default value is \nesp8266ap\n for ESP8266, \nesp32ap\n for ESP32.\n\n \npassword\nPassword for SodtAP. The length should be from 8 to up to 63. The default value is \n12345678\n.\n\n\n\n\n Public member variables\n\u00b6\n\n\napid\n\u00b6\n\n\nSoftAP's SSID.\n\n\n \nType\n\n \nString\n\n\n\n\napip\n\u00b6\n\n\nSets IP address for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.\n\n\n \nType\n\n \nIPAddress\nThe default value is \n192.168.244.1\n\n\n\n\nautoReconnect\n\u00b6\n\n\nAutomatically will try to reconnect with the past established access point (BSSID) when the current configured SSID in ESP8266/ESP32 could not be connected. By enabling this option, \nAutoConnect::begin()\n function will attempt to reconnect to a known access point using credentials stored in the EEPROM, even if the connection failed by current SSID.\n\nIf the connection fails, starts the captive portal in SoftAP + STA mode.\n\n\n\n \nType\n\n \nbool\n\n \nValue\n\n \ntrue\nReconnect automatically.\n\n \nfalse\nStarts Captive Portal in SoftAP + STA mode without trying to reconnect. This is the default.\n\n\n\n\nWhen the autoReconnect option is enabled, an automatic connection will behave if the following conditions are satisfied.\n\n\n\n\nInvokes \nAutoConnect::begin\n without user name and password parameter as \nbegin()\n.\n\n\nIf one of the saved BSSIDs (not the SSID) of the credentials matches the BSSID detected by the network scan.\n\n\n\n\nautoReset\n\u00b6\n\n\nReset ESP8266 module automatically after WLAN disconnected.\n\n\n \nType\n\n \nbool\n\n \nValue\n\n \ntrue\nReset after WiFi disconnected automatically.\n\n \nfalse\nNo reset.\n\n\n\n\nautoRise\n\u00b6\n\n\nCaptive portal activation switch. False for disabling the captive portal. It prevents starting the captive portal even if the connection at the first \nWiFi.begin\n fails.\n\n\n \nType\n\n \nbool\n\n \nValue\n\n \ntrue\nEnable the captive portal. This is the default.\n\n \nfalse\nDisable the captive portal.\n\n\n\n\nautoSave\n\u00b6\n\n\nThe credential saved automatically at the connection establishment.\n\n\n \nType\n\n \nAC_SAVECREDENTIAL_t\n\n \nValue\n\n \nAC_SAVECREDENTIAL_AUTO\nThe credential saved automatically. This is the default.\n\n \nAC_SAVECREDENTIAL_NEVER\nThe credential no saved.\n\n\n\n\nboundaryOffset\n\u00b6\n\n\nSets the offset address of the credential storage area for EEPROM. This value must be between greater than 4 and less than flash sector size. (4096 by SDK)\n\nThe default value is 0.\n\n\n \nType\n\n \nuint16_t\n\n\n\n\n\n\nIt will conflict with user data.\n\n\nIf the sketch leaves this offset at zero, it will conflict the storage area of credentials with the user sketch owned data. It needs to use the behind of credential area.\n\n\n\n\nchannel\n\u00b6\n\n\nThe channel number of WIFi when SoftAP starts.\n\n\n \nType\n\n \nuint8_t\n\n \nValue\n\n \n1 ~ 14. The default value is 1.\n\n\n\n\n\n\nHow do I choose Channel\n\n\nEspressif Systems had announced the \napplication note\n about Wi-Fi channel selection.\n\n\n\n\ndns1\n\u00b6\n\n\nSet primary DNS server address when using static IP address.\n\n\n \nType\n\n \nIPAddress\n\n\n\n\ndns2\n\u00b6\n\n\nSet secondary DNS server address when using static IP address.\n\n\n \nType\n\n \nIPAddress\n\n\n\n\ngateway\n\u00b6\n\n\nSets gateway address for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.\n\n\n \nType\n\n \nIPAddress\nThe default value is \n192.168.244.1\n\n\n\n\nhidden\n\u00b6\n\n\nSets SoftAP to hidden SSID.\n\n\n \nType\n\n \nuint8_t\n\n \nValue\n\n \n0\nSSID will be appeared. This is the default.\n\n \n1\nSSID will be hidden.\n\n\n\n\nhomeUri\n\u00b6\n\n\nSets the home path of user sketch. This path would be linked from 'HOME' in the AutoConnect menu.\n\n\n \nType\n\n \nString\n\n\n\n\nnetmask\n\u00b6\n\n\nSets subnet mask for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.\n\n\n \nType\n\n \nIPAddress\nThe default value is \n255.255.255.0\n\n\n\n\npsk\n\u00b6\n\n\nSets password for SoftAP. The length should be from 8 to up to 63. The default value is \n12345678\n.\n\n\n \nType\n\n \nString\n\n\n\n\nstaip\n\u00b6\n\n\nSet a static IP address. The IP will behave with STA mode.\n\n\n \nType\n\n \nIPAddress\n\n\n\n\nstaGateway\n\u00b6\n\n\nSet the gateway address when using static IP address.\n\n\n \nType\n\n \nIPAddress\n\n\n\n\nstaNetmask\n\u00b6\n\n\nSet the subnetmask when using static IP address.\n\n\n \nType\n\n \nIPAddress\n\n\n\n\n AutoConnectConfig example\n\u00b6\n\n\nAutoConenct\n \nPortal\n;\n\n\nAutoConenctConfig\n \nConfig\n(\n\"\"\n,\n \n\"passpass\"\n);\n \n// SoftAp name is determined at runtime\n\n\nConfig\n.\napid\n \n=\n \nESP\n.\nhostname\n();\n \n// Retrieve host name to SotAp identification\n\n\nConfig\n.\napip\n \n=\n \nIPAddress\n(\n192\n,\n168\n,\n10\n,\n101\n);\n \n// Sets SoftAP IP address\n\n\nConfig\n.\ngateway\n \n=\n \nIPAddress\n(\n192\n,\n168\n,\n10\n,\n1\n);\n \n// Sets WLAN router IP address\n\n\nConfig\n.\nnetmask\n \n=\n \nIPAddress\n(\n255\n,\n255\n,\n255\n,\n0\n);\n \n// Sets WLAN scope\n\n\nConfig\n.\nautoReconnect\n \n=\n \ntrue\n;\n \n// Enable auto-reconnect\n\n\nConfig\n.\nautoSave\n \n=\n \nAC_SAVECREDENTIAL_NEVER\n;\n \n// No save credential\n\n\nCOnfig\n.\nboundaryOffet\n \n=\n \n64\n;\n \n// Reserve 64 bytes for the user data in EEPROM. \n\n\nConfig\n.\nhomeUri\n \n=\n \n\"/index.html\"\n \n// Sets home path of the sketch application\n\n\nConfig\n.\nstaip\n \n=\n \nIPAddress\n(\n192\n,\n168\n,\n10\n,\n10\n);\n \n// Sets static IP\n\n\nConfig\n.\nstaGateway\n \n=\n \nIPAddress\n(\n192\n,\n168\n,\n10\n,\n1\n);\n \n// Sets WiFi router address\n\n\nConfig\n.\nstaNetmask\n \n=\n \nIPAddress\n(\n255\n,\n255\n,\n255\n,\n0\n);\n \n// Sets WLAN scope\n\n\nConfig\n.\ndns1\n \n=\n \nIPAddress\n(\n192\n,\n168\n,\n10\n,\n1\n);\n \n// Sets primary DNS address\n\n\nPortal\n.\nconfig\n(\nConfig\n);\n \n// Configure AutoConnect\n\n\nPortal\n.\nbegin\n();\n \n// Starts and behaves captive portal\n\n\n\n\n\n Something extra\n\u00b6\n\n\nThe library presents two PNG icons which can be used to embed a hyperlink to the AutoConnect menu.\n\n\n\n\nBar type \n\n\nCog type \n\n\n\n\nTo reference the icon, use the \nAUTOCONNECT_LINK\n macro in the sketch. It expands into the string literal as an HTML \n\n tag with PNG embedded of the AutoConnect menu hyperlinks. Icon type is specified by the parameter of the macro.\n\n\n\n \nBAR_24\nBars icon, 24x24.\n\n \nBAR_32\nBars icon, 32x32.\n\n \nBAR_48\nBars icon, 48x48.\n\n \nCOG_24\nCog icon, 24x24.\n\n \nCOG_32\nCog icon, 32x32.\n\n\n\n\n\n\n\nUsage\n\n\nString\n \nhtml\n \n=\n \n\"\"\n;\n\n\nhtml\n \n+=\n \nAUTOCONNECT_LINK\n(\nBAR_32\n);\n\n\nhtml\n \n+=\n \n\"\"\n;\n\n\nserver\n.\nsend\n(\n200\n,\n \n\"text/html\"\n,\n \nhtml\n);", "title": "Library APIs" }, { @@ -327,7 +327,7 @@ }, { "location": "/api/index.html#begin", - "text": "bool begin () bool begin ( const char * ssid , const char * passphraase ) bool begin ( const char * ssid , const char * passphraase , unsigned long timeout ) Starts establishing the WiFi connection. \nAutoConnect first invokes WiFi.begin . If the case of SSID and Password missing, its WiFi.begin has no SSID and Password. The WiFi mode at this time is WIFI_STA. Then ESP8266WebServer/WebServer will be started immediately after the first WiFi.begin regardless of the result. The captive portal will not be started if the connection has been established with first WiFi.begin . If the connection cannot establish, switch to WIFI_AP_STA mode and activate SoftAP. Then DNS server starts. \n Parameters \n ssid SSID to be connected. \n passphrase Password for connection. \n timeout A time out value in milliseconds for waiting connection. \n Return value \n true Connection established, AutoConnect service started with WIFI_STA mode. \n false Could not connected, Captive portal started with WIFI_AP_STA mode.", + "text": "bool begin () bool begin ( const char * ssid , const char * passphrase ) bool begin ( const char * ssid , const char * passphrase , unsigned long timeout ) Starts establishing the WiFi connection. The WiFi mode at this time is WIFI_STA. \nAutoConnect first invokes WiFi.begin . If the ssid and the passphrase are missing, its WiFi.begin has no SSID and Password. Regardless of the result, ESP8266WebServer/WebServer will start immediately after the first WiFi.begin . \nThe captive portal will not be started if the connection has been established with first WiFi.begin . If the connection cannot establish, switch to WIFI_AP_STA mode and activate SoftAP. Then DNS server starts. \n Parameters \n ssid SSID to be connected. \n passphrase Password for connection. \n timeout A time out value in milliseconds for waiting connection. \n Return value \n true Connection established, AutoConnect service started with WIFI_STA mode. \n false Could not connected, Captive portal started with WIFI_AP_STA mode.", "title": "begin" }, { @@ -342,7 +342,7 @@ }, { "location": "/api/index.html#handleclient", - "text": "void handleClient () Process the AutoConnect menu interface. The handleClient() function of the ESP8266WebServer/WebServer hosted by AutoConnect is also called from within AutoConnect and client requests contained in the user sketch handler are also handled.", + "text": "void handleClient () 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.", "title": "handleClient" }, { @@ -492,7 +492,7 @@ }, { "location": "/examples/index.html", - "text": "How to embed the AutoConnect\n\u00b6\n\n\nHere holds two case examples. Both examples perform the same function. Only how to incorporate the \nAutoConnect\n into the sketch differs. Also included in the sample folder, HandlePortal.ino also shows how to use the \nPageBuilder\n library for HTML assemblies.\n\n\nWhat does this example do?\n\u00b6\n\n\nUses the web interface to light the LED connected to the \nNodeMCU\n module D0 port (which could be referred to as \nBUILTIN_LED\n), the following animation is it.\n\n\nAccess to the ESP8266 module connected WiFi from the browser then the page contains the current value of the D0 port would be displayed. The page has the buttons to switch the port value. The LED blinks according to the value of the button that was clicked. This example is a typical sketch of manipulating ESP8266's GPIO via WLAN.\n\n\n\n\nEmbed AutoConnect library into this sketch. There are few places to be changed. And you can use AutoConnect's captive portal function to establish a connection freely to other WiFi spots.\n\n\nEmbed AutoConnect\n\u00b6\n\n\n Pattern A.\n\u00b6\n\n\nBind to ESP8266WebServer, performs handleClient with handleRequest.\n\n\n\n\n\n\nIn what situations should the handleRequest be used.\n\n\nIt is something needs to be done immediately after the handle client. It is better to call only AutoConnect::handleClient whenever possible.\n\n\n\n\n Pattern B.\n\u00b6\n\n\nDeclare only AutoConnect, performs handleClient.\n\n\n\n\nUsed with MQTT as a client application\n\u00b6\n\n\nThe effect of AutoConnect is not only for ESP8266 as the Web server. It has advantages for something WiFi client as well. For example, AutoConnect is also effective for publishing MQTT messages from various measurement points. Even if the SSID is different for each measurement point, it is not necessary to modify the sketch.\n\n\nThis example tries to publish the WiFi signal strength of ESP8266 with MQTT. It uses the \nThingSpeak\n for MQTT broker. ESP8266 publishes the RSSI value to the channel created on ThingSpeak as \nMQTT client\n. This example is well suited to demonstrate the usefulness of AutoConnect, as RSSI values are measured at each access point usually. Just adding a few lines of code makes it unnecessary to upload sketches with the different SSIDs rewrite for each access point.\n\n\n\n\nAdvance procedures\n\u00b6\n\n\n\n\nArduino Client for MQTT - It's the \nPubSubClient\n, install it to Arduino IDE. If you have the latest version already, this step does not need.\n\n\nCreate a channel on ThingSpeak.\n\n\nGet the Channel API Keys from ThingSpeak, put its keys to the sketch.\n\n\n\n\nThe ThingSpeak is the open IoT platform. It is capable of sending data privately to the cloud and analyzing, visualizing its data. If you do not have an account of ThingSpeak, you need that account to proceed further. ThingSpeak has the free plan for the account which uses within the scope of this example.\n1\n You can sign up with the \nThingSpeak sign-up page\n.\n\n\n\n\nWhether you should do sign-up or not.\n\n\nYou are entrusted with the final judgment of account creation for ThingSpeak. Create an account at your own risk.\n\n\n\n\nCreate a channel on ThingSpeak\n\u00b6\n\n\nSign in ThingSpeak. Select \nChannels\n to show the \nMy Channels\n, then click \nNew Channel\n.\n\n\nAt the \nNew Channel\n screen, enter each field as a below. And click \nSave Channel\n at the bottom of the screen to save.\n\n\n\n\nName: \nESP8266 Signal Strength\n\n\nDescription: \nESP8266 RSSI publish\n\n\nField1: \nRSSI\n\n\n\n\n\n\nGet Channel ID and API Keys\n\u00b6\n\n\nThe channel successfully created, you can see the channel status screen as a below. \nChannel ID\n is displayed there.\n2\n\n\n\n\nHere, switch the channel status tab to \nAPI Keys\n. The API key required to publish the message is the \nWrite API Key\n.\n\n\n\n\nThe last key you need is the \nUser API Key\n and can be confirmed it in the user profile. Pull down \nAccount\n from the top menu, select \nMy profile\n. Then you can see the ThingSpeak settings and the \nUser API Key\n is displayed middle of this screen.\n\n\n\n\nThe sketch, Publishes messages\n\u00b6\n\n\nThe complete code of the sketch is \nmqttRSSI.ino\n in the \nAutoConnect repository\n. Replace the following #define in a sketch with \nUser API Key\n, \nWrite API Key\n and \nChannel ID\n. After Keys updated, compile the sketch and upload it.\n\n\n#define MQTT_USER_KEY \"****************\" \n// Replace to User API Key.\n\n\n#define CHANNEL_ID \"******\" \n// Replace to Channel ID.\n\n\n#define CHANNEL_API_KEY_WR \"****************\" \n// Replace to the write API Key.\n\n\n\n\n\nPublish messages\n\u00b6\n\n\nAfter upload and reboot complete, the message publishing will start via the access point now set. The message carries RSSI as the current WiFi signal strength. The signal strength variations in RSSI are displayed on ThingSpeak's Channel status screen.\n\n\nHow embed to your sketches\n\u00b6\n\n\nFor the client sketches, the code required to connect to WiFi is the following four parts only.\n\n\n\n\n\n\n#include directive\n3\n\n\nInclude \nAutoConnect.h\n header file behind the include of \nESP8266WiFi.h\n.\n\n\n\n\n\n\n\n\nDeclare AutoConnect\n\n\nThe declaration of the \nAutoConnect variable\n is not accompanied by ESP8266WebServer.\n\n\n\n\n\n\n\n\nInvokes \"begin()\"\n\n\nCall \nAutoConnect::begin\n. If you need to assign a static IP address, executes \nAutoConnectConfig\n before that. \n\n\n\n\n\n\n\n\nPerforms \"handleClent()\" in \"loop()\"\n\n\nInvokes \nAutoConnect::handleClient()\n at inside \nloop()\n to enable the AutoConnect menu.\n\n\n\n\n\n\n\n\n\n window.onload = function() {\n Gifffer();\n }\n\n\n\n\n\n\n\n\n\n\n\n\nAs of March 21, 2018.\u00a0\n\u21a9\n\n\n\n\n\n\n'454951' in the example above, but your channel ID should be different.\u00a0\n\u21a9\n\n\n\n\n\n\n#include\n \n\n does not necessary for uses only client.\u00a0\n\u21a9", + "text": "How to embed the AutoConnect\n\u00b6\n\n\nHere holds two case examples. Both examples perform the same function. Only how to incorporate the \nAutoConnect\n into the sketch differs. Also included in the sample folder, HandlePortal.ino also shows how to use the \nPageBuilder\n library for HTML assemblies.\n\n\nWhat does this example do?\n\u00b6\n\n\nUses the web interface to light the LED connected to the \nNodeMCU\n module D0 port (which could be referred to as \nBUILTIN_LED\n), the following animation is it.\n\n\nAccess to the ESP8266 module connected WiFi from the browser then the page contains the current value of the D0 port would be displayed. The page has the buttons to switch the port value. The LED blinks according to the value of the button that was clicked. This example is a typical sketch of manipulating ESP8266's GPIO via WLAN.\n\n\n\n\nEmbed AutoConnect library into this sketch. There are few places to be changed. And you can use AutoConnect's captive portal function to establish a connection freely to other WiFi spots.\n\n\nEmbed AutoConnect\n\u00b6\n\n\n Pattern A.\n\u00b6\n\n\nBind to ESP8266WebServer, performs handleClient with handleRequest.\n\n\n\n\n\n\nIn what situations should the handleRequest be used.\n\n\nIt is something needs to be done immediately after the handle client. It is better to call only AutoConnect::handleClient whenever possible.\n\n\n\n\n Pattern B.\n\u00b6\n\n\nDeclare only AutoConnect, performs handleClient.\n\n\n\n\nUsed with MQTT as a client application\n\u00b6\n\n\nThe effect of AutoConnect is not only for ESP8266/ESP32 as the web server. It has advantages for something WiFi client as well. For example, AutoConnect is also effective for publishing MQTT messages from various measurement points. Even if the SSID is different for each measurement point, it is not necessary to modify the sketch.\n\n\nThis example tries to publish the WiFi signal strength of ESP8266 with MQTT. It uses the \nThingSpeak\n for MQTT broker. ESP8266 publishes the RSSI value to the channel created on ThingSpeak as \nMQTT client\n. This example is well suited to demonstrate the usefulness of AutoConnect, as RSSI values are measured at each access point usually. Just adding a few lines of code makes it unnecessary to upload sketches with the different SSIDs rewrite for each access point.\n\n\n\n\nAdvance procedures\n\u00b6\n\n\n\n\nArduino Client for MQTT - It's the \nPubSubClient\n, install it to Arduino IDE. If you have the latest version already, this step does not need.\n\n\nCreate a channel on ThingSpeak.\n\n\nGet the Channel API Keys from ThingSpeak, put its keys to the sketch.\n\n\n\n\nThe ThingSpeak is the open IoT platform. It is capable of sending data privately to the cloud and analyzing, visualizing its data. If you do not have an account of ThingSpeak, you need that account to proceed further. ThingSpeak has the free plan for the account which uses within the scope of this example.\n1\n You can sign up with the \nThingSpeak sign-up page\n.\n\n\n\n\nWhether you should do sign-up or not.\n\n\nYou are entrusted with the final judgment of account creation for ThingSpeak. Create an account at your own risk.\n\n\n\n\nCreate a channel on ThingSpeak\n\u00b6\n\n\nSign in ThingSpeak. Select \nChannels\n to show the \nMy Channels\n, then click \nNew Channel\n.\n\n\nAt the \nNew Channel\n screen, enter each field as a below. And click \nSave Channel\n at the bottom of the screen to save.\n\n\n\n\nName: \nESP8266 Signal Strength\n\n\nDescription: \nESP8266 RSSI publish\n\n\nField1: \nRSSI\n\n\n\n\n\n\nGet Channel ID and API Keys\n\u00b6\n\n\nThe channel successfully created, you can see the channel status screen as a below. \nChannel ID\n is displayed there.\n2\n\n\n\n\nHere, switch the channel status tab to \nAPI Keys\n. The API key required to publish the message is the \nWrite API Key\n.\n\n\n\n\nThe last key you need is the \nUser API Key\n and can be confirmed it in the user profile. Pull down \nAccount\n from the top menu, select \nMy profile\n. Then you can see the ThingSpeak settings and the \nUser API Key\n is displayed middle of this screen.\n\n\n\n\nThe sketch, Publishes messages\n\u00b6\n\n\nThe complete code of the sketch is \nmqttRSSI.ino\n in the \nAutoConnect repository\n. Replace the following #define in a sketch with \nUser API Key\n, \nWrite API Key\n and \nChannel ID\n. After Keys updated, compile the sketch and upload it.\n\n\n#define MQTT_USER_KEY \"****************\" \n// Replace to User API Key.\n\n\n#define CHANNEL_ID \"******\" \n// Replace to Channel ID.\n\n\n#define CHANNEL_API_KEY_WR \"****************\" \n// Replace to the write API Key.\n\n\n\n\n\nPublish messages\n\u00b6\n\n\nAfter upload and reboot complete, the message publishing will start via the access point now set. The message carries RSSI as the current WiFi signal strength. The signal strength variations in RSSI are displayed on ThingSpeak's Channel status screen.\n\n\nHow embed to your sketches\n\u00b6\n\n\nFor the client sketches, the code required to connect to WiFi is the following four parts only.\n\n\n\n\n\n\n#include directive\n3\n\n\nInclude \nAutoConnect.h\n header file behind the include of \nESP8266WiFi.h\n.\n\n\n\n\n\n\n\n\nDeclare AutoConnect\n\n\nThe declaration of the \nAutoConnect variable\n is not accompanied by ESP8266WebServer.\n\n\n\n\n\n\n\n\nInvokes \"begin()\"\n\n\nCall \nAutoConnect::begin\n. If you need to assign a static IP address, executes \nAutoConnectConfig\n before that. \n\n\n\n\n\n\n\n\nPerforms \"handleClent()\" in \"loop()\"\n\n\nInvokes \nAutoConnect::handleClient()\n at inside \nloop()\n to enable the AutoConnect menu.\n\n\n\n\n\n\n\n\n\n window.onload = function() {\n Gifffer();\n }\n\n\n\n\n\n\n\n\n\n\n\n\nAs of March 21, 2018.\u00a0\n\u21a9\n\n\n\n\n\n\n'454951' in the example above, but your channel ID should be different.\u00a0\n\u21a9\n\n\n\n\n\n\n#include\n \n\n does not necessary for uses only client.\u00a0\n\u21a9", "title": "Examples" }, { @@ -522,7 +522,7 @@ }, { "location": "/examples/index.html#used-with-mqtt-as-a-client-application", - "text": "The effect of AutoConnect is not only for ESP8266 as the Web server. It has advantages for something WiFi client as well. For example, AutoConnect is also effective for publishing MQTT messages from various measurement points. Even if the SSID is different for each measurement point, it is not necessary to modify the sketch. This example tries to publish the WiFi signal strength of ESP8266 with MQTT. It uses the ThingSpeak for MQTT broker. ESP8266 publishes the RSSI value to the channel created on ThingSpeak as MQTT client . This example is well suited to demonstrate the usefulness of AutoConnect, as RSSI values are measured at each access point usually. Just adding a few lines of code makes it unnecessary to upload sketches with the different SSIDs rewrite for each access point.", + "text": "The effect of AutoConnect is not only for ESP8266/ESP32 as the web server. It has advantages for something WiFi client as well. For example, AutoConnect is also effective for publishing MQTT messages from various measurement points. Even if the SSID is different for each measurement point, it is not necessary to modify the sketch. This example tries to publish the WiFi signal strength of ESP8266 with MQTT. It uses the ThingSpeak for MQTT broker. ESP8266 publishes the RSSI value to the channel created on ThingSpeak as MQTT client . This example is well suited to demonstrate the usefulness of AutoConnect, as RSSI values are measured at each access point usually. Just adding a few lines of code makes it unnecessary to upload sketches with the different SSIDs rewrite for each access point.", "title": "Used with MQTT as a client application" }, { diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 2a6ed8c..6af81aa 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -4,7 +4,7 @@ https://Hieromon.github.io/AutoConnect//index.html - 2018-09-14 + 2018-09-18 daily @@ -12,7 +12,7 @@ https://Hieromon.github.io/AutoConnect//gettingstarted/index.html - 2018-09-14 + 2018-09-18 daily @@ -20,7 +20,7 @@ https://Hieromon.github.io/AutoConnect//menu/index.html - 2018-09-14 + 2018-09-18 daily @@ -28,7 +28,7 @@ https://Hieromon.github.io/AutoConnect//basicusage/index.html - 2018-09-14 + 2018-09-18 daily @@ -36,7 +36,7 @@ https://Hieromon.github.io/AutoConnect//advancedusage/index.html - 2018-09-14 + 2018-09-18 daily @@ -44,7 +44,7 @@ https://Hieromon.github.io/AutoConnect//api/index.html - 2018-09-14 + 2018-09-18 daily @@ -52,7 +52,7 @@ https://Hieromon.github.io/AutoConnect//examples/index.html - 2018-09-14 + 2018-09-18 daily @@ -60,7 +60,7 @@ https://Hieromon.github.io/AutoConnect//faq/index.html - 2018-09-14 + 2018-09-18 daily @@ -68,7 +68,7 @@ https://Hieromon.github.io/AutoConnect//changelog/index.html - 2018-09-14 + 2018-09-18 daily @@ -76,7 +76,7 @@ https://Hieromon.github.io/AutoConnect//license/index.html - 2018-09-14 + 2018-09-18 daily diff --git a/mkdocs/api.md b/mkdocs/api.md index 1284533..c7bd30a 100644 --- a/mkdocs/api.md +++ b/mkdocs/api.md @@ -64,15 +64,14 @@ The [**handleClient**](api.md#handleclient) function of AutoConnect can include bool begin() ``` ```cpp -bool begin(const char* ssid, const char* passphraase) +bool begin(const char* ssid, const char* passphrase) ``` ```cpp -bool begin(const char* ssid, const char* passphraase, unsigned long timeout) +bool begin(const char* ssid, const char* passphrase, unsigned long timeout) ``` -Starts establishing the WiFi connection. -AutoConnect first invokes *WiFi.begin*. If the case of SSID and Password missing, its *WiFi.begin* has no SSID and Password. The WiFi mode at this time is WIFI_STA. Then ESP8266WebServer/WebServer will be started immediately after the first *WiFi.begin* regardless of the result. - +Starts establishing the WiFi connection. The WiFi mode at this time is WIFI_STA. +AutoConnect first invokes *WiFi.begin*. If the *ssid* and the *passphrase* are missing, its *WiFi.begin* has no SSID and Password. Regardless of the result, ESP8266WebServer/WebServer will start immediately after the first *WiFi.begin*. The captive portal will not be started if the connection has been established with first *WiFi.begin*. If the connection cannot establish, switch to WIFI_AP_STA mode and activate SoftAP. Then DNS server starts.
**Parameters**
@@ -121,7 +120,7 @@ Stops AutoConnect captive portal service. Release ESP8266WebServer/WebServer and void handleClient() ``` -Process the AutoConnect menu interface. The handleClient() function of the ESP8266WebServer/WebServer hosted by AutoConnect is also called from within AutoConnect and client requests contained in the user sketch handler are also handled. +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. #### handleRequest diff --git a/mkdocs/basicusage.md b/mkdocs/basicusage.md index 546ba59..f906318 100644 --- a/mkdocs/basicusage.md +++ b/mkdocs/basicusage.md @@ -32,16 +32,16 @@ Replacement the **handleClient** method is not indispensable. AutoConnect can st !!! note "" 1. Include headers, `ESP8266WebServer.h`/`WebServer.h` and `AutoConnect.h` - 2. Declare ESP8266WebServer variable. - 3. Declare AutoConnect variable. - 4. Implements the URL handler with the *function()*. + 2. Declare an ESP8266WebServer variable for ESP8266 or a WebServer variable for ESP32. + 3. Declare an AutoConnect variable. + 4. Implement the URL handlers provided for the `on` method of ESP8266WebServer/WebServer with the *function()*. 5. setup() - 5.1 Sets URL handler *function()* to ESP8266WebServer/WebServer by`ESP8266WebServer::on`/`WebServer::on`. + 5.1 Sets URL handler the *function()* to ESP8266WebServer/WebServer by`ESP8266WebServer::on`/`WebServer::on`. 5.2 Starts `AutoConnect::begin()`. 5.3 Check WiFi connection status. 6. loop() - 6.1 Invokes `AutoConnect::handleClient()`, or invokes `ESP8266WebServer::handleClient()`/`WebServer::handleClient` then `AutoConnect::handleRequest()`. - 6.2 Do the process for actual sketch. + 6.1 Do the process for actual sketch. + 6.2 Invokes `AutoConnect::handleClient()`, or invokes `ESP8266WebServer::handleClient()`/`WebServer::handleClient` then `AutoConnect::handleRequest()`. #### 2. Declare AutoConnect object @@ -67,10 +67,10 @@ AutoConnect internally performs *WiFi.begin* to establish a WiFi connection. The #### 4. Alternate ESP8266WebServer::begin() and WebServer::begin() -[*AutoConnect::begin*](api.md#begin) executes *ESP8266WebServer::begin*/*WebServer::begin* internally too and it starts the DNS server to behave as a Captive portal. So it is not needed to call *ESP8266WebServer::begin*/*WebServer::begin* with the sketch. +[*AutoConnect::begin*](api.md#begin) executes *ESP8266WebServer::begin*/*WebServer::begin* internally too and it starts the DNS server to behave as a Captive portal. So it is not needed to call *ESP8266WebServer::begin*/*WebServer::begin* in the sketch. !!! info "Why DNS Server starts" - AutoConnect traps the detection of the captive portal and achieves a connection with the WLAN interactively by the AutoConnect menu. It responds SoftAP address to all DNS queries temporarily to trap. When the WLAN connection establishes, then stops DNS server. + AutoConnect traps the detection of the captive portal and achieves a connection with the WLAN interactively by the AutoConnect menu. It responds SoftAP address to all DNS queries temporarily to trap. Once a WiFi connection establishes, the DNS server contributed by AutoConnect stops. #### 5. AutoConnect::begin with SSID and Password @@ -90,7 +90,7 @@ The interoperable process with an ESP8266WebServer/WebServer depends on the para Declaration parameter for the constructor | Use ESP8266WebServer::handleClient or WebServer::handleClient only | Use AutoConnect::handleClient ----|----|--- -[None](api.md#constructors) | AutoConnect menu not available.
To use AutoConnect menu, need [AutoConnect::handleRequest()](api.md#handlerequest).
also to use ESP8266WebServer/WebServer natively, need [AutoConnect::host()](api.md#host). | AutoConnect menu available.
To use ESP8266WebServer natively, need [AutoConnect::host()](api.md#host). +[None](api.md#constructors) | AutoConnect menu not available.
To use AutoConnect menu, need [AutoConnect::handleRequest()](api.md#handlerequest).
also to use ESP8266WebServer/WebServer natively, need [AutoConnect::host()](api.md#host). | AutoConnect menu available.
To use ESP8266WebServer/WebServer natively, need [AutoConnect::host()](api.md#host). [Reference to ESP8266WebServer/WebServer](api.md#withparameter) | AutoConnect menu not available.
To use AutoConnect menu, need [AutoConnect::handleRequest()](api.md#handlerequest). | AutoConnect menu available. - **By declaration for the AutoConnect variable with no parameter**: The ESP8266WebServer/WebServer instance is hosted by AutoConnect automatically then the sketches use [*AutoConnect::host*](api.md#host) as API to get it after [*AutoConnect::begin*](api.md#begin) performed. diff --git a/mkdocs/examples.md b/mkdocs/examples.md index 1dbbd6c..808346c 100644 --- a/mkdocs/examples.md +++ b/mkdocs/examples.md @@ -31,7 +31,7 @@ Declare only AutoConnect, performs handleClient. ## Used with MQTT as a client application -The effect of AutoConnect is not only for ESP8266 as the Web server. It has advantages for something WiFi client as well. For example, AutoConnect is also effective for publishing MQTT messages from various measurement points. Even if the SSID is different for each measurement point, it is not necessary to modify the sketch. +The effect of AutoConnect is not only for ESP8266/ESP32 as the web server. It has advantages for something WiFi client as well. For example, AutoConnect is also effective for publishing MQTT messages from various measurement points. Even if the SSID is different for each measurement point, it is not necessary to modify the sketch. This example tries to publish the WiFi signal strength of ESP8266 with MQTT. It uses the [ThingSpeak](https://thingspeak.com/) for MQTT broker. ESP8266 publishes the RSSI value to the channel created on ThingSpeak as [MQTT client](https://github.com/knolleary/pubsubclient). This example is well suited to demonstrate the usefulness of AutoConnect, as RSSI values are measured at each access point usually. Just adding a few lines of code makes it unnecessary to upload sketches with the different SSIDs rewrite for each access point. diff --git a/mkdocs/gettingstarted.md b/mkdocs/gettingstarted.md index c8f0b4a..07d72be 100644 --- a/mkdocs/gettingstarted.md +++ b/mkdocs/gettingstarted.md @@ -32,13 +32,13 @@ void loop() { ``` !!! note "" - The above code can be applied to ESP8266. To apply to ESP32, replace ```ESP8266WebServer``` class with ```WebServer``` and include ```WiFi.h``` and ```WebServer.h``` appropriately. + The above code can be applied to ESP8266. To apply to ESP32, replace ```ESP8266WebServer``` class with ```WebServer``` and include ```WiFi.h``` and ```WebServer.h``` of arduino-esp32 appropriately. ### Run at first After about 30 seconds, if the ESP8266 cannot connect to nearby Wi-Fi spot, you pull out your smartphone and open *Wi-Fi settings* from the *Settings* Apps. You can see the **esp8266ap** [^1] in the list of *"CHOOSE A NETWORK..."*. Then tap the esp8266ap and enter password **12345678**, a something screen pops up automatically as shown below. -[^1]:When applied to ESP32, **esp32ap** +[^1]:When applied to ESP32, SSID will appear as **esp32ap**. diff --git a/mkdocs/menu.md b/mkdocs/menu.md index 3fec5d6..4ebf38e 100644 --- a/mkdocs/menu.md +++ b/mkdocs/menu.md @@ -3,11 +3,11 @@ ## Where the from -The AutoConnect menu appears when you access the **AutoConnect root path**. It is assigned "**/_ac**" located on ESP8266/ESP32 *local IP address* by default. This location can be changed in the sketch. The following screen will appear at access to `http://{localIP}/_ac` as the root path. This is the statistics of the current WiFi connection. You can access the menu from the here, to invoke it tap at right on top. (e.g. `http://192.168.244.1/_ac` for SoftAP mode.) +The AutoConnect menu appears when you access the **AutoConnect root path**. It is assigned "**/_ac**" located on the *local IP address* of ESP8266/ESP32 module by default. This location can be changed in the sketch. The following screen will appear at access to `http://{localIP}/_ac` as the root path. This is the statistics of the current WiFi connection. You can access the menu from the here, to invoke it tap at right on top. (e.g. `http://192.168.244.1/_ac` for SoftAP mode.) -!!! note "What's local IP?" +!!! note "What's the local IP?" A local IP means Local IP at connection established or SoftAP's IP. ## Right on top @@ -24,14 +24,14 @@ Currently, AutoConnect supports four menus. Undermost menu as "HOME" returns to ## Configure new AP -Scan all available access point and display it. Strength and security of the detected AP are marked. The is indicated for the SSID that needs a security key. "**Hidden:**" means the number of hidden SSIDs discovered. -Enter SSID and Passphrase and tap "**apply**" to starts a connection. +Scan all available access point in the vicinity and display it. Strength and security of the detected AP are marked. The is indicated for the SSID that needs a security key. "**Hidden:**" means the number of hidden SSIDs discovered. +Enter SSID and Passphrase and tap "**apply**" to starts WiFi connection. ## Open SSIDs -Once it was established connection, its SSID and Password will be stored to the EEPROM of ESP8266/ESP32 automatically. The **Open SSIDs** menu reads the saved SSID credentials from the EEPROM. The stored credential data are listed by the SSID as shown below. Its label is a clickable button. Tap the SSID button, starts connection it. +Once it was established WiFi connection, its SSID and password will be saved in EEPROM of ESP8266/ESP32 automatically. The **Open SSIDs** menu reads the saved SSID credentials from the EEPROM. The stored credential data are listed by the SSID as shown below. Its label is a clickable button. Tap the SSID button, starts WiFi connection it. @@ -43,7 +43,7 @@ After tapping "Disconnect", you will not be able to reach the AutoConnect menu. ## Reset... -Reset the ESP8266/ESP32, it will start rebooting. After rebooting complete, the ESP8266/ESP32 module begins establishing the previous connection with WIFI_STA mode, and *esp8266ap* or *esp32ap* of an access point will disappear from WLAN. +Reset the ESP8266/ESP32 module, it will start rebooting. After rebooting complete, the ESP8266/ESP32 module begins establishing the previous connection with WIFI_STA mode, and *esp8266ap* or *esp32ap* of an access point will disappear from WLAN.