nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
nrf_cloud_codec.h File Reference
#include <net/nrf_cloud.h>
#include <net/nrf_cloud_pgps.h>
#include <nrf_modem_gnss.h>
#include <net/wifi_location_common.h>
#include <modem/lte_lc.h>
#include <cJSON.h>
#include <net/nrf_cloud_location.h>

Go to the source code of this file.

Data Structures

struct  nrf_cloud_obj_coap_cbor
 Object to support nRF Cloud CoAP CBOR messages. More...
 
struct  nrf_cloud_obj
 Object used for building nRF Cloud messages. More...
 
struct  nrf_cloud_obj_shadow_delta
 Object containing shadow delta data. More...
 
struct  nrf_cloud_obj_shadow_accepted
 Object containing the accepted shadow data. More...
 
struct  nrf_cloud_obj_shadow_transform_result
 
struct  nrf_cloud_obj_shadow_transform_error
 
struct  nrf_cloud_obj_shadow_transform
 
struct  nrf_cloud_obj_shadow_data
 Object containing shadow update data. More...
 

Macros

#define NRF_CLOUD_OBJ_JSON_DEFINE(_name)
 Define an nRF Cloud JSON object.
 
#define NRF_CLOUD_OBJ_COAP_CBOR_DEFINE(_name)
 
#define NRF_CLOUD_OBJ_DEFINE(_name, _type)
 Define an nRF Cloud codec object of the specified type.
 
#define NRF_CLOUD_OBJ_PRE_ENC_DEFINE(_name, _data, _len)
 Define an nRF Cloud object with pre-encoded data.
 
#define NRF_CLOUD_OBJ_TYPE_VALID(_obj_ptr)
 Check if the provided object is a valid nRF Cloud codec object type.
 

Enumerations

enum  nrf_cloud_obj_type { NRF_CLOUD_OBJ_TYPE__UNDEFINED , NRF_CLOUD_OBJ_TYPE_JSON , NRF_CLOUD_OBJ_TYPE_COAP_CBOR , NRF_CLOUD_OBJ_TYPE__LAST }
 Object types for encoding and decoding. More...
 
enum  nrf_cloud_enc_src { NRF_CLOUD_ENC_SRC_NONE , NRF_CLOUD_ENC_SRC_CLOUD_ENCODED , NRF_CLOUD_ENC_SRC_PRE_ENCODED }
 Encoded data sources. More...
 
enum  nrf_cloud_data_type {
  NRF_CLOUD_DATA_TYPE_NONE , NRF_CLOUD_DATA_TYPE_PVT , NRF_CLOUD_DATA_TYPE_STR , NRF_CLOUD_DATA_TYPE_DOUBLE ,
  NRF_CLOUD_DATA_TYPE_INT
}
 Data types for nrf_cloud_sensor_data. More...
 
enum  nrf_cloud_obj_shadow_type { NRF_CLOUD_OBJ_SHADOW_TYPE_DELTA , NRF_CLOUD_OBJ_SHADOW_TYPE_ACCEPTED , NRF_CLOUD_OBJ_SHADOW_TYPE_TF }
 Types of shadow updates. More...
 

Functions

int nrf_cloud_obj_input_decode (struct nrf_cloud_obj *const obj, const struct nrf_cloud_data *const input)
 Decode data received from nRF Cloud.
 
int nrf_cloud_obj_msg_check (const struct nrf_cloud_obj *const obj, const char *const app_id, const char *const msg_type)
 Check if the object contains the specified app ID and message type.
 
int nrf_cloud_obj_num_get (const struct nrf_cloud_obj *const obj, const char *const key, double *num)
 Get the number value associated with the provided key.
 
int nrf_cloud_obj_str_get (const struct nrf_cloud_obj *const obj, const char *const key, char **str)
 Get the string value associated with the provided key.
 
int nrf_cloud_obj_bool_get (const struct nrf_cloud_obj *const obj, const char *const key, bool *val)
 Get the boolean value associated with the provided key.
 
int nrf_cloud_obj_object_detach (struct nrf_cloud_obj *const obj, const char *const key, struct nrf_cloud_obj *const obj_out)
 Get and detach the object associated with the provided key.
 
int nrf_cloud_obj_msg_init (struct nrf_cloud_obj *const obj, const char *const app_id, const char *const msg_type)
 Initialize an object as an nRF Cloud device message.
 
int nrf_cloud_obj_bulk_init (struct nrf_cloud_obj *const bulk)
 Initialize an object as an nRF Cloud bulk message.
 
