35 lines
823 B
C
35 lines
823 B
C
|
#pragma once
|
||
|
|
||
|
#include <HTTPRequest.hpp>
|
||
|
#include <HTTPResponse.hpp>
|
||
|
#include <HTTPServer.hpp>
|
||
|
|
||
|
class Fader;
|
||
|
|
||
|
class HTTPServer
|
||
|
{
|
||
|
public:
|
||
|
bool start(void);
|
||
|
|
||
|
void setFader(Fader *fader) { m_fader = fader;}
|
||
|
|
||
|
static HTTPServer &instance(void)
|
||
|
{
|
||
|
static HTTPServer theInstance;
|
||
|
return theInstance;
|
||
|
}
|
||
|
|
||
|
private:
|
||
|
httpsserver::HTTPServer *m_server;
|
||
|
|
||
|
Fader *m_fader;
|
||
|
|
||
|
HTTPServer(void);
|
||
|
|
||
|
static void serverTask(void *arg);
|
||
|
|
||
|
// handlers
|
||
|
static void handleRoot(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res);
|
||
|
static void handleColor(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res);
|
||
|
static void handle404(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res);
|
||
|
};
|