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

◆ nrf_cloud_error_msg_decode()

int nrf_cloud_error_msg_decode ( const char *const  buf,
const char *const  app_id,
const char *const  msg_type,
enum nrf_cloud_error *const  err 
)

#include <include/net/nrf_cloud_codec.h>

Check for a JSON error message in the data received from nRF Cloud over MQTT.

Parameters
[in]bufData received from nRF Cloud.
[in]app_idappId value to check for. Set to NULL to skip appID check.
[in]msg_typemessageType value to check for. Set to NULL to skip messageType check.
[out]errError code found in message.
Return values
0Error code found (and matched app_id and msg_type if provided).
-ENOENTError code found, but did not match specified the app_id and msg_type.
-ENOMSGNo error code found.
-EBADMSGInvalid error code data format.
-ENODATAJSON data was not found.
Returns
A negative value indicates an error.