From ac8b2e7f015d0d79c69df5db9c4671b772da09d4 Mon Sep 17 00:00:00 2001 From: Hieromon Ikasamo Date: Tue, 31 Mar 2020 18:00:55 +0900 Subject: [PATCH] Add AutoConnectConfig::applyMenu --- mkdocs/apiconfig.md | 24 ++++++++++++++++++++++++ mkdocs/images/applymenu.png | Bin 0 -> 6626 bytes mkdocs/menu.md | 20 ++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 mkdocs/images/applymenu.png diff --git a/mkdocs/apiconfig.md b/mkdocs/apiconfig.md index 83f314a..758e010 100644 --- a/mkdocs/apiconfig.md +++ b/mkdocs/apiconfig.md @@ -40,6 +40,30 @@ Sets IP address for Soft AP in captive portal. When AutoConnect fails the initia
IPAddressThe default value is **172.217.28.1**
+### applyMenu + +Configure applying items of the [AutoConnect menu](menu.md). You can arbitrarily combine valid menus by coordinating the applyMenu value. +
+
**Type**
+
uint16_tIt provides the combined **AC_MENUITEM_t** value of the item to apply to the AutoConnect menu.
Specify the value calculated from the **logical OR** by the AC_MENUITEM_t value of each item applied as a menu. It affects not only disappear the items from the menu also invalidates the URI they have. As a consequence, even if it accesses the URL directly will occur a 404 error.
The default value is logical OR of AC_MENUITEM_CONFIGNEW, AC_MENUITEM_OPENSSIDS, AC_MENUITEM_DISCONNECT, AC_MENUITEM_RESET and AC_MENUITEM_HOME.
+
**Value**
+
AC_MENUITEM_NONE No assign items except for the AutoConnectAux page item.
+
AC_MENUITEM_CONFIGNEW Appends [Configure new AP](menu.md#config-new-ap) item.
+
AC_MENUITEM_OPENSSIDS Appends [Open SSIDs](menu.md#open-ssids) item.
+
AC_MENUITEM_DISCONNECT Appends [Disconnect](menu.md#disconnect) item.
+
AC_MENUITEM_RESET Appends [Reset...](menu.md#reset) item.
+
AC_MENUITEM_HOME Appends [HOME](menu.md#home) item.
+
AC_MENUITEM_DEVINFO Appends the **Device info** item which links to [AutoConnect statistics page](menu.md##where-the-from).
+
+ +!!! info "How to specify the value of the menu items" + An applyMenu accepts the logical OR of AC_MENUITEM_t type value. For example, to enable only Open SSIDs and HOME items, specify: + ```cpp + AutoConnectConfig config; + config.applyMenu = AC_MENUITEM_OPENSSIDS | AC_MENUITEM_HOME; + ``` + However, even if you specify like the above, the AutoConnectAux page items still display on the menu. To remove the AutoConnectAux items, use the [AutoConnectAux::menu](apiaux.md#menu) function. + ### autoReconnect Automatically 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, *AutoConnect::begin()* function will attempt to reconnect to a known access point using credentials stored in the flash, even if the connection failed by current SSID. diff --git a/mkdocs/images/applymenu.png b/mkdocs/images/applymenu.png new file mode 100644 index 0000000000000000000000000000000000000000..b5bc7af2d2c8ae264b82428687eb72a90fe07d61 GIT binary patch literal 6626 zcma)B2UJs8*NrmDhzbK(Q9z{$2uKq_ij5{n4=of)q((rbgpOqp1OrMjNFSREW z8$clYB*91J*Ms1Qxa;aE@O2QbrG6W-$M{RF&yEI14n5Q`bB90&2-bj!Ac5qr1{3>%y1m$@<($qj8xmF%i*rD;oz~G zwtet&GwUlW6#_Y0hFwy;~c?Y;QeU*83 zKPF1g9g*$~@0pWkPGaR%9`Ri=t>@1vFNZE~?k?--=wy$agan4J*Gx`Nd$b1#ar7DoN(P!EFs@bod47zq&QpAEc=v9G4!|MvRiG#mL_s*SIJb3`-oAvb06 zu&IQEgcwZ5y5mHbO5Q7?vQ6C^vG}48-m1ox3tqW<^2K~aZ=%Cm!!%r8US8OH1IxuD zlYc8>yM4rn7%<1b8CMrH;8r-#`)(%O8Xq00m@mrAX3)c<#GkY=#;2sDB;%B!x*$Q< zVe6`*Jl*;z%glxsb~^xUvI_~Wk*zJ$1#Wm$r>m!&$;q9;Un|kGm(JtoH@;7aTpUen3EY19 zJnr*xH?6YSF6(zCR2CoaD&%6!wPT(uRflJp@z^F+@$T-rXXiD|H?1n7lJ6>|ze+m$ zK1bSa!Qt**e3H&?&)^x4x7NJSpa4_enUn2JLuTopZ_Z4RccZ;+$PMmMop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g5*hX7RUm^!LX_;0AD9{k;G#tiuM$-r9Ni zSw`xE+T2U>mk%0C%-`1}7Yc%lhKLm)834b;@CP4ZGf=h7WKRGYzyjFog!_B9Js6)W zczh^G!8=iaz>fZU#KPvK>n6<^n-rS^ zP)G<$H3H$D;w!Dt$I%3OG!3bVG6g>R+ZVuwA&u!CU12HY%b!3~M+P@QP_DjosUr9Npi^a+ zU0(lEwS*%`^+<)CYaQjvUrQP_V_h560-BsHV`)vNI~bh+x8ZR2;|5;YL-&P-n{S4$Ent`~KWOogVyd z209Z!XVE4c_Y{0w%sM|ZYMR&OUu; z>Z6eDn(At&9|&+6!3}&l#(55IpHq@+uB)gtEN%eS>qoE01X-GsUuSXt^Rr_h+7Dya zNL)c>0{l+?i+$QcJ+B$fOCMha|EI#54T8}iS|~K2mAoG1eC^mcrRWS_vxY&fp+4lK z-iO3)#1{gL=H#BcR#H*q`tnpk36<)VodyvKsBICgq0hYij6h-#!81|ZP|M<-4 z0g*snUq7*)xsIQQ(2uAgGBa%p5D3BV+K~B2f8pYv)cJGpHxB(9u>N$C|MZp$M(&6I zO11wF0#DxmzZUdAOy4;4@B$oCbJ-pk-39(X-RXZwqJK)k&m(_p-v4QlRdlo%`V(Bv zAqmkI+V|s$|I0Z);{B(;1|svfN1^|66$R4&)CHh!*>Yxe$ literal 0 HcmV?d00001 diff --git a/mkdocs/menu.md b/mkdocs/menu.md index 5702340..64556b6 100644 --- a/mkdocs/menu.md +++ b/mkdocs/menu.md @@ -76,6 +76,26 @@ A **HOME** item at the bottom of the menu list is a link to the home path, and t Also, you can change the HOME path using the AutoConnect API. The [**AutoConnect::home**](api.md#home) function sets the URI as a link of the HOME item in the AutoConnect menu. +## Applying the active menu items + +Each of the above menu items can be configured with a Sketch. [AutoConnectConfig::applyMenu](apiconfig.md#applymenu) specifies the menu items that will be enabled at runtime. +For example, by disabling the [Configure new AP](#configure-new-ap) and [Disconnect](#disconnect) item, you can prevent the configuration for unknown access points. + +```cpp +AutoConnect portal; +AutoConnectConfig config; + +void setup() { + config.applyMenu = AC_MENUITEM_OPENSSIDS | AC_MENUITEM_RESET | AC_MENUITEM_HOME; + portal.config(config); +} +``` +The result of executing the above Sketch is as below: + + + +Details for [AutoConnectConfig::applyMenu](apiconfig.md#applymenu). + ## Attaching to AutoConnect menu The AutoConnect menu can contain your sketch's web pages as extra items as a custom. It works for HTML pages implemented by the **ESP8266WebServer::on** handler or the **WebServer::on** handler for ESP32. That is, you can make them invoke the legacy web pages from the AutoConnect menu. The below screen-shot is the result of adding an example sketch for the ESP8266WebServer library known as [FSBrowser](https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/FSBrowser) to the AutoConnect menu item. It can add Edit and List items with little modification to the legacy sketch code.