57 enum class State : uint8_t {
68 uint32_t availableSize);
71 bool loadPreambles(uint32_t storageStartingOffset, uint16_t size)
override;
73 bool writeSectionPreamble()
override;
74 bool initFromStorage()
override;
75 void deleteAll()
override;
76 bool prepareSaveState()
override;
77 bool prepareSizeCheck()
override;
78 bool prepareLoadState()
override;
79 bool readState(
unsigned char *,
int)
override;
80 bool writeState(
const unsigned char *,
int)
override;
81 bool finalizeSaveState()
override;
82 bool finalizeSizeCheck()
override;
83 bool finalizeLoadState()
override;
84 void notifyUpdate()
override;
87 virtual uint16_t getSectorSize()
const;
90 uint16_t getSizeValue(uint16_t availableSize)
override;
91 bool tryLoadPreamblesFrom(uint32_t offset);
92 bool isDataDifferent(uint32_t address,
const uint8_t *data, uint32_t size);
93 bool isSlotValid(uint32_t address, uint8_t *buffer);
94 uint32_t getPhysicalSlotCount()
const;
95 uint32_t getMaxBitmapSlotCount()
const;
96 int getSlotSize()
const;
97 uint32_t getFirstSlotAddress()
const;
98 uint32_t getNextSlotAddress(uint32_t slotAddress)
const;
99 uint32_t getPreviousSlotAddress(uint32_t slotAddress)
const;
100 uint16_t slotSize()
const;
101 uint32_t updateStateEntryAddress();
102 uint32_t sectionOffset = 0;
103 uint32_t availableSize;
104 uint16_t elementStateSize = 0xFFFF;
105 uint16_t stateSlotNewSize = 0;
106 uint32_t currentStateBufferOffset = 0;
108 bool elementStateCrcCValid =
false;
109 bool storageStateOk =
false;
110 bool initDone =
false;
111 bool currentSlotPreparedForFirstWrite =
false;
112 int repeatBeforeSwitchToAnotherSlot = 0;
114 uint32_t currentSlotAddress = 0;
115 uint32_t lastStoredSlotAddress = 0;
116 uint32_t lastValidAddress = 0;
117 uint8_t *dataBuffer =
nullptr;
119 State state = State::NONE;