Added functional description for send_data_to_azure and URL explanation

This commit is contained in:
advait 2025-04-20 19:14:55 -07:00
parent 807b2eb041
commit 3d6babf797

View File

@ -1,3 +1,13 @@
/**
* @brief Sends a JSON-formatted telemetry payload to Azure IoT Hub using HTTPS POST.
*
* This function builds and sends an HTTP POST request with telemetry data (e.g., temperature, humidity)
* to the Azure IoT Hub endpoint using the SAS token for authentication.
*
* The server response is logged for debugging. The function retries connection if it fails initially.
*/
/*
* station_example_main.c
*
@ -35,6 +45,11 @@ static const char *TAG = "ESP32_IoT_Hub";
void send_data_to_azure(void *pvParameter) {
char post_data[256];
// Azure IoT Hub REST endpoint for sending device-to-cloud messages.
// Format: https://<iot-hub-name>.azure-devices.net/devices/<device-id>/messages/events?api-version=<api-version>
//
// This example sends telemetry from device 'Simulated-ESP32' to the 'esp32-iothub' IoT Hub.
// The 'api-version' specifies which version of the Azure IoT Hub REST API to use.
char url[] = "https://ESP32-IoTHub.azure-devices.net/devices/Simulated-ESP32/messages/events?api-version=2020-09-30";
esp_http_client_config_t config = {