feat(nvs_flash): Added function nvs_find_key

Closes https://github.com/espressif/esp-idf/issues/12155
This commit is contained in:
radek.tandler
2023-10-13 12:55:15 +02:00
parent b486466339
commit 8740888967
11 changed files with 197 additions and 28 deletions
+20
View File
@@ -683,6 +683,26 @@ esp_err_t Storage::eraseNamespace(uint8_t nsIndex)
}
esp_err_t Storage::findKey(const uint8_t nsIndex, const char* key, ItemType* datatype)
{
if (mState != StorageState::ACTIVE) {
return ESP_ERR_NVS_NOT_INITIALIZED;
}
Item item;
Page* findPage = nullptr;
auto err = findItem(nsIndex, ItemType::ANY, key, findPage, item);
if (err != ESP_OK) {
return err;
}
if(datatype != nullptr) {
*datatype = item.datatype;
}
return err;
}
esp_err_t Storage::getItemDataSize(uint8_t nsIndex, ItemType datatype, const char* key, size_t& dataSize)
{
if (mState != StorageState::ACTIVE) {