nRF Cloud delivery guarantees with QoS > 0

Hi!

I use nRF Cloud Lib of NCS v3.1.1. I couldn't find detailed info on how nrf_cloud_send() works with QoS > 0.

If I set QoS > 0 and get a 0 error code returned from nrf_cloud_send(), does that mean the data was successfully delivered to the cloud? I suppose no, but want to make sure.

If the 0 code doesn't actually mean that data was delivered, I would like to know the best/simplest way to implement a guaranteed data delivery.

Thank you!

  • Hello, from nrf_cloud.h we can see nrf_cloud_send() is defined:

    /**
     * @brief Send data to nRF Cloud.
     *
     * This API is used for sending data to nRF Cloud.
     *
     * @param[in] msg Pointer to a structure containing data and topic
     *                information.
     *
     * @retval 0       If successful.
     * @retval -EACCES Cloud connection is not established; wait for @ref NRF_CLOUD_EVT_READY.
     * @retval -EIO Error; failed to encode data.
     * @return A negative value indicates an error.
     */
    int nrf_cloud_send(const struct nrf_cloud_tx_data *msg);

    Where return value = 0 means successful. 

    And here we also see that it uses the following structure to send data were mqtt_qos uses the same as Zephyr MQTT (zephyr/include/zephyr/net/mqtt.h)

    /** @brief Structure used to send data to nRF Cloud. */
    struct nrf_cloud_tx_data {
    	/** Object containing data to be published */
    	struct nrf_cloud_obj *obj;
    	/** Pre-encoded data that is to be published if an object is not provided */
    	struct nrf_cloud_data data;
    
    	/** Endpoint topic type published to. */
    	enum nrf_cloud_topic_type topic_type;
    	/** Quality of Service of the message. */
    	enum mqtt_qos qos;
    	/** Message ID */
    	uint32_t id;
    };

    Have a look at the sample Cellular: nRF Cloud MQTT device message (tag 3.2.4) on how they handle this. 


    Kind regards,
    Øyvind

Related