From 3996367bceb2ca3f68bcb9cf6639e48bd2a62718 Mon Sep 17 00:00:00 2001 From: Hieromon Ikasamo Date: Mon, 26 Mar 2018 11:42:12 +0900 Subject: [PATCH] Revised API description. --- docs/api/index.html | 17 ++++++++++------- docs/search/search_index.json | 12 ++++++------ docs/sitemap.xml | 20 ++++++++++---------- mkdocs/api.md | 19 ++++++++++++------- 4 files changed, 38 insertions(+), 30 deletions(-) diff --git a/docs/api/index.html b/docs/api/index.html index 0fb4a0b..b7ffd52 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -1128,11 +1128,12 @@

-

AutoConnect default constructor. This entry activates WebServer internally and the web server is allocated internal.

+

AutoConnect default constructor. This entry internally allocates the ESP8266WebServer and is activated internally.

AutoConnect(ESP8266WebServer& webServer)
 
-

Run the AutoConnect site using the externally ensured ESP 8266 WebServer. User's added URI handler response can be included in handleClient method. +

Run the AutoConnect site using the externally ensured ESP8266WebServer.

+

The handleClient function of AutoConnect can include the response of the URI handler added by the user using the "on" function of ESP8266WebServer. If ESP8266WebServer is assigned internally by AutoConnect, the sketch can obtain that reference with the host function.

Parameters
webServerA reference of ESP8266WebServer instance.
@@ -1145,7 +1146,9 @@
bool begin(const char* ssid, const char* passphraase, unsinged long timeout)
 

-

Starts establishing WiFi connection. Before establishing, start the Web server and DNS server for the captive portal. Then begins connection establishment in WIFI_STA mode. If connection can not established with the specified SSID and password, switch to WIFI_AP_STA mode and activate SoftAP. +

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 will be started immediately after the first WiFi.beign 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.

Parameters
ssidSSID to be connected.
@@ -1160,10 +1163,10 @@
bool config(const char* ap, const char* password = nullptr)
 

-

Sets SoftAP's WiFi configuration. +

Set SoftAP's WiFi configuration and static IP configuration.

Parameters
-
configReference to AutoConnectConfig containing SoftAP's parameters.
+
configReference to AutoConnectConfig containing SoftAP's parameters and static IP parameters.
apSSID for SoftAP. The default value is esp8266ap.
passwordPassword for SodtAP. The default value is 12345678.
Return value
@@ -1183,7 +1186,7 @@
void handleClient()
 
-

Handling for the AutoConnect web interface. Invoke the handleClient of the parent web server to process client request of the AutoConnect WEB interface. No effects when the web server is not available.

+

Process the AutoConnect menu interface. It will be processed the client request too contained in the user sketch handler by calling the host handleClient::ESP8266WebServer from the Autoconnect internally.

handleRequest

void handleRequest()
 
@@ -1197,7 +1200,7 @@
void home(String uri)
 
-

Put a user site's home URI. The URI specified by home is linked from "HOME" in the AutoConnect portal menu. +

Put a user site's home URI. The URI specified by home is linked from "HOME" in the AutoConnect menu.

