-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapmode.cpp
More file actions
32 lines (25 loc) · 694 Bytes
/
apmode.cpp
File metadata and controls
32 lines (25 loc) · 694 Bytes
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
void Config::handleRoot() {
// generate HtML Page
server.send(200, "text/html", page);
}
void Config::handleSave() {
_ssid = server.arg("ssid").c_str();
_pass = server.arg("pass").c_str();
_lat = server.arg("lat").c_str();
_lon = server.arg("lon").c_str();
//save to eeprom
server.send(200, "text/html", page);
}
void Config::startAP(const char* ssid, const char* password) {
if(WiFi.status() == WL_CONNECTED) {
WiFi.disconnect();
}
WiFi.mode(WIFI_AP);
WiFi.softAP(ssid);
server.on("/", std::bind(&Config::handleRoot, this));
server.on("/save", std::bind(&Config::handleSave, this));
server.begin();
};
void Config::loop() {
server.handleClient();
};