cleanup storage
This commit is contained in:
parent
0768877ea8
commit
e25cca86f1
1 changed files with 11 additions and 14 deletions
|
@ -3,7 +3,6 @@
|
|||
|
||||
#ifdef ESP32
|
||||
#include "Preferences.h"
|
||||
#include "SPIFFS.h"
|
||||
#elif defined(ESP8266)
|
||||
#include "EEPROM.h"
|
||||
#endif
|
||||
|
@ -14,13 +13,16 @@ namespace fw
|
|||
{
|
||||
class Storage
|
||||
{
|
||||
public:
|
||||
Storage();
|
||||
~Storage();
|
||||
|
||||
private:
|
||||
#ifdef ESP32
|
||||
Preferences memory;
|
||||
#elif defined(ESP8266)
|
||||
// Storage per firewall rule is 42 Byte
|
||||
// Space for 15 Rules is 630 Byte
|
||||
// plus 10 byte for settings
|
||||
// Space for 15 Rules is 630 Byte plus 10 byte for settings
|
||||
const uint16_t eeprom_size = 640;
|
||||
const uint8_t security_number = 93;
|
||||
const uint16_t eeprom_settings_head = 0;
|
||||
|
@ -28,19 +30,14 @@ namespace fw
|
|||
const uint16_t eeprom_rules_head = 10;
|
||||
#endif
|
||||
void setup_eeprom();
|
||||
uint16_t eeprom_rule_position(uint8_t);
|
||||
uint16_t eeprom_rule_position(uint8_t key);
|
||||
|
||||
protected:
|
||||
uint8_t retrieve_settings_value(const char *);
|
||||
void store_settings_value(const char *, const uint8_t);
|
||||
|
||||
firewall_rule_t *retrieve_firewall_rule(const uint8_t);
|
||||
void store_all_firewall_rules(firewall_rule_t *);
|
||||
void store_firewall_rule(firewall_rule_t *);
|
||||
|
||||
public:
|
||||
Storage();
|
||||
~Storage();
|
||||
uint8_t retrieve_settings_value(const char *key);
|
||||
void store_settings_value(const char *key, const uint8_t new_amount);
|
||||
firewall_rule_t *retrieve_firewall_rule(const uint8_t key);
|
||||
void store_all_firewall_rules(firewall_rule_t *rule_head);
|
||||
void store_firewall_rule(firewall_rule_t *rule_ptr);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue