nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
nRF Cloud

Data Structures

struct  nrf_cloud_fota_job_info
 Common FOTA job info. More...
 
struct  nrf_cloud_settings_fota_job
 FOTA job info provided to the settings module to track FOTA job status. More...
 
struct  nrf_cloud_data
 Generic encapsulation for any data that is sent to the cloud. More...
 
struct  nrf_cloud_topic
 MQTT topic. More...
 
struct  nrf_cloud_sensor_data
 Sensor data transmission parameters. More...
 
struct  nrf_cloud_evt
 Asynchronous events received from the module. More...
 
struct  nrf_cloud_tx_data
 Structure used to send data to nRF Cloud. More...
 
struct  nrf_cloud_svc_info_fota
 Controls which values are added to the FOTA array in the "serviceInfo" shadow section. More...
 
struct  nrf_cloud_svc_info_ui
 DEPRECATED - No longer used by nRF Cloud The device data cards on the nRF Cloud portal automatically appear when the device sends messages with the proper schema: https://github.com/nRFCloud/application-protocols/tree/v1/schemas/deviceToCloud Custom cards are generated for appIds that are not present in the schema. More...
 
struct  nrf_cloud_modem_info
 Modem info data and which sections should be encoded. More...
 
struct  nrf_cloud_svc_info
 Structure to specify which components are added to the encoded service info object. More...
 
struct  nrf_cloud_device_status
 Structure to specify which components are added to the encoded device status object. More...
 
struct  nrf_cloud_gnss_pvt
 PVT data. More...
 
struct  nrf_cloud_credentials_status
 
struct  nrf_cloud_gnss_nmea
 NMEA data. More...
 
struct  nrf_cloud_gnss_data
 GNSS data to be sent to nRF Cloud as a device message. More...
 
struct  nrf_cloud_gw_data
 Structure to hold message received from nRF Cloud. More...
 
struct  nrf_cloud_ctrl_data
 Data to control behavior of the nrf_cloud library from the cloud side. This data is stored in the device shadow. More...
 
struct  nrf_cloud_init_param
 Initialization parameters for the module. More...
 

Macros

#define NCT_MSG_ID_USE_NEXT_INCREMENT   0
 
#define NCT_MSG_ID_CC_SUB   100
 
#define NCT_MSG_ID_DC_SUB   101
 
#define NCT_MSG_ID_FOTA_SUB   103
 
#define NCT_MSG_ID_CC_UNSUB   150
 
#define NCT_MSG_ID_DC_UNSUB   151
 
#define NCT_MSG_ID_FOTA_UNSUB   153
 
#define NCT_MSG_ID_STATE_REQUEST   200
 
#define NCT_MSG_ID_FOTA_REQUEST   201
 
#define NCT_MSG_ID_FOTA_BLE_REQUEST   202
 
#define NCT_MSG_ID_STATE_REPORT   300
 
#define NCT_MSG_ID_PAIR_STATUS_REPORT   301
 
#define NCT_MSG_ID_FOTA_REPORT   302
 
#define NCT_MSG_ID_FOTA_BLE_REPORT   303
 
#define NCT_MSG_ID_INCREMENT_BEGIN   1000
 
#define NCT_MSG_ID_INCREMENT_END   9999
 
#define NCT_MSG_ID_USER_TAG_BEGIN   (NCT_MSG_ID_INCREMENT_END + 1)
 
#define NCT_MSG_ID_USER_TAG_END   0xFFFF /* MQTT message IDs are uint16_t */
 
#define IS_VALID_USER_TAG(tag)
 
#define NRF_CLOUD_JWT_VALID_TIME_S_MAX   (7 * 24 * 60 * 60)
 
#define NRF_CLOUD_JWT_VALID_TIME_S_DEF   (10 * 60)
 
#define NRF_CLOUD_NO_TIMESTAMP   0
 
#define NRF_CLOUD_FOTA_JOB_ID_SIZE   (32 + 4 + 1)
 

Typedefs

typedef void(* nrf_cloud_event_handler_t) (const struct nrf_cloud_evt *evt)
 Event handler registered with the module to handle asynchronous events from the module.
 

Enumerations

enum  nrf_cloud_evt_type {
  NRF_CLOUD_EVT_TRANSPORT_CONNECTED = 0x1 , NRF_CLOUD_EVT_TRANSPORT_CONNECTING , NRF_CLOUD_EVT_USER_ASSOCIATION_REQUEST , NRF_CLOUD_EVT_USER_ASSOCIATED ,
  NRF_CLOUD_EVT_READY , NRF_CLOUD_EVT_RX_DATA_GENERAL , NRF_CLOUD_EVT_RX_DATA_DISCON , NRF_CLOUD_EVT_RX_DATA_LOCATION ,
  NRF_CLOUD_EVT_RX_DATA_SHADOW , NRF_CLOUD_EVT_PINGRESP , NRF_CLOUD_EVT_SENSOR_DATA_ACK , NRF_CLOUD_EVT_TRANSPORT_DISCONNECTED ,
  NRF_CLOUD_EVT_FOTA_START , NRF_CLOUD_EVT_FOTA_DONE , NRF_CLOUD_EVT_FOTA_ERROR , NRF_CLOUD_EVT_TRANSPORT_CONNECT_ERROR ,
  NRF_CLOUD_EVT_FOTA_JOB_AVAILABLE , NRF_CLOUD_EVT_ERROR = 0xFF
}
 Asynchronous nRF Cloud events notified by the module. More...
 
enum  nrf_cloud_error_status {
  NRF_CLOUD_ERR_STATUS_NONE = 0 , NRF_CLOUD_ERR_STATUS_MQTT_CONN_FAIL , NRF_CLOUD_ERR_STATUS_MQTT_CONN_BAD_PROT_VER , NRF_CLOUD_ERR_STATUS_MQTT_CONN_ID_REJECTED ,
  NRF_CLOUD_ERR_STATUS_MQTT_CONN_SERVER_UNAVAIL , NRF_CLOUD_ERR_STATUS_MQTT_CONN_BAD_USR_PWD , NRF_CLOUD_ERR_STATUS_MQTT_CONN_NOT_AUTH , NRF_CLOUD_ERR_STATUS_MQTT_SUB_FAIL ,
  NRF_CLOUD_ERR_STATUS_AGNSS_PROC , NRF_CLOUD_ERR_STATUS_PGPS_PROC
}
 nRF Cloud error status, used to describe NRF_CLOUD_EVT_ERROR event. More...
 
enum  nrf_cloud_disconnect_status { NRF_CLOUD_DISCONNECT_USER_REQUEST , NRF_CLOUD_DISCONNECT_CLOSED_BY_REMOTE , NRF_CLOUD_DISCONNECT_INVALID_REQUEST , NRF_CLOUD_DISCONNECT_MISC }
 nRF Cloud disconnect status, used to describe NRF_CLOUD_EVT_TRANSPORT_DISCONNECTED event. More...
 
enum  nrf_cloud_connect_result {
  NRF_CLOUD_CONNECT_RES_SUCCESS = 0 , NRF_CLOUD_CONNECT_RES_ERR_NOT_INITD = -1 , NRF_CLOUD_CONNECT_RES_ERR_NETWORK = -3 , NRF_CLOUD_CONNECT_RES_ERR_BACKEND = -4 ,
  NRF_CLOUD_CONNECT_RES_ERR_MISC = -5 , NRF_CLOUD_CONNECT_RES_ERR_NO_MEM = -6 , NRF_CLOUD_CONNECT_RES_ERR_PRV_KEY = -7 , NRF_CLOUD_CONNECT_RES_ERR_CERT = -8 ,
  NRF_CLOUD_CONNECT_RES_ERR_CERT_MISC = -9 , NRF_CLOUD_CONNECT_RES_ERR_TIMEOUT_NO_DATA = -10 , NRF_CLOUD_CONNECT_RES_ERR_ALREADY_CONNECTED = -11
}
 nRF Cloud connect result. Used as return value for nrf_cloud_connect() and to describe NRF_CLOUD_EVT_TRANSPORT_CONNECT_ERROR event. More...
 
