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

The functions in this library can return either positive or negative return values. More...

Functions

int nrf_cloud_coap_init (void)
 Initialize nRF Cloud CoAP library.
 
int nrf_cloud_coap_connect (const char *const app_ver)
 Connect to and obtain authorization to access the nRF Cloud CoAP server.
 
int nrf_cloud_coap_pause (void)
 Pause CoAP connection.
 
int nrf_cloud_coap_resume (void)
 Resume CoAP connection.
 
bool nrf_cloud_coap_keepopen_is_supported (void)
 Check if you can pause and resume safely.
 
int nrf_cloud_coap_disconnect (void)
 Disconnect the nRF Cloud CoAP connection.
 
int nrf_cloud_coap_agnss_data_get (struct nrf_cloud_rest_agnss_request const *const request, struct nrf_cloud_rest_agnss_result *result)
 Request nRF Cloud CoAP Assisted GNSS (A-GNSS) data.
 
int nrf_cloud_coap_pgps_url_get (struct nrf_cloud_rest_pgps_request const *const request, struct nrf_cloud_pgps_result *file_location)
 Request URL for nRF Cloud Predicted GPS (P-GPS) data.
 
int nrf_cloud_coap_sensor_send (const char *app_id, double value, int64_t ts_ms, bool confirmable)
 Send a sensor value to nRF Cloud.
 
int nrf_cloud_coap_message_send (const char *app_id, const char *message, bool json, int64_t ts_ms, bool confirmable)
 Send a message to nRF Cloud.
 
int nrf_cloud_coap_json_message_send (const char *message, bool bulk, bool confirmable)
 Send a preencoded JSON message to nRF Cloud.
 
int nrf_cloud_coap_location_send (const struct nrf_cloud_gnss_data *const gnss, bool confirmable)
 Send the device location in the nrf_cloud_gnss_data PVT field to nRF Cloud.
 
int nrf_cloud_coap_location_get (struct nrf_cloud_rest_location_request const *const request, struct nrf_cloud_location_result *const result)
 Request device location from nRF Cloud.
 
int nrf_cloud_coap_fota_job_get (struct nrf_cloud_fota_job_info *const job)
 Request current nRF Cloud FOTA job info for the specified device.
 
void nrf_cloud_coap_fota_job_free (struct nrf_cloud_fota_job_info *const job)
 Free memory allocated by nrf_cloud_coap_current_fota_job_get().
 
int nrf_cloud_coap_fota_job_update (const char *const job_id, const enum nrf_cloud_fota_status status, const char *const details)
 Update the status of the specified nRF Cloud FOTA job.
 
int nrf_cloud_coap_shadow_get (char *buf, size_t *buf_len, bool delta, enum coap_content_format format)
 Query the device's delta or desired shadow section.
 
int nrf_cloud_coap_shadow_state_update (const char *const shadow_json)
 Update the device's "reported state" in the shadow through the state/update CoAP resource. This is used both to report the current state of the device as well as to accept settings changes received in a shadow delta.
 
int nrf_cloud_coap_shadow_desired_update (const char *const shadow_json)
 Update the device's "desired state" in the shadow through the state/desired CoAP resource. Normally, this is only used to silence a shadow delta that is incompatible with the device, by overwriting the invalid desired values with the reported values.
 
int nrf_cloud_coap_shadow_device_status_update (const struct nrf_cloud_device_status *const dev_status)
 Update the device status in the shadow's reported state section.
 
int nrf_cloud_coap_shadow_service_info_update (const struct nrf_cloud_svc_info *const svc_inf)
 Update the device's "serviceInfo" in the shadow.
 
int nrf_cloud_coap_shadow_delta_process (const struct nrf_cloud_data *in_data, struct nrf_cloud_obj *const delta_out)
 Process any elements of the shadow relevant to this library.
 
int nrf_cloud_coap_bytes_send (uint8_t *buf, size_t buf_len, bool confirmable)
 Send raw bytes to nRF Cloud on the /msg/d2c/raw topic. The data sent can be for any purpose.
 
int nrf_cloud_coap_obj_send (struct nrf_cloud_obj *const obj, bool confirmable)
 Send an nRF Cloud object.
 

Detailed Description

The functions in this library can return either positive or negative return values.

Negative values are standard device-side errors defined in errno.h. These indicate a failure to send the request to the cloud for various reasons, such as the device is not connected to the cloud or the request contains invalid parameters.

Positive values are cloud-side errors (CoAP result codes). These indicate the cloud received the request but rejected it. This can occur either because of the request itself or because of a cloud-side error. See the specific result code for details. These are defined in zephyr/net/coap.h.