Skip to content

Commit 16d6209

Browse files
committed
Raise insights transport event from http_transport
Previously, we had `INSIGHTS_EVENT_TRANSPORT_SEND_SUCCESS` and FAILED events only for mqtt transport. http transport didn't have this. The application might want to take some action depending on this event. Hence, adding this event for http transport as well. Signed-off-by: Vikram Dattu <[email protected]>
1 parent d082711 commit 16d6209

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

components/esp_insights/src/transport/esp_insights_https.c

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <string.h>
1616
#include <esp_err.h>
1717
#include <esp_log.h>
18+
#include <esp_event.h>
1819
#include <esp_http_client.h>
1920
#include <esp_insights.h>
2021
#include <esp_insights_internal.h>
@@ -138,6 +139,11 @@ static int esp_insights_https_data_send(void *data, size_t len)
138139
ESP_LOGE(TAG, "API response status = %d", status);
139140
}
140141
}
142+
if (msg_id == 0) {
143+
esp_event_post(INSIGHTS_EVENT, INSIGHTS_EVENT_TRANSPORT_SEND_SUCCESS, NULL, 0, portMAX_DELAY);
144+
} else {
145+
esp_event_post(INSIGHTS_EVENT, INSIGHTS_EVENT_TRANSPORT_SEND_FAILED, NULL, 0, portMAX_DELAY);
146+
}
141147
cleanup:
142148
esp_http_client_cleanup(client);
143149
return msg_id;

0 commit comments

Comments
 (0)