use preferences instead of eeprom
This commit is contained in:
parent
e5c061ff32
commit
d05ccef834
2 changed files with 46 additions and 69 deletions
|
@ -1,7 +1,7 @@
|
|||
#ifndef ESP32_STORAGE_HPP
|
||||
#define ESP32_STORAGE_HPP
|
||||
|
||||
#include "EEPROM.h"
|
||||
#include "Preferences.h"
|
||||
#include "FirewallTypes.h"
|
||||
#include "mbedtls/md.h"
|
||||
|
||||
|
@ -10,25 +10,16 @@ namespace firewall
|
|||
class Storage
|
||||
{
|
||||
private:
|
||||
uint16_t eeprom_size;
|
||||
uint16_t settings_start = 0;
|
||||
uint16_t settings_head = settings_start;
|
||||
uint16_t rules_start = 100;
|
||||
uint16_t rules_head = rules_start;
|
||||
uint16_t certificate_start = 800;
|
||||
uint16_t certificate_head = certificate_start;
|
||||
|
||||
void clear_eeprom();
|
||||
void get_eeprom_hash();
|
||||
unsigned char *Storage::get_hash(const char *);
|
||||
Preferences preferences;
|
||||
|
||||
protected:
|
||||
uint8_t amount_of_rules;
|
||||
uint8_t get_amount_of_firewall_rules();
|
||||
void set_amount_of_firewall_rules(const uint8_t);
|
||||
uint8_t retrieve_amount_of_firewall_rules();
|
||||
void store_amount_of_firewall_rules(const uint8_t);
|
||||
firewall_rule_t *retrieve_firewall_rule(const uint8_t);
|
||||
void store_firewall_rule(const uint8_t &, firewall_rule_t *);
|
||||
|
||||
public:
|
||||
Storage(const uint16_t = 1000);
|
||||
Storage();
|
||||
~Storage();
|
||||
};
|
||||
}
|
||||
|
|
Reference in a new issue