nRF Connect SDK API 2.8.0
Loading...
Searching...
No Matches
nrf_cloud_rest.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
12#ifndef NRF_CLOUD_REST_H__
13#define NRF_CLOUD_REST_H__
14
15#include <zephyr/types.h>
16#include <net/nrf_cloud.h>
17#include <net/nrf_cloud_pgps.h>
19#include <modem/lte_lc.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
44
54
55#define NRF_CLOUD_REST_TIMEOUT_NONE (SYS_FOREVER_MS)
56
117
131
136 struct nrf_modem_gnss_agnss_data_frame *agnss_req;
152 uint8_t mask_angle;
153};
154
158 char *buf;
160 size_t buf_sz;
162 size_t agnss_sz;
163};
164
172
187 struct nrf_cloud_rest_location_request const *const request,
188 struct nrf_cloud_location_result *const result);
189
190#if defined(CONFIG_NRF_CLOUD_AGNSS)
218 struct nrf_cloud_rest_agnss_request const *const request,
219 struct nrf_cloud_rest_agnss_result *const result);
220#endif /* CONFIG_NRF_CLOUD_AGNSS */
221
222#if defined(CONFIG_NRF_CLOUD_PGPS)
237 struct nrf_cloud_rest_pgps_request const *const request);
238#endif
239
258 const char *const device_id, struct nrf_cloud_fota_job_info *const job);
259
267
284 const char *const device_id, const char *const job_id,
285 const enum nrf_cloud_fota_status status, const char * const details);
286
304 const char *const device_id, char const *const transform);
305
318 const char *const device_id, const char * const shadow_json);
319
332 const char *const device_id, const struct nrf_cloud_svc_info * const svc_inf);
333
346 const char *const device_id, const struct nrf_cloud_device_status *const dev_status);
347
363
379int nrf_cloud_rest_jitp(const sec_tag_t nrf_cloud_sec_tag);
380
396 const char *const device_id, const char *const json_msg, const bool bulk,
397 const char *const topic);
398
411 const char *const device_id, const struct nrf_cloud_gnss_data * const gnss);
412
427 const char *const device_id, const struct nrf_cloud_device_status *const dev_status,
428 const int64_t timestamp_ms);
429
432#ifdef __cplusplus
433}
434#endif
435
436#endif /* NRF_CLOUD_REST_H__ */
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_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,...
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_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.
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,...
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.
nrf_cloud_rest_agnss_req_type
nRF Cloud AGNSS REST request types
Definition nrf_cloud_rest.h:46
@ NRF_CLOUD_REST_AGNSS_REQ_LOCATION
Definition nrf_cloud_rest.h:50
@ NRF_CLOUD_REST_AGNSS_REQ_ASSISTANCE
Definition nrf_cloud_rest.h:48
@ NRF_CLOUD_REST_AGNSS_REQ_CUSTOM
Definition nrf_cloud_rest.h:52
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_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_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.
nrf_cloud_http_status
HTTP status codes returned from nRF Cloud.
Definition nrf_cloud_rest.h:30
@ NRF_CLOUD_HTTP_STATUS_NOT_FOUND
Definition nrf_cloud_rest.h:40
@ NRF_CLOUD_HTTP_STATUS_BAD_REQ
Definition nrf_cloud_rest.h:37
@ NRF_CLOUD_HTTP_STATUS_NONE
Definition nrf_cloud_rest.h:32
@ NRF_CLOUD_HTTP_STATUS_BAD_RANGE
Definition nrf_cloud_rest.h:41
@ NRF_CLOUD_HTTP_STATUS_UNPROC_ENTITY
Definition nrf_cloud_rest.h:42
@ NRF_CLOUD_HTTP_STATUS_UNHANDLED
Definition nrf_cloud_rest.h:31
@ NRF_CLOUD_HTTP_STATUS__ERROR_BEGIN
Definition nrf_cloud_rest.h:36
@ NRF_CLOUD_HTTP_STATUS_PARTIAL
Definition nrf_cloud_rest.h:35
@ NRF_CLOUD_HTTP_STATUS_UNAUTH
Definition nrf_cloud_rest.h:38
@ NRF_CLOUD_HTTP_STATUS_FORBIDDEN
Definition nrf_cloud_rest.h:39
@ NRF_CLOUD_HTTP_STATUS_ACCEPTED
Definition nrf_cloud_rest.h:34
@ NRF_CLOUD_HTTP_STATUS_OK
Definition nrf_cloud_rest.h:33
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_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_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_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 sect...
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_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.
nrf_cloud_fota_status
FOTA status reported to nRF Cloud and notified in nrf_cloud_fota_poll_handler_t.
Definition nrf_cloud.h:288
nrf_cloud_error
nRF Cloud error codes. See the Error Codes section of nRF Cloud API documentation for more informatio...
Definition nrf_cloud.h:210
Module to provide nRF Cloud location support to nRF9160 SiP.
Module to provide nRF Cloud Predicted GPS (P-GPS) support to nRF9160 SiP.
P-GPS request type.
Definition nrf_cloud_pgps.h:83
Definition lte_lc.h:529
Structure to specify which components are added to the encoded device status object.
Definition nrf_cloud.h:532
Common FOTA job info.
Definition nrf_cloud.h:327
GNSS data to be sent to nRF Cloud as a device message.
Definition nrf_cloud.h:607
Location request config.
Definition nrf_cloud_location.h:97
Location request result.
Definition nrf_cloud_location.h:61
struct nrf_modem_gnss_agnss_data_frame * agnss_req
Definition nrf_cloud_rest.h:136
enum nrf_cloud_rest_agnss_req_type type
Definition nrf_cloud_rest.h:134
uint8_t mask_angle
Definition nrf_cloud_rest.h:152
bool filtered
Definition nrf_cloud_rest.h:146
struct lte_lc_cells_info * net_info
Definition nrf_cloud_rest.h:140
Data required for nRF Cloud Assisted GNSS (A-GNSS) request.
Definition nrf_cloud_rest.h:133
size_t agnss_sz
Definition nrf_cloud_rest.h:162
char * buf
Definition nrf_cloud_rest.h:158
size_t buf_sz
Definition nrf_cloud_rest.h:160
nRF Cloud Assisted GNSS (A-GNSS) result
Definition nrf_cloud_rest.h:156
bool keep_alive
Definition nrf_cloud_rest.h:68
size_t total_response_len
Definition nrf_cloud_rest.h:112
size_t response_len
Definition nrf_cloud_rest.h:110
char * rx_buf
Definition nrf_cloud_rest.h:94
char * response
Definition nrf_cloud_rest.h:108
int connect_socket
Definition nrf_cloud_rest.h:63
size_t fragment_size
Definition nrf_cloud_rest.h:102
int32_t timeout_ms
Definition nrf_cloud_rest.h:76
size_t rx_buf_len
Definition nrf_cloud_rest.h:96
enum nrf_cloud_http_status status
Definition nrf_cloud_rest.h:106
enum nrf_cloud_error nrf_err
Definition nrf_cloud_rest.h:115
char * auth
Definition nrf_cloud_rest.h:87
Parameters and data for using the nRF Cloud REST API.
Definition nrf_cloud_rest.h:58
struct lte_lc_cells_info * cell_info
Definition nrf_cloud_rest.h:121
struct wifi_scan_info * wifi_info
Definition nrf_cloud_rest.h:127
const struct nrf_cloud_location_config * config
Definition nrf_cloud_rest.h:129
Data required for nRF Cloud location request.
Definition nrf_cloud_rest.h:119
const struct gps_pgps_request * pgps_req
Definition nrf_cloud_rest.h:170
Data required for nRF Cloud Predicted GPS (P-GPS) request.
Definition nrf_cloud_rest.h:166
Structure to specify which components are added to the encoded service info object.
Definition nrf_cloud.h:521
Access points found during a Wi-Fi scan.
Definition wifi_location_common.h:29