-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathScpEepromController.h
More file actions
179 lines (149 loc) · 2.79 KB
/
Copy pathScpEepromController.h
File metadata and controls
179 lines (149 loc) · 2.79 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*
secure-control-protocol
This is the header file for the ScpEepromController class.
SPDX-License-Identifier: GPL-3.0-or-later
Copyright (C) 2018 Benjamin Schilling
*/
#ifndef ScpEepromController_h
#define ScpEepromController_h
#include <EEPROM.h>
#include "Arduino.h"
#include "ScpDebug.h"
class ScpEepromController
{
public:
/**
* @brief Construct a new Scp Password object
*
*/
ScpEepromController();
// ====== Flags ======
/**
* @brief
*
* @return is device ID set
*/
bool isDeviceIdSet();
/**
* @brief
*
*/
void setIsDeviceIdSet();
/**
* @brief
*
* @return is password set
*/
bool isDefaultPasswordSet();
/**
* @brief
*
*/
void setIsDefaultPasswordSet();
/**
* @brief
*
* @return is password set
*/
bool areWifiCredentialsSet();
/**
* @brief
*
*/
void setAreWifiCredentialsSet();
// ====== Values ======
/**
* @brief
*
* @return password
*/
String getPassword();
/**
* @brief
*
* @param password
*/
void setPassword(String password);
/**
* @brief
*
* @return uint32_t
*/
uint32_t getCurrentPwNumber();
/**
* @brief
*
* @param uint32_t
*/
void setCurrentPwNumber(uint32_t currentPwNumber);
/**
* @brief
*
* @return deviceID
*/
String getDeviceId();
/**
* @brief
*
* @param deviceId
*/
void setDeviceId(String deviceId);
/**
* @brief
*
* @return SSID
*/
String getWifiSSID();
/**
* @brief
*
* @param ssid
*/
void setWifiSSID(String ssid);
/**
* @brief
*
* @return Wifi Password
*/
String getWifiPassword();
/**
* @brief
*
* @param password
*/
void setWifiPassword(String password);
/**
* @brief
*
* @return device Name
*/
String getDeviceName();
/**
* @brief
*
* @param deviceName
*/
void setDeviceName(String deviceName);
/**
* @brief Resets the EEPROM to the default state
*
*/
void resetToDefault();
private:
const int FLAGS_ADDRESS = 0; // res. | res. | rest | res. | res. | Wifi Credentials set | Device ID set | Default PW Initialized
const int FLAGS_LENGTH = 1; // Byte 0
const int PW_ADDRESS = 1;
const int PW_LENGTH = 32; // Bytes 1 - 32
const int CURRENT_PW_NUMBER_ADDRESS = 33;
const int CURRENT_PW_NUMBER_LENGTH = 32; // Bytes 33 - 64
const int DEVICE_ID_ADDRESS = 65;
const int DEVICE_ID_LENGTH = 16; // Bytes 65 - 80
const int WIFI_SSID_ADDRESS = 81;
const int WIFI_SSID_LENGTH = 32; // Bytes 81 - 112
const int WIFI_PASSWORD_ADDRESS = 113;
const int WIFI_PASSWORD_LENGTH = 32; // Bytes 113 - 144
const int DEVICE_NAME_ADDRESS = 145;
const int DEVICE_NAME_LENGTH = 32; // Bytes 145 - 177
ScpDebug scpDebug;
};
#endif