MeshX 0.4
This repository provides an implementation for Bluetooth Low Energy (BLE) Mesh network nodes. The project allows you to create BLE mesh nodes that can communicate with each other, enabling the development of smart home solutions or other IoT-based applications.
Loading...
Searching...
No Matches
meshx_nvs_interface.h File Reference

Implementation for Non-Volatile Storage (NVS) drivers Insterface APIs. More...

#include "meshx_err.h"
#include <stdint.h>
#include <stddef.h>

Go to the source code of this file.

Functions

meshx_err_t meshx_nvs_plat_open (uintptr_t *p_nvs_handle)
 Open non-volatile storage with a given namespace from the default partition.
meshx_err_t meshx_nvs_plat_close (uintptr_t p_nvs_handle)
 Close the non-volatile storage handle.
meshx_err_t meshx_nvs_plat_read (uintptr_t p_nvs_handle, char const *key, uint8_t *p_data, uint16_t len)
 Read blob value for given key from non-volatile storage.
meshx_err_t meshx_nvs_plat_write (uintptr_t p_nvs_handle, char const *key, uint8_t const *p_data, uint16_t len)
 Write a blob value to the non-volatile storage with a given key and namespace.
meshx_err_t meshx_nvs_plat_erase (uintptr_t p_nvs_handle)
 Erase all key-value pairs in the given namespace.
meshx_err_t meshx_nvs_plat_remove (uintptr_t p_nvs_handle, char const *key)
 Remove a key-value pair from the non-volatile storage with a given key and namespace.
meshx_err_t meshx_nvs_plat_commit (uintptr_t p_nvs_handle)
 Commit changes to the non-volatile storage.

Detailed Description

Implementation for Non-Volatile Storage (NVS) drivers Insterface APIs.

Copyright © 2024 - 2025 MeshX

Author
Pranjal Chanda

Function Documentation

◆ meshx_nvs_plat_close()

meshx_err_t meshx_nvs_plat_close ( uintptr_t p_nvs_handle)

Close the non-volatile storage handle.

Parameters
[in]p_nvs_handleHandle obtained with meshx_nvs_plat_open.
Returns
  • MESHX_SUCCESS if the handle was closed successfully
  • MESHX_ERR_PLAT for any platform error

◆ meshx_nvs_plat_commit()

meshx_err_t meshx_nvs_plat_commit ( uintptr_t p_nvs_handle)

Commit changes to the non-volatile storage.

Note
This function is a prototype and can be returned with MESHX_SUCCESS if no such platform function exists
Parameters
[in]p_nvs_handlePointer to the opened handle.
Returns
  • MESHX_SUCCESS if the changes were committed successfully
  • MESHX_ERR_PLAT for any platform error

◆ meshx_nvs_plat_erase()

meshx_err_t meshx_nvs_plat_erase ( uintptr_t p_nvs_handle)

Erase all key-value pairs in the given namespace.

Parameters
[in]p_nvs_handlePointer to the opened handle.
Returns
  • MESHX_SUCCESS if all key-value pairs were erased successfully
  • MESHX_ERR_PLAT for any platform error

◆ meshx_nvs_plat_open()

meshx_err_t meshx_nvs_plat_open ( uintptr_t * p_nvs_handle)

Open non-volatile storage with a given namespace from the default partition.

If CONFIG_BLE_MESH_SPECIFIC_PARTITION is not defined, this function will open the namespace from the default partition. Otherwise, it will open the namespace from the MESHX_NVS_PARTITION.

Parameters
[out]p_nvs_handlePointer to the output variable populated with the opened handle.
Returns
  • MESHX_SUCCESS if the storage handle was opened successfully
  • MESHX_ERR_PLAT if p_nvs_handle is NULL

◆ meshx_nvs_plat_read()

meshx_err_t meshx_nvs_plat_read ( uintptr_t p_nvs_handle,
char const * key,
uint8_t * p_data,
uint16_t len )

Read blob value for given key from non-volatile storage.

Parameters
[in]p_nvs_handleHandle obtained with meshx_nvs_plat_open.
[in]keyKey name. Maximum length is (NVS_KEY_NAME_MAX_SIZE-1) characters. Shouldn't be empty.
[out]p_dataPointer to the output variable populated with the read blob value.
[in]lenLength of the read blob value.
Returns
  • MESHX_SUCCESS if the blob value was read successfully
  • MESHX_ERR_PLAT if there is an internal error;

◆ meshx_nvs_plat_remove()

meshx_err_t meshx_nvs_plat_remove ( uintptr_t p_nvs_handle,
char const * key )

Remove a key-value pair from the non-volatile storage with a given key and namespace.

Parameters
[in]p_nvs_handlePointer to the opened handle.
[in]keyKey name. Maximum length is (NVS_KEY_NAME_MAX_SIZE-1) characters. Shouldn't be empty.
Returns
  • MESHX_SUCCESS if the key-value pair was removed successfully
  • MESHX_ERR_PLAT for any platform error

◆ meshx_nvs_plat_write()

meshx_err_t meshx_nvs_plat_write ( uintptr_t p_nvs_handle,
char const * key,
uint8_t const * p_data,
uint16_t len )

Write a blob value to the non-volatile storage with a given key and namespace.

Parameters
[in]p_nvs_handlePointer to the opened handle.
[in]keyKey name. Maximum length is (NVS_KEY_NAME_MAX_SIZE-1) characters. Shouldn't be empty.
[in]p_dataPointer to the data to write.
[in]lenNumber of bytes to write.
Returns
  • MESHX_SUCCESS if the value was written successfully
  • MESHX_ERR_PLAT for any platform error