#include "http_server.h" #include #include #include #include #include #include #include "configuration.h" static httpd_handle_t __handle = NULL; static const char *TAG = "httpd"; extern void register_http_web_handlers(httpd_handle_t); extern void register_wifi_api_handlers(httpd_handle_t); extern void register_ais_api_handlers(httpd_handle_t); extern void register_nmea_api_handlers(httpd_handle_t); extern void register_sys_api_handlers(httpd_handle_t); void start_httpd() { httpd_config_t config = HTTPD_DEFAULT_CONFIG(); config.uri_match_fn = httpd_uri_match_wildcard; config.max_uri_handlers = 20; if (httpd_start(&__handle, &config) == ESP_OK) { register_http_web_handlers(__handle); register_wifi_api_handlers(__handle); register_ais_api_handlers(__handle); register_nmea_api_handlers(__handle); register_sys_api_handlers(__handle); ESP_LOGI(TAG, "Started HTTPD"); } } void stop_httpd() { if (__handle) { httpd_stop(__handle); __handle = NULL; ESP_LOGI(TAG, "Stopped HTTPD"); } } bool is_httpd_running() { return __handle != NULL; }