ESP32-S3 firmware acting as BMC for another board, controlling an ATX power supply and providing access to UART. Co-authored with GLM-5
62 lines
1.4 KiB
C
62 lines
1.4 KiB
C
#ifndef WEB_SERVER_H
|
|
#define WEB_SERVER_H
|
|
|
|
#include "esp_err.h"
|
|
#include "esp_http_server.h"
|
|
|
|
// ============================================================================
|
|
// Function Declarations
|
|
// ============================================================================
|
|
|
|
/**
|
|
* @brief Initialize and start the web server
|
|
*
|
|
* Starts the HTTP server and registers all URI handlers.
|
|
*
|
|
* @return ESP_OK on success, error code otherwise
|
|
*/
|
|
esp_err_t web_server_start(void);
|
|
|
|
/**
|
|
* @brief Stop the web server
|
|
*
|
|
* @return ESP_OK on success, error code otherwise
|
|
*/
|
|
esp_err_t web_server_stop(void);
|
|
|
|
/**
|
|
* @brief Check if web server is running
|
|
*
|
|
* @return true if running, false otherwise
|
|
*/
|
|
bool web_server_is_running(void);
|
|
|
|
/**
|
|
* @brief Get the server handle
|
|
*
|
|
* @return httpd_handle_t or NULL if not running
|
|
*/
|
|
httpd_handle_t web_server_get_handle(void);
|
|
|
|
// ============================================================================
|
|
// WebSocket Functions
|
|
// ============================================================================
|
|
|
|
/**
|
|
* @brief Broadcast data to all connected WebSocket clients
|
|
*
|
|
* @param data Data to send
|
|
* @param len Length of data
|
|
* @return ESP_OK on success, error code otherwise
|
|
*/
|
|
esp_err_t web_server_ws_broadcast(const uint8_t *data, size_t len);
|
|
|
|
/**
|
|
* @brief Get number of connected WebSocket clients
|
|
*
|
|
* @return Number of connected clients
|
|
*/
|
|
int web_server_ws_client_count(void);
|
|
|
|
#endif // WEB_SERVER_H
|