src/httpd.cpp
/**
 * @brief Creates 2 web servers. One for camera stream and the other for tank control
 *
 */
@brief Creates 2 web servers. One for camera stream and the other for tank control
@brief Creates 2 web servers . One for camera stream and the other for tank control
void start_web_server()
{
    httpd_config_t config = HTTPD_DEFAULT_CONFIG();
    httpd_uri_t index_uri = {
        .uri = "/",
        .method = HTTP_GET,
        .handler = index_handler,
        .user_ctx = NULL};
    httpd_uri_t js_uri = {
        .uri = "/joy.js",
        .method = HTTP_GET,
        .handler = js_handler,
        .user_ctx = NULL};
    httpd_uri_t cmd_uri = {
        .uri = "/control",
        .method = HTTP_GET,
        .handler = cmd_handler,
        .user_ctx = NULL};
    httpd_uri_t aux_uri = {
        .uri = "/aux",
        .method = HTTP_GET,
        .handler = aux_handler,
        .user_ctx = NULL};
    httpd_uri_t status_uri = {
        .uri = "/status",
        .method = HTTP_GET,
        .handler = status_handler,
        .user_ctx = NULL};
    httpd_uri_t stream_uri = {
        .uri = "/stream",
        .method = HTTP_GET,
        .handler = stream_handler,
        .user_ctx = NULL};
    log_i("Starting web server on port: '%d'", config.server_port);
    if (httpd_start(&control_httpd, &config) == ESP_OK)
    {
        httpd_register_uri_handler(control_httpd, &index_uri);
        httpd_register_uri_handler(control_httpd, &js_uri);
        httpd_register_uri_handler(control_httpd, &cmd_uri);
        httpd_register_uri_handler(control_httpd, &aux_uri);
        httpd_register_uri_handler(control_httpd, &status_uri);
    }
    config.server_port += 1;
    config.ctrl_port += 1;
    log_i("Starting stream server on port: '%d'", config.server_port);
    if (httpd_start(&stream_httpd, &config) == ESP_OK)
    {
        httpd_register_uri_handler(stream_httpd, &stream_uri);
    }
}
void start_web_server ( ) { httpd_config_t config = HTTPD_DEFAULT_CONFIG ( ) ; httpd_uri_t index_uri = { . uri = " " , . method = HTTP_GET , . handler = index_handler , . user_ctx = NULL } ; httpd_uri_t js_uri = { . uri = " " , . method = HTTP_GET , . handler = js_handler , . user_ctx = NULL } ; httpd_uri_t cmd_uri = { . uri = " " , . method = HTTP_GET , . handler = cmd_handler , . user_ctx = NULL } ; httpd_uri_t aux_uri = { . uri = " " , . method = HTTP_GET , . handler = aux_handler , . user_ctx = NULL } ; httpd_uri_t status_uri = { . uri = " " , . method = HTTP_GET , . handler = status_handler , . user_ctx = NULL } ; httpd_uri_t stream_uri = { . uri = " " , . method = HTTP_GET , . handler = stream_handler , . user_ctx = NULL } ; log_i ( " " , config . server_port ) ; if ( httpd_start ( & control_httpd , & config ) == ESP_OK ) { httpd_register_uri_handler ( control_httpd , & index_uri ) ; httpd_register_uri_handler ( control_httpd , & js_uri ) ; httpd_register_uri_handler ( control_httpd , & cmd_uri ) ; httpd_register_uri_handler ( control_httpd , & aux_uri ) ; httpd_register_uri_handler ( control_httpd , & status_uri ) ; } config . server_port += 1 ; config . ctrl_port += 1 ; log_i ( " " , config . server_port ) ; if ( httpd_start ( & stream_httpd , & config ) == ESP_OK ) { httpd_register_uri_handler ( stream_httpd , & stream_uri ) ; } }
@brief Creates 2 web servers.
@brief Creates 2 web servers .