AliOS Things API KV Guide - Shaofa/AliOS-Things-Certification-Manual GitHub Wiki

API INDEX


1-aos_kv_set

int aos_kv_set(const char *key, const void *value, int len, int sync)
  • Description

    Add a new KV pair.

  • Parameters

    IN/OUT NAME DESC
    [in] key the key of the KV pair.
    [in] value the value of the KV pair.
    [in] len the length of the value.
    [in] sync save the KV pair to flash right now (should always be 1).
  • Returns

    0 on success, negative error on failure.

2-aos_kv_get

int aos_kv_get(const char *key, void *buffer, int *buffer_len)
  • Description

    Get the KV pair's value stored in buffer by its key.

  • Parameters

    IN/OUT NAME DESC
    [in] key the key of the KV pair to get.
    [out] buffer the memory to store the value.
    [in-out] buffer_len in: the length of the input buffer. out: the real length of the value.
  • Returns

    0 on success, negative error on failure.

3-aos_kv_del

int aos_kv_del(const char *key)
  • Description

    Delete the KV pair by its key.

  • Parameters

    IN/OUT NAME DESC
    [in] key the key of the KV pair to delete.
  • Returns

    0 on success, negative error on failure.

⚠️ **GitHub.com Fallback** ⚠️