/** * OTA Manager - Firmware Update Management * Handles Over-The-Air firmware updates via Wi-Fi */ #ifndef OTA_MANAGER_H #define OTA_MANAGER_H #include "esp_err.h" #include #include #include #include #ifdef __cplusplus extern "C" { #endif // OTA states typedef enum { OTA_STATE_IDLE = 0, OTA_STATE_CHECKING, OTA_STATE_DOWNLOADING, OTA_STATE_VERIFYING, OTA_STATE_READY_TO_UPDATE, OTA_STATE_UPDATING, OTA_STATE_COMPLETE, OTA_STATE_ERROR } ota_state_t; // OTA progress structure typedef struct { ota_state_t state; int progress_percent; char status_message[128]; char error_message[128]; uint32_t bytes_downloaded; uint32_t total_bytes; bool update_available; char new_version[32]; char current_version[32]; } ota_progress_t; // Function prototypes esp_err_t ota_manager_init(void); esp_err_t ota_manager_deinit(void); // Server configuration esp_err_t ota_manager_set_server_url(const char* server_url); // Update management esp_err_t ota_manager_check_for_updates(void); esp_err_t ota_manager_start_update(const char* url); esp_err_t ota_manager_install_update(void); esp_err_t ota_manager_cancel_update(void); esp_err_t ota_manager_get_current_version(char* version); // Progress monitoring esp_err_t ota_manager_get_progress(ota_progress_t* progress); #ifdef __cplusplus } #endif #endif // OTA_MANAGER_H