supla-device
Loading...
Searching...
No Matches
Supla::Storage Class Referenceabstract
Inheritance diagram for Supla::Storage:
Collaboration diagram for Supla::Storage:

Public Types

enum class  WearLevelingMode { OFF = 0 , BYTE_WRITE_MODE = 1 , SECTOR_WRITE_MODE = 2 }
 

Public Member Functions

 Storage (unsigned int storageStartingOffset=0, unsigned int availableSize=0, enum WearLevelingMode=WearLevelingMode::OFF)
 
virtual void setStateSavePeriod (uint32_t periodMs)
 
virtual void deleteAll ()
 
void enableChannelNumbers ()
 
bool isAddChannelNumbersEnabled () const
 

Static Public Member Functions

static StorageInstance ()
 
static ConfigConfigInstance ()
 
static void SetConfigInstance (Config *instance)
 
static bool IsConfigStorageAvailable ()
 
static bool Init ()
 
static bool SaveStateAllowed (uint32_t)
 
static void ScheduleSave (uint32_t delayMs)
 
static bool IsStateStorageValid ()
 
static void LoadStateStorage ()
 
static void WriteStateStorage ()
 
static bool ReadState (unsigned char *, int)
 
static bool WriteState (const unsigned char *, int)
 
static bool RegisterSection (int sectionId, int offset, int size, bool addCrc, bool addBackupCopy)
 
static bool ReadSection (int sectionId, unsigned char *data, int size)
 
static bool WriteSection (int sectionId, const unsigned char *data, int size)
 
static bool DeleteSection (int sectionId)
 

Static Public Attributes

static bool storageInitDone = false
 

Protected Member Functions

virtual bool init ()
 
virtual int readStorage (unsigned int address, unsigned char *buf, int size, bool logs=true)=0
 
virtual int writeStorage (unsigned int address, const unsigned char *buf, int size)=0
 
virtual void eraseSector (unsigned int address, int size)
 
virtual void commit ()=0
 
virtual int updateStorage (unsigned int, const unsigned char *, int)
 
virtual bool saveStateAllowed (uint32_t)
 
virtual void scheduleSave (uint32_t delayMs)
 
bool registerSection (int sectionId, int offset, int size, bool addCrc, bool addBackupCopy)
 
bool readSection (int sectionId, unsigned char *data, int size)
 
bool writeSection (int sectionId, const unsigned char *data, int size)
 
bool deleteSection (int sectionId)
 

Static Protected Member Functions

static void WriteElementsState ()
 

Protected Attributes

const uint32_t storageStartingOffset = 0
 
const uint32_t availableSize = 0
 
enum WearLevelingMode wearLevelingMode = WearLevelingMode::OFF
 
uint32_t saveStatePeriod = 1000
 
uint32_t lastWriteTimestamp = 0
 
SpecialSectionInfofirstSectionInfo = nullptr
 
StateStorageInterfacestateStorage = nullptr
 
bool addChannelNumbers = false
 

Static Protected Attributes

static Storageinstance = nullptr
 
static ConfigconfigInstance = nullptr
 

Friends

class StateStorageInterface
 

The documentation for this class was generated from the following files: