From 1011e63cbe848661f301a36a9d270154c7cb6835 Mon Sep 17 00:00:00 2001 From: Nebojsa Cvetkovic Date: Thu, 9 Feb 2023 18:44:47 +0000 Subject: [PATCH 1/2] feature: Include subscribe_id in esp_mqtt5_event_property_t --- include/mqtt5_client.h | 1 + mqtt5_client.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/mqtt5_client.h b/include/mqtt5_client.h index c3c0178..af5277f 100644 --- a/include/mqtt5_client.h +++ b/include/mqtt5_client.h @@ -138,6 +138,7 @@ typedef struct { uint16_t correlation_data_len; /*!< Correlation data length of the message */ char *content_type; /*!< Content type of the message */ int content_type_len; /*!< Content type length of the message */ + uint16_t subscribe_id; /*!< Subscription identifier of the message */ mqtt5_user_property_handle_t user_property; /*!< The handle for user property, call function esp_mqtt5_client_delete_user_property to free the memory */ } esp_mqtt5_event_property_t; diff --git a/mqtt5_client.c b/mqtt5_client.c index b9d0f99..cb22110 100644 --- a/mqtt5_client.c +++ b/mqtt5_client.c @@ -134,6 +134,7 @@ esp_err_t esp_mqtt5_get_publish_data(esp_mqtt5_client_handle_t client, uint8_t * client->event.property->correlation_data_len = property.correlation_data_len; client->event.property->content_type = property.content_type; client->event.property->content_type_len = property.content_type_len; + client->event.property->subscribe_id = property.subscribe_id; return ESP_OK; } From 65a4fdaff53e5ae76a3ab3cffa3424fed5e50a4f Mon Sep 17 00:00:00 2001 From: Nebojsa Cvetkovic Date: Sat, 11 Feb 2023 23:38:04 +0000 Subject: [PATCH 2/2] fix: Allow MQTT v5 zero length payload Merges https://github.com/espressif/esp-mqtt/pull/250 --- mqtt5_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mqtt5_client.c b/mqtt5_client.c index cb22110..d5daba1 100644 --- a/mqtt5_client.c +++ b/mqtt5_client.c @@ -101,7 +101,7 @@ esp_err_t esp_mqtt5_get_publish_data(esp_mqtt5_client_handle_t client, uint8_t * uint16_t property_len = 0; esp_mqtt5_publish_resp_property_t property = {0}; *msg_data = mqtt5_get_publish_property_payload(msg_buf, msg_read_len, msg_topic, msg_topic_len, &property, &property_len, msg_data_len, &client->event.property->user_property); - if (*msg_data_len == 0 || *msg_data == NULL) { + if (*msg_data == NULL) { ESP_LOGE(TAG, "%s: mqtt5_get_publish_property_payload() failed", __func__); return ESP_FAIL; }