nRF Connect SDK API 2.8.0
Loading...
Searching...
No Matches

◆ nrf_cloud_coap_sensor_send()

int nrf_cloud_coap_sensor_send ( const char * app_id,
double value,
int64_t ts_ms,
bool confirmable )

#include <include/net/nrf_cloud_coap.h>

Send a sensor value to nRF Cloud.

The sensor message is sent either as a non-confirmable or confirmable CoAP message. Use non-confirmable when sending low priority information for which some data loss is acceptable.

Parameters
[in]app_idThe app ID identifying the type of data. See the values that begin with NRF_CLOUD_JSON_APPID_ in nrf_cloud_defs.h. You may also use custom names.
[in]valueSensor reading.
[in]ts_msTimestamp the data was measured, or NRF_CLOUD_NO_TIMESTAMP.
[in]confirmableSelect whether to use a CON or NON CoAP transfer.
Return values
-EACCESDevice does not have a valid nRF Cloud CoAP connection.
Returns
0 If successful, nonzero if failed. Negative values are device-side errors defined in errno.h. Positive values are cloud-side errors (CoAP result codes) defined in zephyr/net/coap.h.