nRF Connect SDK API 2.8.0
Loading...
Searching...
No Matches
nrf_cloud_coap.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef NRF_CLOUD_COAP_H_
8#define NRF_CLOUD_COAP_H_
9
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#include <net/nrf_cloud_rest.h>
19#if defined(CONFIG_NRF_CLOUD_AGNSS)
20#include <net/nrf_cloud_agnss.h>
21#endif
22#if defined(CONFIG_NRF_CLOUD_PGPS)
23#include <net/nrf_cloud_pgps.h>
24#endif
25#include <net/nrf_cloud_codec.h>
26#if defined(CONFIG_NRF_CLOUD_COAP)
27#include <zephyr/net/coap.h>
28#include <zephyr/net/coap_client.h>
29#else
30/* Work around missing Kconfigs upstream in coap_client.h */
31#define coap_client_response_cb_t void *
35struct coap_client {};
37#endif
38
55/* Transport functions */
61
81int nrf_cloud_coap_connect(const char * const app_ver);
82
101
113
122
134
135/* nRF Cloud service functions */
136
154 struct nrf_cloud_rest_agnss_result *result);
155
173 struct nrf_cloud_pgps_result *file_location);
174
195int nrf_cloud_coap_sensor_send(const char *app_id, double value, int64_t ts_ms, bool confirmable);
196
218int nrf_cloud_coap_message_send(const char *app_id, const char *message, bool json, int64_t ts_ms,
219 bool confirmable);
220
239int nrf_cloud_coap_json_message_send(const char *message, bool bulk, bool confirmable);
240
257int nrf_cloud_coap_location_send(const struct nrf_cloud_gnss_data * const gnss, bool confirmable);
258
274 struct nrf_cloud_location_result *const result);
275
291
299
314int nrf_cloud_coap_fota_job_update(const char *const job_id,
315 const enum nrf_cloud_fota_status status, const char * const details);
316
341int nrf_cloud_coap_shadow_get(char *buf, size_t *buf_len, bool delta,
342 enum coap_content_format format);
343
357int nrf_cloud_coap_shadow_state_update(const char * const shadow_json);
358
372int nrf_cloud_coap_shadow_desired_update(const char * const shadow_json);
373
387 *const dev_status);
388
401
419 struct nrf_cloud_obj *const delta_out);
420
435int nrf_cloud_coap_bytes_send(uint8_t *buf, size_t buf_len, bool confirmable);
436
455int nrf_cloud_coap_obj_send(struct nrf_cloud_obj *const obj, bool confirmable);
456
459#ifdef __cplusplus
460}
461#endif
462
463#endif /* NRF_CLOUD_COAP_H_ */
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.
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_shadow_device_status_update(const struct nrf_cloud_device_status *const dev_status)
Update the device's reported shadow section with information about the device, network,...
bool nrf_cloud_coap_keepopen_is_supported(void)
Check if you can pause and resume safely.
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_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_init(void)
Initialize nRF Cloud CoAP library.
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_resume(void)
Resume CoAP connection.
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_shadow_desired_update(const char *const shadow_json)
Update the device's "desired state" in the shadow through the state/desired CoAP resource....
int nrf_cloud_coap_obj_send(struct nrf_cloud_obj *const obj, bool confirmable)
Send an nRF Cloud object.
int nrf_cloud_coap_fota_job_get(struct nrf_cloud_fota_job_info *const job)
Request current nRF Cloud FOTA job info for the device.
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_pause(void)
Pause CoAP connection.
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_disconnect(void)
Disconnect the nRF Cloud CoAP connection.
int nrf_cloud_coap_shadow_service_info_update(const struct nrf_cloud_svc_info *const svc_inf)
Update the device's "serviceInfo" section in the shadow. This section informs nRF Cloud of the device...
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_shadow_state_update(const char *const shadow_json)
Update the device's "reported state" in the shadow through the state/update CoAP resource....
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_connect(const char *const app_ver)
Connect to and obtain authorization to access the nRF Cloud CoAP server. The full DTLS handshake is p...
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. The delta section indicates differences between t...
nrf_cloud_fota_status
FOTA status reported to nRF Cloud and notified in nrf_cloud_fota_poll_handler_t.
Definition nrf_cloud.h:288
Module to provide nRF Cloud A-GNSS support to nRF9160 SiP.
coap_content_format
Definition nrf_cloud_coap.h:32
@ dummy
Definition nrf_cloud_coap.h:33
Module to provide nRF Cloud Predicted GPS (P-GPS) support to nRF9160 SiP.
nRF Cloud REST API.
Definition nrf_cloud_coap.h:36
Definition nrf_cloud_coap.h:35
Generic encapsulation for any data that is sent to the cloud.
Definition nrf_cloud.h:375
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 result.
Definition nrf_cloud_location.h:61
Object used for building nRF Cloud messages.
Definition nrf_cloud_codec.h:84
nRF Cloud Predicted GPS (P-GPS) result; the location of the P-GPS data file which is to be downloaded...
Definition nrf_cloud_pgps.h:102
Data required for nRF Cloud Assisted GNSS (A-GNSS) request.
Definition nrf_cloud_rest.h:133
nRF Cloud Assisted GNSS (A-GNSS) result
Definition nrf_cloud_rest.h:156
Data required for nRF Cloud location request.
Definition nrf_cloud_rest.h:119
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