Skip to content

Commit 01e990e

Browse files
Merge branch 'mqtt_event_suback_reason_code' into 'master'
feat(mqtt): Add reason code to SUBSCRIBED event in examples Closes IDF-6430 See merge request espressif/esp-idf!39970
2 parents 7e570d2 + 63b91c0 commit 01e990e

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

examples/protocols/mqtt/ssl/main/app_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
8383
break;
8484

8585
case MQTT_EVENT_SUBSCRIBED:
86-
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d", event->msg_id);
86+
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d, return code=0x%02x ", event->msg_id, (uint8_t)*event->data);
8787
msg_id = esp_mqtt_client_publish(client, "/topic/qos0", "data", 0, 0, 0);
8888
ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id);
8989
break;

examples/protocols/mqtt/ssl_ds/main/app_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
6969
break;
7070

7171
case MQTT_EVENT_SUBSCRIBED:
72-
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d", event->msg_id);
72+
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d, return code=0x%02x ", event->msg_id, (uint8_t)*event->data);
7373
msg_id = esp_mqtt_client_publish(client, "/topic/qos0", "data", 0, 0, 0);
7474
ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id);
7575
break;

examples/protocols/mqtt/ssl_mutual_auth/main/app_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
7878
break;
7979

8080
case MQTT_EVENT_SUBSCRIBED:
81-
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d", event->msg_id);
81+
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d, return code=0x%02x ", event->msg_id, (uint8_t)*event->data);
8282
msg_id = esp_mqtt_client_publish(client, "/topic/qos0", "data", 0, 0, 0);
8383
ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id);
8484
break;

examples/protocols/mqtt/ssl_psk/main/app_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
8585
break;
8686

8787
case MQTT_EVENT_SUBSCRIBED:
88-
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d", event->msg_id);
88+
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d, return code=0x%02x ", event->msg_id, (uint8_t)*event->data);
8989
msg_id = esp_mqtt_client_publish(client, "/topic/qos0", "data", 0, 0, 0);
9090
ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id);
9191
break;

examples/protocols/mqtt/tcp/main/app_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
6767
break;
6868

6969
case MQTT_EVENT_SUBSCRIBED:
70-
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d", event->msg_id);
70+
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d, return code=0x%02x ", event->msg_id, (uint8_t)*event->data);
7171
msg_id = esp_mqtt_client_publish(client, "/topic/qos0", "data", 0, 0, 0);
7272
ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id);
7373
break;

examples/protocols/mqtt/ws/main/app_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_
7373
break;
7474

7575
case MQTT_EVENT_SUBSCRIBED:
76-
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d", event->msg_id);
76+
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d, return code=0x%02x ", event->msg_id, (uint8_t)*event->data);
7777
msg_id = esp_mqtt_client_publish(client, "/topic/qos0", "data", 0, 0, 0);
7878
ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id);
7979
break;

examples/protocols/mqtt/wss/main/app_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static esp_err_t mqtt_event_handler_cb(esp_mqtt_event_handle_t event)
6161
break;
6262

6363
case MQTT_EVENT_SUBSCRIBED:
64-
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d", event->msg_id);
64+
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d, return code=0x%02x ", event->msg_id, (uint8_t)*event->data);
6565
msg_id = esp_mqtt_client_publish(client, "/topic/qos0", "data", 0, 0, 0);
6666
ESP_LOGI(TAG, "sent publish successful, msg_id=%d", msg_id);
6767
break;

examples/protocols/mqtt5/main/app_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static void mqtt5_event_handler(void *handler_args, esp_event_base_t base, int32
142142
print_user_property(event->property->user_property);
143143
break;
144144
case MQTT_EVENT_SUBSCRIBED:
145-
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d", event->msg_id);
145+
ESP_LOGI(TAG, "MQTT_EVENT_SUBSCRIBED, msg_id=%d, reason code=0x%02x ", event->msg_id, (uint8_t)*event->data);
146146
print_user_property(event->property->user_property);
147147
esp_mqtt5_client_set_publish_property(client, &publish_property);
148148
msg_id = esp_mqtt_client_publish(client, "/topic/qos0", "data", 0, 0, 0);

0 commit comments

Comments
 (0)