// SPDX-License-Identifier: LGPL-3.0-or-later // ST4-ESP32: WiFi + WebSocket server (optional) // Enable by defining ST4_WIFI_ENABLED before including ST4.h #pragma once #ifdef ST4_WIFI_ENABLED #include #include #include #include "ST4Controller.h" struct ST4WiFiConfig { const char* ssid; const char* password; bool apMode; uint16_t httpPort; uint32_t broadcastIntervalMs; }; class ST4WiFi { ST4Controller* controller_; AsyncWebServer* server_; AsyncWebSocket* ws_; ST4WiFiConfig config_; uint32_t lastBroadcast_; ST4Direction lastRaDir_; ST4Direction lastDecDir_; void handleWebSocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len); void processCommand(AsyncWebSocketClient* client, uint8_t* data, size_t len); void broadcastState(); String stateJson() const; public: ST4WiFi(); ~ST4WiFi(); void begin(ST4Controller& controller, const ST4WiFiConfig& config); void update(); }; #endif // ST4_WIFI_ENABLED