PL::NvsNamespace class
-
class NvsNamespace : public PL::Lockable
NVS namespace class.
Public Functions
-
NvsNamespace(const std::string &partitionName, const std::string &namespaceName, NvsAccessMode accessMode)
Creates an NVS namespace.
- Parameters:
partitionName – partition name
namespaceName – namespace name
accessMode – access mode
-
NvsNamespace(const std::string &namespaceName, NvsAccessMode accessMode)
Creates an NVS namespace in the default NVS partition.
- Parameters:
namespaceName – namespace name
accessMode – access mode
-
virtual esp_err_t Lock(TickType_t timeout = portMAX_DELAY) override
Locks the object.
- Parameters:
timeout – timeout in FreeRTOS ticks
- Returns:
error code
-
virtual esp_err_t Unlock() override
Unlocks the object.
- Returns:
error code
-
esp_err_t Read(const std::string &key, uint8_t &value)
Reads the U8 value.
- Parameters:
key – key
value – value
- Returns:
error code
-
esp_err_t Write(const std::string &key, uint8_t value)
Writes the U8 value.
- Parameters:
key – key
value – value
- Returns:
error code
-
esp_err_t Read(const std::string &key, int8_t &value)
Reads the I8 value.
-
esp_err_t Write(const std::string &key, int8_t value)
Writes the I8 value.
-
esp_err_t Read(const std::string &key, uint16_t &value)
Reads the U16 value.
-
esp_err_t Write(const std::string &key, uint16_t value)
Writes the U16 value.
-
esp_err_t Read(const std::string &key, int16_t &value)
Reads the I16 value.
-
esp_err_t Write(const std::string &key, int16_t value)
Writes the I16 value.
-
esp_err_t Read(const std::string &key, uint32_t &value)
Reads the U32 value.
-
esp_err_t Write(const std::string &key, uint32_t value)
Writes the U32 value.
-
esp_err_t Read(const std::string &key, int32_t &value)
Reads the I32 value.
-
esp_err_t Write(const std::string &key, int32_t value)
Writes the I32 value.
-
esp_err_t Read(const std::string &key, uint64_t &value)
Reads the U64 value.
-
esp_err_t Write(const std::string &key, uint64_t value)
Writes the U64 value.
-
esp_err_t Read(const std::string &key, int64_t &value)
Reads the I64 value.
-
esp_err_t Write(const std::string &key, int64_t value)
Writes the I64 value.
-
esp_err_t Read(const std::string &key, std::string &value)
Reads the string.
-
esp_err_t Write(const std::string &key, std::string value)
Writes the string.
-
esp_err_t Read(const std::string &key, void *data, size_t maxDataSize, size_t *dataSize)
Reads the blob.
- Parameters:
key – key
data – data
maxDataSize – maximum data size
dataSize – data size
- Returns:
error code
-
esp_err_t Write(const std::string &key, const void *data, size_t dataSize)
Writes the bob.
- Parameters:
key – key
data – data
dataSize – data size
- Returns:
error code
-
esp_err_t Erase(const std::string &key)
Erases the value.
- Parameters:
key – key
- Returns:
error code
-
esp_err_t Erase()
Erases all values.
- Returns:
error code
-
esp_err_t Commit()
Writes any pending changes to the NVS.
- Returns:
error code
-
NvsNamespace(const std::string &partitionName, const std::string &namespaceName, NvsAccessMode accessMode)