blob: 28f01fb0b41d27dd8859f5be97a88b7685c976e4 (
plain)
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
|
#ifndef COMMON_HOMEKIT_CONFIG_H
#define COMMON_HOMEKIT_CONFIG_H
#include <Arduino.h>
namespace homekit::config {
struct ConfigFlags {
uint8_t wifi_configured: 1;
uint8_t node_configured: 1;
uint8_t reserved: 6;
} __attribute__((packed));
struct ConfigData {
// helpers
uint32_t crc = 0;
uint32_t magic = 0;
char node_id[16] = {0};
char wifi_ssid[32] = {0};
char wifi_psk[63] = {0};
ConfigFlags flags {0};
// helper methods
char* escapeHomeId(char* buf, size_t len);
} __attribute__((packed));
ConfigData read();
void write(ConfigData& data);
void erase();
void erase(ConfigData& data);
bool isValid(ConfigData& data);
bool isDirty(ConfigData& data);
}
#endif //COMMON_HOMEKIT_CONFIG_H
|