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

◆ nrf_cloud_coap_connect()

int nrf_cloud_coap_connect ( const char *const app_ver)

#include <include/net/nrf_cloud_coap.h>

Connect to and obtain authorization to access the nRF Cloud CoAP server. The full DTLS handshake is performed, and on success, a connection ID (CID) is obtained. The CID allows the connection to be paused with nrf_cloud_coap_pause and resumed with nrf_cloud_coap_resume without redoing the full handshake. Use nrf_cloud_coap_keepopen_is_supported to check if network conditions allow the pause and resume actions.

This function must return 0 indicating success so that the other functions below, other than nrf_cloud_coap_disconnect(), will not immediately return an error when called.

Parameters
app_verVersion to report to the shadow; can be NULL.
Returns
0 if authorized successfully, otherwise, an error number. 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.
Return values
-EACCESif nrf_cloud_coap_init has not been called.