![]() |
flux sdk
v01.05.00-3-gedf3296
Embedded C++ SDK
|
#include <flxKVPStorePage.h>
Public Member Functions | |
| flxKVPStorePage () | |
| bool | initialize (flxKVPStoreDevice *theDevice, uint32_t sectorNumber) |
| flxKVPError_t | loadPage (void) |
| Loads the page from the storage device. More... | |
| flxKVPError_t | writeEntry (const flxKVPStoreEntry &theEntry) |
| Writes a flxFPSEntry to the storage device. More... | |
| flxKVPError_t | readEntry (uint32_t index, flxKVPStoreEntry &theEntry) |
| Reads an entry from the flash storage page. More... | |
| flxKVPError_t | findEntry (uint8_t iNS, const char *szKey, flxKVPStoreEntry &theEntry, uint32_t &entryIndex) |
| flxKVPError_t | findEntry (uint8_t iNS, const char *szKey, flxKVPStoreEntry &theEntry) |
| flxKVPError_t | deleteEntry (uint32_t index) |
| Deletes an entry at the specified index. More... | |
| flxKVPError_t | updateEntry (uint32_t index, const flxKVPStoreEntry &theEntry) |
| Updates an entry in the flash page. More... | |
| flxKVPError_t | setValue (uint8_t iNS, flxDataType_t dType, const char *szKey, const void *value, size_t valueSize) |
| Sets the value of a key-value pair in the flash page. More... | |
| flxKVPError_t | setValue (uint8_t iNS, const char *szKey, const char *value) |
| flxKVPError_t | setValue (uint8_t iNS, const char *szKey, char *value) |
| template<typename T > | |
| flxKVPError_t | setValue (uint8_t iNS, const char *szKey, T &value) |
| flxKVPError_t | setValueString (uint8_t iNS, const char *szKey, const char *value, size_t valueSize) |
| Sets the value of a key-value pair in the flxFPSPage. More... | |
| flxKVPError_t | readValue (uint8_t iNS, flxDataType_t dType, const char *szKey, void *value, size_t valueSize) |
| Reads the value associated with the specified key from the flash storage page. More... | |
| template<typename T > | |
| flxKVPError_t | readValue (uint8_t iNS, const char *szKey, T &value) |
| flxKVPError_t | readValue (uint8_t iNS, const char *szKey, char *value, size_t len) |
| flxKVPError_t | deleteValue (uint8_t iNS, const char *szKey) |
| Delete a key-value pair from the flash storage page. More... | |
| bool | keyExists (uint8_t iNS, const char *szKey) |
| flxKVPPageStatus | status () |
| flxKVPError_t | initPage (bool bErase=false) |
| Initialize the page AND write init values to flash. More... | |
| void | dumpPage (void) |
| Dumps the contents of the page to the Serial monitor. More... | |
Static Public Attributes | |
| static constexpr uint32_t | kPageInitialized = flxKVPPageStatus::kPageAvailable |
| static constexpr uint32_t | kPageFull = flxKVPPageStatus::kPageFull |
| static constexpr uint32_t | kSectorSize = 4096 |
| static constexpr uint32_t | kNEntriesPerPage = (kSectorSize / flxKVPStoreEntry::kEntrySize) - kNBookKeepingEntries |
| static constexpr uint32_t | kNoSector = 0xFFFFFFFF |
| flxKVPStorePage::flxKVPStorePage | ( | ) |
| flxKVPError_t flxKVPStorePage::deleteEntry | ( | uint32_t | index | ) |
Deletes an entry at the specified index.
| index | The index of the entry to delete. |
| flxKVPError_t flxKVPStorePage::deleteValue | ( | uint8_t | iNS, |
| const char * | szKey | ||
| ) |
Delete a key-value pair from the flash storage page.
This function deletes a key-value pair from the flash storage page based on the provided namespace and key.
| iNS | The namespace of the key-value pair. |
| szKey | The key of the key-value pair. |
| void flxKVPStorePage::dumpPage | ( | void | ) |
Dumps the contents of the page to the Serial monitor.
This method prints the page number, status, base address, last empty entry, and the state of each entry in the page to the Serial monitor.
|
inline |
| flxKVPError_t flxKVPStorePage::findEntry | ( | uint8_t | iNS, |
| const char * | szKey, | ||
| flxKVPStoreEntry & | theEntry, | ||
| uint32_t & | entryIndex | ||
| ) |
Finds an entry in the flxFPSPage object.
| iNS | The namespace of the entry. | |
| szKey | The key of the entry. | |
| theEntry | The output parameter to store the found entry. | |
| [in,out] | entryIndex | Input: the index of the entry to start the search from, returns the index of the found entry. |
| bool flxKVPStorePage::initialize | ( | flxKVPStoreDevice * | theDevice, |
| uint32_t | sectorNumber | ||
| ) |
Initializes the flxFPSPage object.
| theDevice | The flxFPSDevice object to associate with this page. |
| sectorNumber | The sector number of the page. |
| flxKVPError_t flxKVPStorePage::initPage | ( | bool | bErase = false | ) |
Initialize the page AND write init values to flash.
| bErase | if true, erase the page - defaults to false |
| bool flxKVPStorePage::keyExists | ( | uint8_t | iNS, |
| const char * | szKey | ||
| ) |
Checks if a key exists in the flash page.
| iNS | The namespace of the key. |
| szKey | The key to check. |
| flxKVPError_t flxKVPStorePage::loadPage | ( | void | ) |
Loads the page from the storage device.
| flxKVPError_t flxKVPStorePage::readEntry | ( | uint32_t | index, |
| flxKVPStoreEntry & | theEntry | ||
| ) |
Reads an entry from the flash storage page.
This function reads the entry at the specified index from the flash storage page.
| index | The index of the entry to read. |
| theEntry | Reference to the flxFPSEntry object to store the read entry. |
|
inline |
|
inline |
| flxKVPError_t flxKVPStorePage::readValue | ( | uint8_t | iNS, |
| flxDataType_t | dType, | ||
| const char * | szKey, | ||
| void * | value, | ||
| size_t | valueSize | ||
| ) |
Reads the value associated with the specified key from the flash storage page.
| iNS | The namespace of the key-value pair. |
| dType | The data type of the value. |
| szKey | The key to search for. |
| value | Pointer to the buffer where the value will be stored. |
| valueSize | The size of the buffer. |
|
inline |
|
inline |
|
inline |
| flxKVPError_t flxKVPStorePage::setValue | ( | uint8_t | iNS, |
| flxDataType_t | dType, | ||
| const char * | szKey, | ||
| const void * | value, | ||
| size_t | valueSize | ||
| ) |
Sets the value of a key-value pair in the flash page.
| iNS | The namespace index. |
| dType | The data type of the value. |
| szKey | The key. |
| value | A pointer to the value. |
| valueSize | The size of the value. |
| flxKVPError_t flxKVPStorePage::setValueString | ( | uint8_t | iNS, |
| const char * | szKey, | ||
| const char * | value, | ||
| size_t | valueSize | ||
| ) |
Sets the value of a key-value pair in the flxFPSPage.
| iNS | The namespace of the key-value pair. |
| szKey | The key of the key-value pair. |
| value | The value to be set. |
| valueSize | The size of the value. |
|
inline |
| flxKVPError_t flxKVPStorePage::updateEntry | ( | uint32_t | index, |
| const flxKVPStoreEntry & | theEntry | ||
| ) |
Updates an entry in the flash page.
This function updates the entry at the specified index with the provided entry data.
| index | The index of the entry to be updated. |
| theEntry | The entry data to be written. |
| flxKVPError_t flxKVPStorePage::writeEntry | ( | const flxKVPStoreEntry & | theEntry | ) |
Writes a flxFPSEntry to the storage device.
| [in] | theEntry | The flxFPSEntry to be written. |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |