nRF9160: Cloud Client¶
This sample connects to, and communicates with a compatible cloud service using the respective cloud backend firmware library. The sample connects via cellular network (LTE) and publishes a custom string in intervals or upon a button trigger, to the cloud service.
The Cloud Client sample demonstrates how the generic Cloud API can be used to interface with multiple cloud backends. The current version of the sample supports the following libraries as cloud backends:
To swap between the supported libraries, change the option
CONFIG_CLOUD_BACKEND to match the configuration string of a compatible cloud backend.
The identifying string for the different cloud backends are listed in the following table:
One of the following development boards:
Building and running¶
This sample can be found under
samples/nrf9160/cloud_client in the nRF Connect SDK folder structure.
See Building and programming a sample application for information about how to build and program the application.
The sample is configured to compile and run as a non-secure application on nRF91’s Cortex-M33. Therefore, it automatically includes the nRF9160: Secure Partition Manager that prepares the required peripherals to be available for the application.
The nRF9160 DK and Thingy:91 come pre-flashed with the certificates required for a connection to nRF Cloud. No extra steps are required to use the Cloud client sample with nRF Cloud.
The configurations used in the sample are listed below. They are located in
Decides the cloud backend to be used.
Publishes a message to cloud sequentially.
Publishes a message to cloud upon a button press.
Modifies the message published to the cloud service.
Modifies the interval within which the message is published to the cloud service.
To output data in the terminal window located in the nRF Cloud web interface, the data format must be in JSON format.
Functionality and Supported Technologies¶
The communication protocol supported by the sample is dependent on the cloud backend that is used.
The sample uses the following functions:
cloud_get_binding(): Binds to a desired cloud backend using a identifiable string.
cloud_init(): Sets up the cloud connection.
cloud_connect(): Connects to the cloud service.
cloud_ping(): Pings the cloud service.
cloud_input(): Retrieves data from the cloud service.
cloud_send(): Sends data to the cloud service.
Cloud events used in the sample¶
The sample uses the following cloud events:
CLOUD_EVT_CONNECTED: Connected to the cloud service.
CLOUD_EVT_READY: Ready for cloud communication.
CLOUD_EVT_DISCONNECTED: Disconnected from the cloud service.
CLOUD_EVT_DATA_RECEIVED: Data received from the cloud service.
Not all functionalities present in the generic cloud API are used by the different cloud backends.