DynaConfig
DynaConfig is an Arduino library for managing WiFi configuration on ESP32 devices using a captive portal.
|
Manages dynamic WiFi configuration through a captive portal. More...
#include <dynaconfig.h>
Public Member Functions | |
DynaConfig (const char *captivePortalName) | |
Construct a new DynaConfig object. | |
void | checkWiFiConfig () |
Checks and manages the WiFi configuration. | |
void | close () |
Closes the Preferences storage. | |
bool | hasCredentials () |
Checks if WiFi credentials are stored in Preferences. | |
bool | removeCredentials () |
Removes stored WiFi credentials from Preferences. | |
String | getConfigSSID () |
Retrieves the stored WiFi SSID from Preferences. | |
String | getConfigPasskey () |
Retrieves the stored WiFi password from Preferences. | |
Manages dynamic WiFi configuration through a captive portal.
The DynaConfig class sets up an ESP32 device as a WiFi access point with a captive portal. Users can connect to this portal to enter their WiFi credentials, which are then stored in non-volatile memory. The device attempts to connect to the configured WiFi network on subsequent startups.
DynaConfig::DynaConfig | ( | const char * | captivePortalName | ) |
Construct a new DynaConfig object.
captivePortalName | The name of the captive portal. |
void DynaConfig::checkWiFiConfig | ( | ) |
Checks and manages the WiFi configuration.
If the device has stored WiFi credentials, it stops the DNS server and HTTP server. If no credentials are found, it sets up the device as an access point and starts the captive portal for configuration.
String DynaConfig::getConfigPasskey | ( | ) |
Retrieves the stored WiFi password from Preferences.
String DynaConfig::getConfigSSID | ( | ) |
Retrieves the stored WiFi SSID from Preferences.
bool DynaConfig::hasCredentials | ( | ) |
Checks if WiFi credentials are stored in Preferences.
bool DynaConfig::removeCredentials | ( | ) |
Removes stored WiFi credentials from Preferences.