Function esp_idf_sys::esp_mqtt_client_enqueue
source · pub unsafe extern "C" fn esp_mqtt_client_enqueue(
client: esp_mqtt_client_handle_t,
topic: *const c_char,
data: *const c_char,
len: c_int,
qos: c_int,
retain: c_int,
store: bool,
) -> c_int
Expand description
@brief Enqueue a message to the outbox, to be sent later. Typically used for messages with qos>0, but could be also used for qos=0 messages if store=true.
This API generates and stores the publish message into the internal outbox and the actual sending to the network is performed in the mqtt-task context (in contrast to the esp_mqtt_client_publish() which sends the publish message immediately in the user task’s context). Thus, it could be used as a non blocking version of esp_mqtt_client_publish().
@param client MQTT client handle @param topic topic string @param data payload string (set to NULL, sending empty payload message) @param len data length, if set to 0, length is calculated from payload string @param qos QoS of publish message @param retain retain flag @param store if true, all messages are enqueued; otherwise only QoS 1 and QoS 2 are enqueued
@return message_id if queued successfully, -1 on failure, -2 in case of full outbox.