Storage API

Storage layer related APIs for ESP-NOW.

API Reference

Header File

Functions

esp_err_t espnow_storage_init(void)

Intialise ESP Storage.

Returns:

  • ESP_FAIL

  • ESP_OK

esp_err_t espnow_storage_set(const char *key, const void *value, size_t length)

Save the information with given key.

Parameters:
  • key[in] key name. Maximal length is 15 characters. Shouldn’t be empty.

  • value[in] the value to set

  • length[in] length of binary value to set, in bytes; Maximum length is 1984 bytes or (508000 bytes or (97.6% of the partition size - 4000) bytes whichever is lower, in case multi-page blob support is enabled).

Returns:

  • ESP_FAIL

  • ESP_OK

esp_err_t espnow_storage_get(const char *key, void *value, size_t length)

Load the information with given key.

Parameters:
  • key[in] the corresponding key of the information that want to load

  • value[out] the corresponding value of key

  • length[in] the length of the value, can be 0 or no less than the value length

Returns:

  • ESP_FAIL

  • ESP_OK

esp_err_t espnow_storage_erase(const char *key)

Erase the information with given key.

Parameters:

key[in] the corresponding key of the information that want to erase

Returns:

  • ESP_FAIL

  • ESP_OK