-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathwifi_manager.h
More file actions
56 lines (47 loc) · 1.44 KB
/
Copy pathwifi_manager.h
File metadata and controls
56 lines (47 loc) · 1.44 KB
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
#ifndef WIFI_MANAGER_H
#define WIFI_MANAGER_H
#include <WiFiNINA.h>
#include <WiFiUdp.h>
// ---------------------------
// WiFi Configuration
// ---------------------------
#define AP_SSID "OpenChessBoard"
#define AP_PASSWORD "chess123"
#define AP_PORT 80
// ---------------------------
// WiFi Manager Class
// ---------------------------
class WiFiManager {
private:
WiFiServer server;
bool apMode;
bool clientConnected;
// Configuration variables
String wifiSSID;
String wifiPassword;
String lichessToken;
String gameMode;
String startupType;
// Web interface methods
String generateWebPage();
String generateGameSelectionPage();
void handleConfigSubmit(WiFiClient& client, String request);
void handleGameSelection(WiFiClient& client, String request);
void sendResponse(WiFiClient& client, String content, String contentType = "text/html");
void parseFormData(String data);
public:
WiFiManager();
void begin();
void handleClient();
bool isClientConnected();
// Configuration getters
String getWiFiSSID() { return wifiSSID; }
String getWiFiPassword() { return wifiPassword; }
String getLichessToken() { return lichessToken; }
String getGameMode() { return gameMode; }
String getStartupType() { return startupType; }
// Game selection via web
int getSelectedGameMode();
void resetGameSelection();
};
#endif // WIFI_MANAGER_H