Files
esp32-bmc/main/ota_handler.h

81 lines
1.5 KiB
C

#ifndef OTA_HANDLER_H
#define OTA_HANDLER_H
#include <stdbool.h>
#include "esp_err.h"
/**
* @brief Initialize OTA handler
*
* @return esp_err_t ESP_OK on success
*/
esp_err_t ota_handler_init(void);
/**
* @brief Deinitialize OTA handler
*
* @return esp_err_t ESP_OK on success
*/
esp_err_t ota_handler_deinit(void);
/**
* @brief Get current running partition label
*
* @return const char* Partition label string
*/
const char *ota_get_running_partition(void);
/**
* @brief Check if OTA update is in progress
*
* @return true if update in progress
*/
bool ota_is_updating(void);
/**
* @brief Get OTA update progress percentage
*
* @return int 0-100 percentage, -1 if not updating
*/
int ota_get_progress(void);
/**
* @brief Start OTA update from URL
*
* @param url URL to download firmware from
* @return esp_err_t ESP_OK on success
*/
esp_err_t ota_start_update(const char *url);
/**
* @brief Start OTA update from direct data (for file upload)
*
* @return esp_err_t ESP_OK on success
*/
esp_err_t ota_start_upload(void);
/**
* @brief Write data to OTA partition
*
* @param data Data to write
* @param len Length of data
* @return esp_err_t ESP_OK on success
*/
esp_err_t ota_write_data(const uint8_t *data, size_t len);
/**
* @brief Finish OTA upload and apply update
*
* @return esp_err_t ESP_OK on success
*/
esp_err_t ota_finish_upload(void);
/**
* @brief Abort ongoing OTA upload
*
* @return esp_err_t ESP_OK on success
*/
esp_err_t ota_abort_upload(void);
#endif // OTA_HANDLER_H