DynaConfig
DynaConfig is an Arduino library for managing WiFi configuration on ESP32 devices using a captive portal.
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
DynaConfig Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ DynaConfig()

DynaConfig::DynaConfig ( const char *  captivePortalName)

Construct a new DynaConfig object.

Parameters
captivePortalNameThe name of the captive portal.

Member Function Documentation

◆ checkWiFiConfig()

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.

◆ getConfigPasskey()

String DynaConfig::getConfigPasskey ( )

Retrieves the stored WiFi password from Preferences.

Returns
String The stored password.

◆ getConfigSSID()

String DynaConfig::getConfigSSID ( )

Retrieves the stored WiFi SSID from Preferences.

Returns
String The stored SSID.

◆ hasCredentials()

bool DynaConfig::hasCredentials ( )

Checks if WiFi credentials are stored in Preferences.

Returns
true If both SSID and password are stored.
false If either SSID or password is missing.

◆ removeCredentials()

bool DynaConfig::removeCredentials ( )

Removes stored WiFi credentials from Preferences.

Returns
true If the credentials were successfully removed.
false If the credentials could not be removed.

The documentation for this class was generated from the following files: