forked from sle118/FreeTouchDeck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConfigHelper.h
68 lines (64 loc) · 1.73 KB
/
ConfigHelper.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
65
66
67
68
#pragma once
#include "WString.h"
#include <ESPAsyncWebServer.h> //Async Webserver support header
#include "globals.hpp"
namespace FreeTouchDeck
{
typedef struct
{
char *ssid;
char *password;
char *wifimode;
char *hostname;
uint8_t attempts;
uint16_t attemptdelay;
} Wificonfig;
bool saveWifiSSID(String ssid);
void stopBT();
bool startWebServer();
bool startWifiStation();
// Start the default AP
bool startAP(const char *SSID, const char *PASSWORD);
bool startDefaultAP();
bool loadWifiConfig();
bool resetconfig(String file);
extern AsyncWebServer webserver;
extern Wificonfig wificonfig;
/**
* @brief This function stops Bluetooth and connects to the given
WiFi network. It the starts mDNS and starts the Async
Webserver.
*
* @param none
*
* @return none
*
* @note none
*/
bool ConfigMode();
/**
* @brief This function allows for saving (updating) the WiFi Password
*
* @param String password
*
* @return boolean True if succeeded. False otherwise.
*
* @note Returns true if successful. To enable the new set password, you must reload the the
configuration using loadWifiConfig()
*/
bool saveWifiPW(String password);
/**
* @brief This function allows for saving (updating) the WiFi Mode
*
* @param String wifimode "WIFI_STA" of "WIFI_AP"
*
* @return boolean True if succeeded. False otherwise.
*
* @note Returns true if successful. To enable the new set WiFi Mode, you must reload the the
configuration using loadWifiConfig()
*/
bool saveWifiMode(String wifimode);
cJSON * toJson(Wificonfig * wificonfig);
bool Commit(Wificonfig * wificonfig);
void EraseWifiConfig(Wificonfig * config);
}