Parameters
uri A URI string of user site's home path.
diff --git a/docs/search/search_index.json b/docs/search/search_index.json index 98e9b34..ea2faa8 100644 --- a/docs/search/search_index.json +++ b/docs/search/search_index.json @@ -282,7 +282,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\nDefine 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 activates WebServer internally and the web server is allocated internal.\n\n\nAutoConnect\n(\nESP8266WebServer\n&\n \nwebServer\n)\n\n\n\n\n\nRun the AutoConnect site using the externally ensured ESP 8266 WebServer. User's added URI handler response can be included in handleClient method.\n\n\n \nParameters\n\n \nwebServer\nA reference of ESP8266WebServer 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 \nunsinged\n \nlong\n \ntimeout\n)\n\n\n\n\nStarts establishing WiFi connection. Before establishing, start the Web server and DNS server for the captive portal. Then begins connection establishment in WIFI_STA mode. If connection can not established with the specified SSID and password, switch to WIFI_AP_STA mode and activate SoftAP.\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\nSets SoftAP's WiFi configuration. \n\n\n \nParameters\n\n \nconfig\nReference to AutoConnectConfig containing SoftAP's parameters.\n\n \nap\nSSID for SoftAP. The default value is \nesp8266ap\n.\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 and DNSServer. \n\n\n\n\nAttention to end\n\n\nThe end function releases the instance of ESP8266WebServer 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\nHandling for the AutoConnect web interface. Invoke the handleClient of the parent web server to process client request of the AutoConnect WEB interface. No effects when the web server is not available.\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 ESP8266::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 portal 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 which is allocated in AutoConnect automatically.\n\n\nESP8266WebServer\n&\n \nhost\n()\n\n\n\n\n\n \nReturn value\n\n \nA reference of the ESP8266WebServer.\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\nvoid\n \nonNotFound\n(\nESP8266WebServer\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.\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\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.\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\nDefine 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 and is activated internally.\n\n\nAutoConnect\n(\nESP8266WebServer\n&\n \nwebServer\n)\n\n\n\n\n\nRun the AutoConnect site using the externally ensured ESP8266WebServer.\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. If ESP8266WebServer 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 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 \nunsinged\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 will be started immediately after the first \nWiFi.beign\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.\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 and DNSServer. \n\n\n\n\nAttention to end\n\n\nThe end function releases the instance of ESP8266WebServer 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. It will be processed the client request too contained in the user sketch handler by calling the host \nhandleClient::ESP8266WebServer\n from the Autoconnect internally.\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 ESP8266::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 which is allocated in AutoConnect automatically.\n\n\nESP8266WebServer\n&\n \nhost\n()\n\n\n\n\n\n \nReturn value\n\n \nA reference of the ESP8266WebServer.\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\nvoid\n \nonNotFound\n(\nESP8266WebServer\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.\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\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.\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" }, { @@ -312,7 +312,7 @@ }, { "location": "/api/index.html#autoconnect", - "text": "AutoConnect () AutoConnect default constructor. This entry activates WebServer internally and the web server is allocated internal. AutoConnect ( ESP8266WebServer & webServer ) Run the AutoConnect site using the externally ensured ESP 8266 WebServer. User's added URI handler response can be included in handleClient method. \n Parameters \n webServer A reference of ESP8266WebServer instance.", + "text": "AutoConnect () AutoConnect default constructor. This entry internally allocates the ESP8266WebServer and is activated internally. AutoConnect ( ESP8266WebServer & webServer ) Run the AutoConnect site using the externally ensured ESP8266WebServer. The handleClient function of AutoConnect can include the response of the URI handler added by the user using the \" on \" function of ESP8266WebServer. If ESP8266WebServer is assigned internally by AutoConnect, the sketch can obtain that reference with the host function. \n Parameters \n webServer A reference of ESP8266WebServer instance.", "title": "AutoConnect" }, { @@ -322,12 +322,12 @@ }, { "location": "/api/index.html#begin", - "text": "bool begin () bool begin ( const char * ssid , const char * passphraase ) bool begin ( const char * ssid , const char * passphraase , unsinged long timeout ) Starts establishing WiFi connection. Before establishing, start the Web server and DNS server for the captive portal. Then begins connection establishment in WIFI_STA mode. If connection can not established with the specified SSID and password, switch to WIFI_AP_STA mode and activate SoftAP. \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 * passphraase ) bool begin ( const char * ssid , const char * passphraase , unsinged 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 will be started immediately after the first WiFi.beign 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.", "title": "begin" }, { "location": "/api/index.html#config", - "text": "bool config ( AutoConnectConfig & config ) bool config ( const char * ap , const char * password = nullptr ) Sets SoftAP's WiFi configuration. \n Parameters \n config Reference to AutoConnectConfig containing SoftAP's parameters. \n ap SSID for SoftAP. The default value is esp8266ap . \n password Password for SodtAP. The default value is 12345678 . \n Return value \n true Successfully configured. \n false Configuration parameter is invalid, some values out of range.", + "text": "bool config ( AutoConnectConfig & config ) bool config ( const char * ap , const char * password = nullptr ) Set SoftAP's WiFi configuration and static IP configuration. \n Parameters \n config Reference to AutoConnectConfig containing SoftAP's parameters and static IP parameters. \n ap SSID for SoftAP. The default value is esp8266ap . \n password Password for SodtAP. The default value is 12345678 . \n Return value \n true Successfully configured. \n false Configuration parameter is invalid, some values out of range.", "title": "config" }, { @@ -337,7 +337,7 @@ }, { "location": "/api/index.html#handleclient", - "text": "void handleClient () Handling for the AutoConnect web interface. Invoke the handleClient of the parent web server to process client request of the AutoConnect WEB interface. No effects when the web server is not available.", + "text": "void handleClient () Process the AutoConnect menu interface. It will be processed the client request too contained in the user sketch handler by calling the host handleClient::ESP8266WebServer from the Autoconnect internally.", "title": "handleClient" }, { @@ -347,7 +347,7 @@ }, { "location": "/api/index.html#home", - "text": "void home ( String uri ) Put a user site's home URI. The URI specified by home is linked from \"HOME\" in the AutoConnect portal menu. \n Parameters \n uri A URI string of user site's home path.", + "text": "void home ( String uri ) Put a user site's home URI. The URI specified by home is linked from \"HOME\" in the AutoConnect menu. \n Parameters \n uri A URI string of user site's home path.", "title": "home" }, { diff --git a/docs/sitemap.xml b/docs/sitemap.xml index fea710a..c69c05a 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -4,7 +4,7 @@ https://Hieromon.github.io/AutoConnect//index.html - 2018-03-24 + 2018-03-26 daily @@ -12,7 +12,7 @@ https://Hieromon.github.io/AutoConnect//gettingstarted/index.html - 2018-03-24 + 2018-03-26 daily @@ -20,7 +20,7 @@ https://Hieromon.github.io/AutoConnect//menu/index.html - 2018-03-24 + 2018-03-26 daily @@ -28,7 +28,7 @@ https://Hieromon.github.io/AutoConnect//basicusage/index.html - 2018-03-24 + 2018-03-26 daily @@ -36,7 +36,7 @@ https://Hieromon.github.io/AutoConnect//advancedusage/index.html - 2018-03-24 + 2018-03-26 daily @@ -44,7 +44,7 @@ https://Hieromon.github.io/AutoConnect//api/index.html - 2018-03-24 + 2018-03-26 daily @@ -52,7 +52,7 @@ https://Hieromon.github.io/AutoConnect//examples/index.html - 2018-03-24 + 2018-03-26 daily @@ -60,7 +60,7 @@ https://Hieromon.github.io/AutoConnect//faq/index.html - 2018-03-24 + 2018-03-26 daily @@ -68,7 +68,7 @@ https://Hieromon.github.io/AutoConnect//changelog/index.html - 2018-03-24 + 2018-03-26 daily @@ -76,7 +76,7 @@ https://Hieromon.github.io/AutoConnect//license/index.html - 2018-03-24 + 2018-03-26 daily diff --git a/mkdocs/api.md b/mkdocs/api.md index 0e6f4a0..6ba37b1 100644 --- a/mkdocs/api.md +++ b/mkdocs/api.md @@ -34,13 +34,15 @@ AutoConnect() -AutoConnect default constructor. This entry activates WebServer internally and the web server is allocated internal. +AutoConnect default constructor. This entry internally allocates the ESP8266WebServer and is activated internally. ```cpp AutoConnect(ESP8266WebServer& webServer) ``` -Run the AutoConnect site using the externally ensured ESP 8266 WebServer. User's added URI handler response can be included in handleClient method. +Run the AutoConnect site using the externally ensured ESP8266WebServer. + +The [**handleClient**](api.md#handleclient) function of AutoConnect can include the response of the URI handler added by the user using the "*on*" function of ESP8266WebServer. If ESP8266WebServer is assigned internally by AutoConnect, the sketch can obtain that reference with the [**host**](api.me#host) function.
**Parameters**
webServerA reference of ESP8266WebServer instance.
@@ -60,7 +62,10 @@ bool begin(const char* ssid, const char* passphraase) bool begin(const char* ssid, const char* passphraase, unsinged long timeout) ``` -Starts establishing WiFi connection. Before establishing, start the Web server and DNS server for the captive portal. Then begins connection establishment in WIFI_STA mode. If connection can not established with the specified SSID and password, switch to WIFI_AP_STA mode and activate SoftAP. +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 will be started immediately after the first *WiFi.beign* 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.
**Parameters**
ssidSSID to be connected.
@@ -80,10 +85,10 @@ bool config(AutoConnectConfig& config) bool config(const char* ap, const char* password = nullptr) ``` -Sets SoftAP's WiFi configuration. +Set SoftAP's WiFi configuration and static IP configuration.
**Parameters**
-
configReference to AutoConnectConfig containing SoftAP's parameters.
+
configReference to [**AutoConnectConfig**](api.md#autoconnectconfig) containing SoftAP's parameters and static IP parameters.
apSSID for SoftAP. The default value is **esp8266ap**.
passwordPassword for SodtAP. The default value is **12345678**.
**Return value**
@@ -108,7 +113,7 @@ Stops AutoConnect captive portal service. Release ESP8266WebServer and DNSServer void handleClient() ``` -Handling for the AutoConnect web interface. Invoke the handleClient of the parent web server to process client request of the AutoConnect WEB interface. No effects when the web server is not available. +Process the AutoConnect menu interface. It will be processed the client request too contained in the user sketch handler by calling the host *handleClient::ESP8266WebServer* from the Autoconnect internally. #### handleRequest @@ -127,7 +132,7 @@ Handling for the AutoConnect menu request. void home(String uri) ``` -Put a user site's home URI. The URI specified by home is linked from "HOME" in the AutoConnect portal menu. +Put a user site's home URI. The URI specified by home is linked from "HOME" in the AutoConnect menu.
**Parameters**
uri A URI string of user site's home path.