nRF Connect SDK API 2.8.0
Loading...
Searching...
No Matches
nrf_cloud_rest.h File Reference

nRF Cloud REST API. More...

#include <zephyr/types.h>
#include <net/nrf_cloud.h>
#include <net/nrf_cloud_pgps.h>
#include <net/nrf_cloud_location.h>
#include <modem/lte_lc.h>

Go to the source code of this file.

Data Structures

struct  nrf_cloud_rest_context
 Parameters and data for using the nRF Cloud REST API. More...
 
struct  nrf_cloud_rest_location_request
 Data required for nRF Cloud location request. More...
 
struct  nrf_cloud_rest_agnss_request
 Data required for nRF Cloud Assisted GNSS (A-GNSS) request. More...
 
struct  nrf_cloud_rest_agnss_result
 nRF Cloud Assisted GNSS (A-GNSS) result More...
 
struct  nrf_cloud_rest_pgps_request
 Data required for nRF Cloud Predicted GPS (P-GPS) request. More...
 

Macros

#define NRF_CLOUD_REST_TIMEOUT_NONE   (SYS_FOREVER_MS)
 

Enumerations

enum  nrf_cloud_http_status {
  NRF_CLOUD_HTTP_STATUS_UNHANDLED = -1 , NRF_CLOUD_HTTP_STATUS_NONE = 0 , NRF_CLOUD_HTTP_STATUS_OK = 200 , NRF_CLOUD_HTTP_STATUS_ACCEPTED = 202 ,
  NRF_CLOUD_HTTP_STATUS_PARTIAL = 206 , NRF_CLOUD_HTTP_STATUS__ERROR_BEGIN = 400 , NRF_CLOUD_HTTP_STATUS_BAD_REQ = NRF_CLOUD_HTTP_STATUS__ERROR_BEGIN , NRF_CLOUD_HTTP_STATUS_UNAUTH = 401 ,
  NRF_CLOUD_HTTP_STATUS_FORBIDDEN = 403 , NRF_CLOUD_HTTP_STATUS_NOT_FOUND = 404 , NRF_CLOUD_HTTP_STATUS_BAD_RANGE = 416 , NRF_CLOUD_HTTP_STATUS_UNPROC_ENTITY = 422
}
 HTTP status codes returned from nRF Cloud. More...
 
enum  nrf_cloud_rest_agnss_req_type { NRF_CLOUD_REST_AGNSS_REQ_ASSISTANCE , NRF_CLOUD_REST_AGNSS_REQ_LOCATION , NRF_CLOUD_REST_AGNSS_REQ_CUSTOM }
 nRF Cloud AGNSS REST request types More...
 

Functions

int nrf_cloud_rest_location_get (struct nrf_cloud_rest_context *const rest_ctx, struct nrf_cloud_rest_location_request const *const request, struct nrf_cloud_location_result *const result)
 nRF Cloud location request.
 
int nrf_cloud_rest_agnss_data_get (struct nrf_cloud_rest_context *const rest_ctx, struct nrf_cloud_rest_agnss_request const *const request, struct nrf_cloud_rest_agnss_result *const result)
 nRF Cloud Assisted GNSS (A-GNSS) data request.
 
int nrf_cloud_rest_pgps_data_get (struct nrf_cloud_rest_context *const rest_ctx, struct nrf_cloud_rest_pgps_request const *const request)
 nRF Cloud Predicted GPS (P-GPS) data request.
 
int nrf_cloud_rest_fota_job_get (struct nrf_cloud_rest_context *const rest_ctx, const char *const device_id, struct nrf_cloud_fota_job_info *const job)
 Requests nRF Cloud FOTA job info for the specified device.
 
void nrf_cloud_rest_fota_job_free (struct nrf_cloud_fota_job_info *const job)
 Frees memory allocated by nrf_cloud_rest_fota_job_get.
 
int nrf_cloud_rest_fota_job_update (struct nrf_cloud_rest_context *const rest_ctx, const char *const device_id, const char *const job_id, const enum nrf_cloud_fota_status status, const char *const details)
 Updates the status of the specified nRF Cloud FOTA job.
 
int nrf_cloud_rest_shadow_transform_request (struct nrf_cloud_rest_context *const rest_ctx, const char *const device_id, char const *const transform)
 Request shadow data using a JSONata expression. For example, to request the reported device info section, the transform would be: "state.reported.device.deviceInfo".
 
int nrf_cloud_rest_shadow_state_update (struct nrf_cloud_rest_context *const rest_ctx, const char *const device_id, const char *const shadow_json)
 Updates the device's "state" in the shadow via the UpdateDeviceState endpoint.
 
int nrf_cloud_rest_shadow_service_info_update (struct nrf_cloud_rest_context *const rest_ctx, const char *const device_id, const struct nrf_cloud_svc_info *const svc_inf)
 Updates the device's "ServiceInfo" in the shadow.
 
int nrf_cloud_rest_shadow_device_status_update (struct nrf_cloud_rest_context *const rest_ctx, const char *const device_id, const struct nrf_cloud_device_status *const dev_status)
 Update the device status in the shadow.
 
int nrf_cloud_rest_disconnect (struct nrf_cloud_rest_context *const rest_ctx)
 Closes the connection to the server. The socket pointed to by rest_ctx.connect_socket will be closed, and rest_ctx.connect_socket will be set to -1.
 
int nrf_cloud_rest_jitp (const sec_tag_t nrf_cloud_sec_tag)
 Performs just-in-time provisioning (JITP) with nRF Cloud.
 
int nrf_cloud_rest_send_device_message (struct nrf_cloud_rest_context *const rest_ctx, const char *const device_id, const char *const json_msg, const bool bulk, const char *const topic)
 Send a JSON formatted device message using the SendDeviceMessage endpoint.
 
int nrf_cloud_rest_send_location (struct nrf_cloud_rest_context *const rest_ctx, const char *const device_id, const struct nrf_cloud_gnss_data *const gnss)
 Send GNSS data to nRF Cloud as a device message.
 
int nrf_cloud_rest_device_status_message_send (struct nrf_cloud_rest_context *const rest_ctx, const char *const device_id, const struct nrf_cloud_device_status *const dev_status, const int64_t timestamp_ms)
 Send the device status to nRF Cloud as a device message. In addition to standard message storage, the data will also be stored in the device's shadow.
 

Detailed Description

nRF Cloud REST API.