#ifndef HTTP_SERVER_H #define HTTP_SERVER_H #include "esp_err.h" #include "esp_http_server.h" /** * @brief Initialize and start the HTTP server * * Sets up all URI handlers and starts the web server on the configured port. * Provides a REST API for motor control and a web interface. * * @return ESP_OK on success, ESP_FAIL on error */ esp_err_t http_server_init(void); /** * @brief Stop the HTTP server * * Gracefully shuts down the HTTP server and frees resources. * * @return ESP_OK on success, ESP_FAIL on error */ esp_err_t http_server_stop(void); /** * @brief Check if HTTP server is running * * @return true if server is running, false otherwise */ bool http_server_is_running(void); /** * @brief Get the HTTP server handle * * Returns the internal server handle for advanced operations. * Can return NULL if server is not running. * * @return HTTP server handle or NULL */ httpd_handle_t http_server_get_handle(void); /** * @brief Get server statistics * * Provides information about server performance and usage. * * @param total_requests Pointer to store total request count * @param active_connections Pointer to store current active connections * @param last_request_time Pointer to store timestamp of last request * @return ESP_OK on success, ESP_ERR_INVALID_ARG if pointers are NULL */ esp_err_t http_server_get_stats(uint32_t* total_requests, uint32_t* active_connections, uint32_t* last_request_time); /** * @brief Reset server statistics * * Resets all server statistics counters to zero. * * @return ESP_OK on success */ esp_err_t http_server_reset_stats(void); #endif // HTTP_SERVER_H