nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches

◆ nrf_cloud_coap_shadow_get()

int nrf_cloud_coap_shadow_get ( char * buf,
size_t * buf_len,
bool delta,
enum coap_content_format format )

#include <include/net/nrf_cloud_coap.h>

Query the device's delta or desired shadow section. The delta section indicates differences between the desired and reported sections. Clear the delta by aligning the desired and reported sections using nrf_cloud_coap_shadow_desired_update or nrf_cloud_coap_shadow_state_update, respectively.

Parameters
[in,out]bufPointer to memory in which to receive the delta.
[in,out]buf_lenSize of buffer, will be set to the incoming length.
[in]deltaTrue to request only changes in the shadow, if any; otherwise, all of the desired section. If there is no data in the specified section, the return value will be 0 and the value of buf_len will be 0.
[in]formatContent format of the returned data. Supported values are COAP_CONTENT_FORMAT_APP_OCTET_STREAM, COAP_CONTENT_FORMAT_APP_JSON, and COAP_CONTENT_FORMAT_APP_CBOR.
Return values
-EACCESDevice does not have a valid nRF Cloud CoAP connection.
-E2BIGShadow data was received, but truncated because the provided buffer was not big enough.
Returns
0 If successful, nonzero if failed. Negative values are device-side errors defined in errno.h. Positive values are cloud-side errors (CoAP result codes) defined in zephyr/net/coap.h.