Added HTTP-API support, Standalone AP Support and Built-in Melodies

This commit is contained in:
2025-12-28 21:49:49 +02:00
parent 0f0b67cab9
commit db57b355b9
14 changed files with 1313 additions and 26 deletions

View File

@@ -0,0 +1,66 @@
/*
* ═══════════════════════════════════════════════════════════════════════════════════
* SETTINGSWEBSERVER.HPP - Network Mode Settings Web Interface
* ═══════════════════════════════════════════════════════════════════════════════════
*
* 🌐 SETTINGS WEB INTERFACE FOR VESPER 🌐
*
* Provides web interface for switching between AP and Station modes:
* • Accessible at http://192.168.4.1/settings (AP mode)
* • Accessible at http://{device-ip}/settings (Station mode)
* • Toggle between AP mode and Router mode
* • Configure WiFi credentials for router connection
* • Reboot device with new settings
*
* 🏗️ ARCHITECTURE:
* • Uses AsyncWebServer for non-blocking operation
* • HTML interface with toggle switch
* • Updates ConfigManager and triggers reboot
* • Works in both AP and Station modes
*
* 📡 ENDPOINTS:
* GET /settings - Settings page with mode toggle
* POST /api/set-mode - Set network mode (AP or STA)
* POST /api/reboot - Reboot device
*
* 📋 VERSION: 1.0
* 📅 DATE: 2025-12-28
* 👨‍💻 AUTHOR: Advanced Bell Systems
* ═══════════════════════════════════════════════════════════════════════════════════
*/
#pragma once
#include <Arduino.h>
#include <ESPAsyncWebServer.h>
// Forward declarations
class ConfigManager;
class Networking;
class SettingsWebServer {
public:
explicit SettingsWebServer(AsyncWebServer& server,
ConfigManager& configManager,
Networking& networking);
~SettingsWebServer();
/**
* @brief Initialize settings web server and register endpoints
*/
void begin();
private:
// Dependencies
AsyncWebServer& _server;
ConfigManager& _configManager;
Networking& _networking;
// Endpoint handlers
void handleSettingsPage(AsyncWebServerRequest* request);
void handleSetMode(AsyncWebServerRequest* request);
void handleReboot(AsyncWebServerRequest* request);
// HTML generation
String generateSettingsHTML();
};