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 0000000..b5bc7af Binary files /dev/null and b/mkdocs/images/applymenu.png differ 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.