diff --git a/duckdns/station/main/station_example_main.c b/duckdns/station/main/station_example_main.c index 7d41645..154e1b6 100644 --- a/duckdns/station/main/station_example_main.c +++ b/duckdns/station/main/station_example_main.c @@ -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://.azure-devices.net/devices//messages/events?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 = {