Function esp_idf_svc::hal::sys::nvs_entry_find_in_handle

source ·
pub unsafe extern "C" fn nvs_entry_find_in_handle(
    handle: u32,
    type_: u32,
    output_iterator: *mut *mut nvs_opaque_iterator_t,
) -> i32
Expand description

@brief Create an iterator to enumerate NVS entries based on a handle and type

\code{c} // Example of listing all the key-value pairs of any type under specified handle (which defines a partition and namespace) nvs_iterator_t it = NULL; esp_err_t res = nvs_entry_find_in_handle(<nvs_handle>, NVS_TYPE_ANY, &it); while(res == ESP_OK) { nvs_entry_info_t info; nvs_entry_info(it, &info); // Can omit error check if parameters are guaranteed to be non-NULL printf(“key ‘%s’, type ‘%d’ \n”, info.key, info.type); res = nvs_entry_next(&it); } nvs_release_iterator(it); \endcode

@param[in] handle Handle obtained from nvs_open function.

@param[in] type One of nvs_type_t values.

@param[out] output_iterator Set to a valid iterator to enumerate all the entries found. Set to NULL if no entry for specified criteria was found. If any other error except ESP_ERR_INVALID_ARG occurs, \c output_iterator is NULL, too. If ESP_ERR_INVALID_ARG occurs, \c output_iterator is not changed. If a valid iterator is obtained through this function, it has to be released using \c nvs_release_iterator when not used any more, unless ESP_ERR_INVALID_ARG is returned.

@return - ESP_OK if no internal error or programming error occurred. - ESP_ERR_NVS_NOT_FOUND if no element of specified criteria has been found. - ESP_ERR_NO_MEM if memory has been exhausted during allocation of internal structures. - ESP_ERR_NVS_INVALID_HANDLE if unknown handle was specified. - ESP_ERR_INVALID_ARG if output_iterator parameter is NULL. Note: don’t release \c output_iterator in case ESP_ERR_INVALID_ARG has been returned