25 lines
504 B
C++
25 lines
504 B
C++
#ifndef WEB_SERVER_HPP
|
|
#define WEB_SERVER_HPP
|
|
|
|
#include <esp_http_server.h>
|
|
|
|
class WebServer {
|
|
public:
|
|
static WebServer& getInstance();
|
|
|
|
void start(int port = 80);
|
|
void stop();
|
|
bool isRunning() const;
|
|
|
|
private:
|
|
WebServer() = default;
|
|
static WebServer instance;
|
|
httpd_handle_t server = nullptr;
|
|
|
|
// HTTP request handlers
|
|
static esp_err_t handleRootRequest(httpd_req_t* req);
|
|
static esp_err_t handleApiRequest(httpd_req_t* req);
|
|
};
|
|
|
|
#endif // WEB_SERVER_HPP
|