WiFi Network Settings Structure
WiFi Network Settings
Section titled “WiFi Network Settings”Path: src/WiFiNetworkSettings.h
Revision History:
- Initial documentation
A structure that encapsulates all WiFi network configuration parameters for both station (STA) mode and access point (AP) mode on ESP32 devices. This component provides a centralized way to manage WiFi connectivity settings, supporting static IP configuration, DNS settings, and dual-mode operation (AP+STA).
REQUIREMENTS
Section titled “REQUIREMENTS”- ESP32 hardware with WiFi capabilities
- Configuration file with WiFi credentials (
config.h
) - Arduino framework for ESP32
PROVIDES
Section titled “PROVIDES”WiFiNetworkSettings
- A struct that holds all WiFi configuration settings:- Station mode parameters (SSID, password, IP, gateway, subnet, DNS)
- Access point mode parameters (SSID, password, IP, gateway, subnet)
- Methods for loading/saving settings from/to JSON
- Debug printing functionality
FEATURES
Section titled “FEATURES”- Complete management of both station and access point WiFi parameters
- Default settings based on configuration constants
- JSON serialization and deserialization for persistence
- Structured logging and debug output
- Configurable static IP addressing for both STA and AP modes
- DNS server configuration
- Conditional compilation for AP+STA mode
DEPENDENCIES
Section titled “DEPENDENCIES”- Arduino.h - Core Arduino functionality
- IPAddress.h - IP address handling
- WString.h - String manipulation
- ArduinoJson.h - JSON parsing and generation
- ArduinoLog.h - Logging functionality
- config.h - Application configuration
- enums.h - Status code enumerations
- Logger.h - Custom logging wrapper
BEHAVIOUR
Section titled “BEHAVIOUR”PERFORMANCE
Section titled “PERFORMANCE”- Consider using static allocation for JSON documents to minimize heap fragmentation
- Optimize IP address parsing to reduce memory overhead
- Implement memory-efficient string handling for low-memory devices
SECURITY
Section titled “SECURITY”- Currently passwords are stored in plaintext; consider implementing secure storage
- Add optional encryption for network settings persistence
- Implement MAC address filtering capability for access point mode
- Add validation for minimum password strength
COMPLIANCE
Section titled “COMPLIANCE”- Ensure WiFi configuration complies with regional WiFi regulatory requirements
- Support WiFi Enterprise authentication methods (EAP-TLS, PEAP) for corporate environments
- Implement proper error handling and feedback for regulatory compliance
RECOMMENDATIONS
Section titled “RECOMMENDATIONS”- Use conditional compilation to reduce memory footprint when AP mode is not required
- Implement a method to validate network settings before applying them
- Consider adding support for WiFi Protected Setup (WPS) for easier connectivity
- Extend the structure to support multiple WiFi networks with priority ordering
- Add connection quality metrics and automatic reconnection strategies