-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresetlogic.cpp
More file actions
45 lines (38 loc) · 967 Bytes
/
resetlogic.cpp
File metadata and controls
45 lines (38 loc) · 967 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
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "resetlogic.h"
#include "html.h"
ResetLogic::ResetLogic()
: _server(new WiFiServer(80))
{
}
void ResetLogic::run()
{
WiFiClient client = _server->available();
processClientRequest(client);
}
void ResetLogic::processClientRequest(WiFiClient& client)
{
if (client)
{
Serial.println("\n[Client connected]");
while (client.connected())
{
if (client.available())
{
String request = client.readStringUntil('\r');
Serial.print(request);
if (request.length() == 1 && request[0] == '\n')
{
String html = Html::credentialsInputForm();
client.println(html);
break;
}
}
}
while (client.available())
{
client.read();
}
client.stop();
Serial.println("[Client disconnected]");
}
}