-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwifi_server.h
More file actions
57 lines (43 loc) · 1.27 KB
/
wifi_server.h
File metadata and controls
57 lines (43 loc) · 1.27 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
57
#pragma once
#include "qr_code.h"
#include "defaults.h"
#include "LOG_ctl.h"
#include "I2C_communication.h"
#include <Arduino.h>
#include <WiFi.h>
#include <DNSServer.h>
#include <WebServer.h>
enum class wifi_page_endpoints {
ROOT, // base
CSS, // css file
JS, // js file
NOT_FOUND, // 404
DATETIME, // just experiments
BUILDTIME, // show build time
DEVICECOUNT, // device_id::MAX
};
void __handle_wifi_event(const wifi_page_endpoints& ev);
void __handle_wifi_getdata(const uint8_t dev);
MAKE_SINGLETON_CLASS(MyWiFiPortal, {
const std::string m_ssid;
const std::string m_pass;
std::unique_ptr<qrcodegen::QrCode> m_qrcode;
TaskHandle_t m_thr = nullptr;
struct ref {
DNSServer dnsServer;
WebServer server;
ref();
};
std::unique_ptr<ref> m_build;
friend void __handle_wifi_event(const wifi_page_endpoints& ev);
friend void __handle_wifi_getdata(const uint8_t dev);
void handle_requests();
public:
MyWiFiPortal();
void start();
void stop();
const qrcodegen::QrCode& get_qr_code() const;
const std::string& get_ssid() const;
const std::string& get_password() const;
});
#include "wifi_server.ipp"