Smart Camera ESP32
An AI-driven, real-time Sentry Turret platform leveraging asynchronous I/O and computer vision to deliver high-precision autonomous motion tracking on resource-constrained embedded hardware.
Loading...
Searching...
No Matches
HttpServer Class Reference

Manages the ESP32-CAM web interface and control API. More...

#include <turret_server.h>

Public Member Functions

bool start (Camera *camera, BaseDetectionModule *detection=nullptr)
 Configures and launches the web server on port 80.
 
void stop ()
 Shut down the server and unregister all URI handlers.
 

Static Public Member Functions

static esp_err_t index_handler (httpd_req_t *req)
 HTTP handler for the root ("/") URI. This method is called by the ESP HTTP server whenever a client accesses the root IP address. It serves the primary web interface stored in Flash memory.
 

Detailed Description

Manages the ESP32-CAM web interface and control API.

This class wraps the ESP-IDF HTTP server component. It provides a video stream endpoint and a command endpoint for remote movement.

Member Function Documentation

◆ index_handler()

esp_err_t HttpServer::index_handler ( httpd_req_t * req)
static

HTTP handler for the root ("/") URI. This method is called by the ESP HTTP server whenever a client accesses the root IP address. It serves the primary web interface stored in Flash memory.

HTTP GET handler for the root ("/") URI. This function serves the primary web interface of the turret. To optimize memory usage and transmission speed, it sends a Gzip-compressed HTML payload.

Parameters
reqPointer to the HTTP request object containing session data.
Returns
esp_err_t Returns ESP_OK if the response was sent successfully, otherwise returns an error code from the underlying HTTP server.
See also
index_html.h
Parameters
[in]reqPointer to the HTTP request context provided by the ESP-IDF server.
Returns
  • ESP_OK: The index page was sent successfully.
  • ESP_FAIL: There was an error sending the response.
  • ESP_ERR_HTTPD_RESP_SEND: Specifically indicates a failure in the response send call.

◆ start()

bool HttpServer::start ( Camera * camera,
BaseDetectionModule * detection = nullptr )

Configures and launches the web server on port 80.

Parameters
cameraPointer to the initialized Camera object for streaming.
detectionOptional pointer to detection module for motion visualization.
Returns
true if the server was created and handlers were registered.

The documentation for this class was generated from the following files: