#pragma once #ifdef __cplusplus extern "C" { #endif /** * @brief Start an OTA update from the given HTTP/HTTPS URL. * * Spawns a background FreeRTOS task that: * 1. Downloads the firmware binary from `url` using esp_http_client * 2. Writes it to the inactive OTA partition via esp_ota_ops * 3. Reports progress back to the server via WebSocket ota_progress messages * 4. On success: sends ota_complete, waits 500ms, then reboots * 5. On failure: sends ota_error with reason string * * HTTPS connections use the system certificate bundle * (CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL) which includes all * standard root CAs and works with Cloudflare, AWS, etc. * * Only one OTA task may run at a time. Subsequent calls while one is * already running are silently ignored. * * @param url Null-terminated HTTP/HTTPS URL string for the firmware binary. * The string is copied internally; the caller may free it. */ void ota_start(const char *url); #ifdef __cplusplus } #endif