Espressif ESP32-S2 Programming Manual page 524

Table of Contents

Advertisement

Chapter 2. API Reference
Return ESP_ERR_NO_MEM if failed to allocate ESP_ERR_INVALID_ARG if conflicts on transport con-
figuration. ESP_OK on success
Parameters
• client: mqtt client handle
• config: mqtt configuration structure
esp_err_t esp_mqtt_client_register_event(esp_mqtt_client_handle_t
Registers mqtt event.
Return ESP_ERR_NO_MEM if failed to allocate ESP_ERR_INVALID_ARG on wrong initialization
ESP_OK on success
Parameters
• client: mqtt client handle
• event: event type
• event_handler: handler callback
• event_handler_arg: handlers context
int
esp_mqtt_client_get_outbox_size(esp_mqtt_client_handle_t
Get outbox size.
Return outbox size 0 on wrong initialization
Parameters
• client: mqtt client handle
Structures
struct esp_mqtt_error_codes
MQTT error code structure to be passed as a contextual information into ERROR event.
Important: This structure extends esp_tls_last_error error structure and is backward compatible with
it (so might be down-casted and treated as esp_tls_last_error error, but recommended to update
applications if used this way previously)
Use this structure directly checking error_type first and then appropriate error code depending on the source
of the error:
| error_type | related member variables | note | | MQTT_ERROR_TYPE_TCP_TRANSPORT |
esp_tls_last_esp_err, esp_tls_stack_err, esp_tls_cert_verify_flags, sock_errno | Error reported from
tcp_transport/esp-tls | | MQTT_ERROR_TYPE_CONNECTION_REFUSED | connect_return_code | Inter-
nal error reported from MQTT broker on connection |
Public Members
esp_err_t
esp_tls_last_esp_err
last esp_err code reported from esp-tls component
int esp_tls_stack_err
tls specific error code reported from underlying tls stack
int esp_tls_cert_verify_flags
tls flags reported from underlying tls stack during certificate verification
esp_mqtt_error_type_t
error type referring to the source of the error
esp_mqtt_connect_return_code_t
connection refused error code reported from MQTT broker on connection
int esp_transport_sock_errno
errno from the underlying socket
struct esp_mqtt_event_t
MQTT event configuration structure
Espressif Systems
error_type
connect_return_code
513
Submit Document Feedback
esp_mqtt_event_id_t
event,
event_handler, void *event_handler_arg)
client)
client,
esp_event_handler_t
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents

Save PDF