Function esp_idf_svc::sys::esp_mqtt_client_enqueue

source ·
pub unsafe extern "C" fn esp_mqtt_client_enqueue(
    client: *mut esp_mqtt_client,
    topic: *const i8,
    data: *const i8,
    len: i32,
    qos: i32,
    retain: i32,
    store: bool,
) -> i32
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.