int nrf_cloud_obj_init (struct nrf_cloud_obj *const obj)
 Initialize an empty object.
 
int nrf_cloud_obj_reset (struct nrf_cloud_obj *const obj)
 Reset the state of an object; does not free memory.
 
int nrf_cloud_obj_free (struct nrf_cloud_obj *const obj)
 Free the memory of an initialized object.
 
bool nrf_cloud_obj_bulk_check (struct nrf_cloud_obj *const obj)
 Check if an object is a JSON array eligible for bulk transfer.
 
int nrf_cloud_obj_bulk_add (struct nrf_cloud_obj *const bulk, struct nrf_cloud_obj *const obj)
 Add an object to a bulk message object.
 
int nrf_cloud_obj_ts_add (struct nrf_cloud_obj *const obj, const int64_t time_ms)
 Add a timestamp to an object.
 
int nrf_cloud_obj_num_add (struct nrf_cloud_obj *const obj, const char *const key, const double val, const bool data_child)
 Add a key string and number value to the provided object.
 
int nrf_cloud_obj_str_add (struct nrf_cloud_obj *const obj, const char *const key, const char *const val, const bool data_child)
 Add a key string and string value to the provided object.
 
int nrf_cloud_obj_bool_add (struct nrf_cloud_obj *const obj, const char *const key, const bool val, const bool data_child)
 Add a key string and boolean value to the provided object.
 
int nrf_cloud_obj_null_add (struct nrf_cloud_obj *const obj, const char *const key, const bool data_child)
 Add a key string and null value to the provided object.
 
int nrf_cloud_obj_object_add (struct nrf_cloud_obj *const obj, const char *const key, struct nrf_cloud_obj *const obj_to_add, const bool data_child)
 Add a key string and object to the provided object.
 
int nrf_cloud_obj_int_array_add (struct nrf_cloud_obj *const obj, const char *const key, const uint32_t ints[], const uint32_t ints_cnt, const bool data_child)
 Add a key string and integer array value to the provided object.
 
int nrf_cloud_obj_str_array_add (struct nrf_cloud_obj *const obj, const char *const key, const char *const strs[], const uint32_t strs_cnt, const bool data_child)
 Add a key string and string array value to the provided object.
 
int nrf_cloud_obj_cloud_encode (struct nrf_cloud_obj *const obj)
 Encode the object's data for transport to nRF Cloud.
 
int nrf_cloud_obj_cloud_encoded_free (struct nrf_cloud_obj *const obj)
 Free the memory of the encoded data in the object.
 
int nrf_cloud_obj_gnss_msg_create (struct nrf_cloud_obj *const obj, const struct nrf_cloud_gnss_data *const gnss)
 Create an nRF Cloud GNSS message object.
 
int nrf_cloud_obj_location_request_create (struct nrf_cloud_obj *const obj, const struct lte_lc_cells_info *const cells_inf, const struct wifi_scan_info *const wifi_inf, const struct nrf_cloud_location_config *const config)
 Create an nRF Cloud Location request message object.
 
int nrf_cloud_obj_pvt_add (struct nrf_cloud_obj *const obj, const struct nrf_cloud_gnss_pvt *const pvt)
 Add PVT data to the provided object.
 
int nrf_cloud_obj_modem_pvt_add (struct nrf_cloud_obj *const obj, const struct nrf_modem_gnss_pvt_data_frame *const mdm_pvt)
 Add modem PVT data to the provided object.
 
int nrf_cloud_obj_pgps_request_create (struct nrf_cloud_obj *const obj, const struct gps_pgps_request *const request)
 Create an nRF Cloud P-GPS request device message object.
 
int nrf_cloud_gnss_msg_json_encode (const struct nrf_cloud_gnss_data *const gnss, cJSON *const gnss_msg_obj)
 Create an nRF Cloud GNSS device message using the provided GNSS data.
 
int nrf_cloud_service_info_json_encode (const struct nrf_cloud_svc_info *const svc_inf, cJSON *const svc_inf_obj)
 Add service info into the provided cJSON object.
 
int nrf_cloud_modem_info_json_encode (const struct nrf_cloud_modem_info *const mod_inf, cJSON *const mod_inf_obj)
 Add modem info into the provided cJSON object.
 
int nrf_cloud_error_msg_decode (const char *const buf, const char *const app_id, const char *const msg_type, enum nrf_cloud_error *const err)
 Check for a JSON error message in the data received from nRF Cloud over MQTT.
 
int nrf_cloud_obj_shadow_delta_response_encode (struct nrf_cloud_obj *const delta_state_obj, bool accept)
 Encode the response to the shadow delta update.