-
Notifications
You must be signed in to change notification settings - Fork 0
/
EEPROMHandler.h
66 lines (60 loc) · 1.54 KB
/
EEPROMHandler.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
#ifndef _USER_EEPROMHandler_H_
#define _USER_EEPROMHandler_H_
#include <EEPROM.h>
#include <arduino.h>
struct SonofPowCofig {
uint8_t ecsrc;
uint8_t wifiApIp[4]; //TODO
uint8_t wifiApGateway[4]; //TODO
uint8_t wifiApSubnet[4]; //TODO
uint8_t wifiApSsid[20];
uint8_t wifiApPass[60];
uint8_t wifiStSsid[20];
uint8_t wifiStPass[60];
uint8_t httpClientUser[20];
uint8_t httpClientPass[60];
uint8_t httpServerUser[20];
uint8_t httpServerPass[60];
};
class EEPROMHandler {
public:
EEPROMHandler(void);
~EEPROMHandler(void);
void save(void);
uint8_t isLoaded(void);
//# wifi handler
uint8_t* getWifiAPSsid(void);
uint8_t* getWifiAPPass(void);
//
EEPROMHandler* setWifiApSsid(char* ssid, uint8_t length);
EEPROMHandler* setWifiApPass(char* pass, uint8_t length);
//
uint8_t isWifiStValid(void);
//
uint8_t* getWifiStSsid(void);
uint8_t* getWifiStPass(void);
//
EEPROMHandler* setWifiStSsid(char* ssid, uint8_t length);
EEPROMHandler* setWifiStPass(char* pass, uint8_t length);
//# http server
uint8_t* getServerUser(void);
uint8_t* getServerPass(void);
//
EEPROMHandler* setServerUser(char* user, uint8_t length);
EEPROMHandler* setServerPass(char* pass, uint8_t length);
//# http client
uint8_t isClientValid(void);
//
uint8_t* getClientUser(void);
uint8_t* getClientPass(void);
//
EEPROMHandler* setClientUser(char* user, uint8_t length);
EEPROMHandler* setClientPass(char* pass, uint8_t length);
void byDefault();
private:
SonofPowCofig* config;
bool loaded;
uint16_t ecsrc();
void load();
};
#endif