-
Notifications
You must be signed in to change notification settings - Fork 1
/
ESP8266_Basic_webServer.h
65 lines (52 loc) · 2.12 KB
/
ESP8266_Basic_webServer.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
/******************************************************************************
ProjectName: ESP8266-1W-I2C-Gateway ***** *****
SubTitle : 1W/I²C -> MQTT bridge * * ************
* ** ** * *
Copyright by Pf@nne * * * * * **** *
* * * * * * *
Last modification by: * * * * **** *
- Pf@nne ([email protected]) * * ***** *
* * * *******
***** * *
* *
*****
********************************************************************************/
#pragma once
#include <Arduino.h>
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
#include <ESP8266WebServer.h>
#include <WiFiClient.h>
#include <DNSServer.h>
#include <ESP8266HTTPUpdateServer.h>
#include <ESP8266httpUpdate.h>
#include "ESP8266_Basic_data.h"
#include <functional>
typedef std::function<void(void)> CallbackFunction;
#define GPIO2 2
class ESP8266_Basic_webServer{
public:
ESP8266_Basic_webServer();
void start();
void handleClient();
void set_cfgPointer(CFG *p);
void set_sensorPointer(TDS18B20_Sensors *p, THTU21_Sensors *q, TBMP180_Sensors *r);
void set_saveConfig_Callback(CallbackFunction c);
void updateFirmware();
private:
ESP8266WebServer webServer;
ESP8266HTTPUpdateServer httpUpdater;
CallbackFunction saveConfig_Callback;
CFG *cfg;
TDS18B20_Sensors *DS18B20_Sensors;
THTU21_Sensors *HTU21_Sensors;
TBMP180_Sensors *BMP180_Sensors;
//Page controls----------------
void rootPageHandler();
void sensorPageHandler();
void wlanPageHandler();
void gpioPageHandler();
void cfgPageHandler();
void handleNotFound();
//helpers----------------------------
String IPtoString(IPAddress ip);
};