enum  nrf_cloud_error {
  NRF_CLOUD_ERROR_UNKNOWN = -1 , NRF_CLOUD_ERROR_NONE = 0 , NRF_CLOUD_ERROR_BAD_REQUEST = 40000 , NRF_CLOUD_ERROR_INVALID_CERT = 40001 ,
  NRF_CLOUD_ERROR_DISSOCIATE = 40002 , NRF_CLOUD_ERROR_ACCESS_DENIED = 40100 , NRF_CLOUD_ERROR_DEV_ID_IN_USE = 40101 , NRF_CLOUD_ERROR_INVALID_OWNER_CODE = 40102 ,
  NRF_CLOUD_ERROR_DEV_NOT_ASSOCIATED = 40103 , NRF_CLOUD_ERROR_DATA_NOT_FOUND = 40410 , NRF_CLOUD_ERROR_NRF_DEV_NOT_FOUND = 40411 , NRF_CLOUD_ERROR_NO_DEV_NOT_PROV = 40412 ,
  NRF_CLOUD_ERROR_NO_DEV_DISSOCIATE = 40413 , NRF_CLOUD_ERROR_NO_DEV_DELETE = 40414 , NRF_CLOUD_ERROR_NOT_FOUND_NO_ERROR = 40499 , NRF_CLOUD_ERROR_BAD_RANGE = 41600 ,
  NRF_CLOUD_ERROR_VALIDATION = 42200 , NRF_CLOUD_ERROR_INTERNAL_SERVER = 50010
}
 nRF Cloud error codes. See the Error Codes section of nRF Cloud API documentation for more information. More...
 
enum  nrf_cloud_sensor {
  NRF_CLOUD_SENSOR_GNSS , NRF_CLOUD_SENSOR_FLIP , NRF_CLOUD_SENSOR_BUTTON , NRF_CLOUD_SENSOR_TEMP ,
  NRF_CLOUD_SENSOR_HUMID , NRF_CLOUD_SENSOR_AIR_PRESS , NRF_CLOUD_SENSOR_AIR_QUAL , NRF_CLOUD_LTE_LINK_RSRP ,
  NRF_CLOUD_LOG , NRF_CLOUD_DICTIONARY_LOG , NRF_CLOUD_DEVICE_INFO , NRF_CLOUD_SENSOR_LIGHT
}
 Sensor types supported by the nRF Cloud. More...
 
enum  nrf_cloud_topic_type { NRF_CLOUD_TOPIC_STATE = 0x1 , NRF_CLOUD_TOPIC_MESSAGE , NRF_CLOUD_TOPIC_BULK , NRF_CLOUD_TOPIC_BIN }
 Topic types supported by nRF Cloud. More...
 
enum  nrf_cloud_fota_status {
  NRF_CLOUD_FOTA_QUEUED = 0 , NRF_CLOUD_FOTA_IN_PROGRESS = 1 , NRF_CLOUD_FOTA_FAILED = 2 , NRF_CLOUD_FOTA_SUCCEEDED = 3 ,
  NRF_CLOUD_FOTA_TIMED_OUT = 4 , NRF_CLOUD_FOTA_CANCELED = 5 , NRF_CLOUD_FOTA_REJECTED = 6 , NRF_CLOUD_FOTA_DOWNLOADING = 7
}
 FOTA status reported to nRF Cloud and notified in nrf_cloud_fota_poll_handler_t. More...
 
enum  nrf_cloud_fota_type {
  NRF_CLOUD_FOTA_TYPE__FIRST = 0 , NRF_CLOUD_FOTA_APPLICATION = NRF_CLOUD_FOTA_TYPE__FIRST , NRF_CLOUD_FOTA_MODEM_DELTA = 1 , NRF_CLOUD_FOTA_BOOTLOADER = 2 ,
  NRF_CLOUD_FOTA_MODEM_FULL = 5 , NRF_CLOUD_FOTA_SMP = 6 , NRF_CLOUD_FOTA_TYPE__INVALID
}
 FOTA update type. More...
 
enum  nrf_cloud_fota_validate_status {
  NRF_CLOUD_FOTA_VALIDATE_NONE = 0 , NRF_CLOUD_FOTA_VALIDATE_PENDING , NRF_CLOUD_FOTA_VALIDATE_PASS , NRF_CLOUD_FOTA_VALIDATE_FAIL ,
  NRF_CLOUD_FOTA_VALIDATE_UNKNOWN , NRF_CLOUD_FOTA_VALIDATE_DONE , NRF_CLOUD_FOTA_VALIDATE_ERROR
}
 Validity of an in-progress/installed FOTA update. More...
 
