-
Notifications
You must be signed in to change notification settings - Fork 0
/
HttpServer.h
72 lines (54 loc) · 1.47 KB
/
HttpServer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// HttpServer.h
#ifndef _WEBSERVER_h
#define _WEBSERVER_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <ESP8266WebServer.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <ESP8266mDNS.h>
#include <ESP8266FtpServer.h>
#include "IComponent.h"
class HttpServer : public IComponent
{
public:
HttpServer();
virtual ~HttpServer();
virtual void setup(void);
virtual void handle(void);
String getContentType(String filename);
ESP8266WebServer & webServer();
NTPClient & timeClient();
private:
ESP8266WebServer _webServer;
FtpServer _ftpServer;
WiFiUDP _ntpUDP;
NTPClient _timeClient;
bool handleFileRead(String path);
void sendOk();
void sendKo(const String & message);
void sendOkAnswerWithParams(const String & params);
static const String RestKeyword;
static const String LedKeyword;
static const String ModeKeyword;
static const String StatusKeyword;
static const String ParamKeyword;
static const String ParamsKeyword;
static const String HostnameKeyword;
static const String FtpLoginKeyword;
static const String FtpPasswdKeyword;
static const String TimeOffsetKeyword;
static const String TimeStartKeyword;
static const String TimeEndKeyword;
static const String StartDurationKeyword;
static const String EndDurationKeyword;
static const String ValueWhenLowKeyword;
static const String ValueWhenHighKeyword;
};
#if !defined(NO_GLOBAL_INSTANCES)
extern HttpServer HTTPServer;
#endif
#endif