enum  nrf_cloud_fota_bootloader_status_flags { NRF_CLOUD_FOTA_BL_STATUS_CLEAR = 0 , NRF_CLOUD_FOTA_BL_STATUS_S0_FLAG_SET = (1 << 0) , NRF_CLOUD_FOTA_BL_STATUS_S0_WAS_ACTIVE = (1 << 1) , NRF_CLOUD_FOTA_BL_STATUS_REBOOTED = (1 << 2) }
 Status flags for tracking the update process of the b1 bootloader (MCUBOOT) More...
 
enum  nrf_cloud_shadow_info { NRF_CLOUD_INFO_NO_CHANGE = 0 , NRF_CLOUD_INFO_SET = 1 , NRF_CLOUD_INFO_CLEAR = 2 }
 How the info sections are handled when encoding shadow data. More...
 
enum  nrf_cloud_gnss_type {
  NRF_CLOUD_GNSS_TYPE_INVALID , NRF_CLOUD_GNSS_TYPE_PVT , NRF_CLOUD_GNSS_TYPE_NMEA , NRF_CLOUD_GNSS_TYPE_MODEM_PVT ,
  NRF_CLOUD_GNSS_TYPE_MODEM_NMEA
}
 GNSS data type contained in nrf_cloud_gnss_data. More...
 

Functions

int nrf_cloud_init (const struct nrf_cloud_init_param *param)
 Initialize the module.
 
int nrf_cloud_uninit (void)
 Uninitialize nRF Cloud; disconnects cloud connection and cleans up allocated memory.
 
int nrf_cloud_print_details (void)
 Print details about cloud connection.
 
int nrf_cloud_print_cloud_details (void)
 Print details about cloud connection after connected.
 
int nrf_cloud_get_imei (char *buf, size_t buf_sz)
 Retrieve the IMEI.
 
int nrf_cloud_get_uuid (char *buf, size_t buf_sz)
 Retrieve the device's UUID.
 
int nrf_cloud_get_modem_fw (char *buf, size_t buf_sz)
 Retrieve the Modem firmware version.
 
int nrf_cloud_connect (void)
 Connect to the cloud.
 
int nrf_cloud_sensor_data_send (const struct nrf_cloud_sensor_data *param)
 Send sensor data reliably.
 
int nrf_cloud_shadow_device_status_update (const struct nrf_cloud_device_status *const dev_status)
 Update the device status in the shadow.
 
int nrf_cloud_sensor_data_stream (const struct nrf_cloud_sensor_data *param)
 Stream sensor data. Uses lowest QoS; no acknowledgment,.
 
int nrf_cloud_send (const struct nrf_cloud_tx_data *msg)
 Send data to nRF Cloud.
 
int nrf_cloud_obj_shadow_update (struct nrf_cloud_obj *const shadow_obj)
 Update the device's shadow with the data from the provided object.
 
int nrf_cloud_shadow_transform_request (char const *const transform, const size_t max_response_len)
 Request shadow data over MQTT using a JSONata expression. For example, to request the reported device info section, the transform would be: "state.reported.device.deviceInfo". The application will receive response data in an NRF_CLOUD_EVT_RX_DATA_SHADOW event. The nrf_cloud_obj_shadow_data will be of the type NRF_CLOUD_OBJ_SHADOW_TYPE_TF.
 
int nrf_cloud_disconnect (void)
 Disconnect from the cloud.
 
int nrf_cloud_process (void)
 Function that must be called periodically to keep the module functional.
 
int nrf_cloud_modem_fota_completed (const bool fota_success)
 The application has handled reinit after a modem FOTA update and the LTE link has been reestablished. This function must be called in order to complete the modem update. Depends on.
 
int nrf_cloud_client_id_get (char *id_buf, size_t id_buf_sz)
 Retrieve the current device ID.
 
int nrf_cloud_client_id_runtime_set (const char *const client_id)
 Set the device ID at runtime. Requires.
 
int nrf_cloud_tenant_id_get (char *id_buf, size_t id_len)
 Retrieve the current customer tenant ID.
 
int nrf_cloud_jwt_generate (uint32_t time_valid_s, char *const jwt_buf, size_t jwt_buf_sz)
 Generate a JWT to be used with nRF Cloud's REST API. This library's configured values for client id and sec tag (NRF_CLOUD_SEC_TAG) will be used for generating the JWT.
 
int nrf_cloud_pending_fota_job_process (struct nrf_cloud_settings_fota_job *const job, bool *const reboot_required)
 Process/validate a pending FOTA update job. Typically the job information is read from non-volatile storage on startup. This function is intended to be used by custom REST-based FOTA implementations. It is called internally if.
 
int nrf_cloud_bootloader_fota_slot_set (struct nrf_cloud_settings_fota_job *const job)
 Set the active bootloader (B1) slot flag which is needed to validate a bootloader FOTA update. For proper functionality,.
 
int nrf_cloud_fota_pending_job_type_get (enum nrf_cloud_fota_type *const pending_fota_type)
 Retrieve the FOTA type of a pending FOTA job. A value of NRF_CLOUD_FOTA_TYPE__INVALID indicates that there are no pending FOTA jobs. Depends on.
 
int nrf_cloud_fota_pending_job_validate (enum nrf_cloud_fota_type *const fota_type_out)
 Validate a pending FOTA installation before initializing this library. This function enables the application to control the reboot/reinit process during FOTA updates. If this function is not called directly by the application, it will be called internally when nrf_cloud_init is executed. For pending NRF_CLOUD_FOTA_MODEM_DELTA jobs the modem library must be initialized before calling this function, otherwise the job will be marked as completed without validation. Depends on.
 
int nrf_cloud_fota_fmfu_dev_set (const struct dfu_target_fmfu_fdev *const fmfu_dev_inf)
 Set the flash device used for full modem FOTA updates. This function is intended to be used by custom REST-based FOTA implementations. It is called internally when nrf_cloud_init is executed if.
 
int nrf_cloud_fota_fmfu_apply (void)
 Install a full modem update from flash. If successful, reboot the device or reinit the modem to complete the update. This function is intended to be used by custom REST-based FOTA implementations. If.
 
bool nrf_cloud_fota_is_type_modem (const enum nrf_cloud_fota_type type)
 Determine if FOTA type is modem related.
 
bool nrf_cloud_fota_is_type_enabled (const enum nrf_cloud_fota_type type)
 Determine if the specified FOTA type is enabled by the configuration. This function returns false if both.
 
int nrf_cloud_fota_job_start (void)
 Start the FOTA update job. This function should be called after the NRF_CLOUD_EVT_FOTA_JOB_AVAILABLE event is received. This function should only be called if.
 
int nrf_cloud_fota_smp_client_init (const void *smp_reset_cb)
 Initialize the SMP client. Called automatically if.
 
int nrf_cloud_fota_smp_install (void)
 Install a downloaded SMP FOTA job. Called automatically if.
 
int nrf_cloud_fota_smp_version_read (void)
 Read the image info from the SMP device to obtain the current version.
 
int nrf_cloud_fota_smp_version_get (char **smp_ver_out)
 Get the current version string of the SMP device. An empty string will be returned if nrf_cloud_fota_smp_version_read has not been successfully called.
 
int nrf_cloud_credentials_check (struct nrf_cloud_credentials_status *const cs)
 Check if credentials exist in the configured location.
 
int nrf_cloud_credentials_configured_check (void)
 Check if the credentials required for connecting to nRF Cloud exist. The application's configuration is used to determine which credentials are required. Check the size of the root CA certificates installed and return an error code if the size of the root CA certificate(s) is not appropriate for the configured transport type.
 
void nrf_cloud_sec_tag_set (const sec_tag_t sec_tag)
 Set the sec tag used for nRF Cloud credentials. The default sec tag value is.
 
sec_tag_t nrf_cloud_sec_tag_get (void)
 Get the sec tag used for nRF Cloud credentials.
 
void nrf_cloud_sec_tag_coap_jwt_set (const sec_tag_t sec_tag)
 Set the sec tag containing the private key used to sign CoAP JWTs for nRF Cloud authentication. The default sec tag value is.
 
sec_tag_t nrf_cloud_sec_tag_coap_jwt_get (void)
 Get the sec tag containing the private key used to sign CoAP JWTs for nRF Cloud authentication.
 

Detailed Description