OTA_HTTP API 参考
Structures
-
struct wm_ota_http_cfg_t
Public Members
-
char *fw_url
Pointer to a string containing the URL of the firmware to be downloaded
-
wm_ota_http_get_file_callback_t ota_get_file_cb
Callback function to be called when firmware data is received
-
wm_ota_state_callback_t ota_state_cb
Callback function to be called to notify about the state of the OTA process
-
bool reboot
Flag indicating whether to automatically reboot the device after successful firmware download and verification
-
char *fw_url
Type Definitions
-
typedef void (*wm_ota_http_get_file_callback_t)(uint8_t *data, uint32_t len)
Type definition for a callback function used during the OTA HTTP firmware download process.
This callback function is invoked whenever a chunk of firmware data is received. It takes two parameters: a pointer to the data buffer and the length of the data received.
- Param data:
[out] A pointer to the buffer containing the received firmware data.
- Param len:
[out] The length of the received data in bytes.
- Return:
None
Functions
-
int wm_ota_http_update(wm_ota_http_cfg_t *cfg)
Function to initiate an OTA HTTP firmware update using the provided configuration.
This function starts the OTA process by downloading the firmware from the specified URL. It uses the callbacks provided in the configuration structure to handle the received data and to notify about the state of the OTA process.
- 参数:
cfg – [in] A pointer to a wm_ota_http_cfg_t structure containing the configuration for the OTA update.
- 返回:
WM_ERR_SUCCESS: Indicates that the OTA update has been successfully started.
WM_ERR_OTA_ALREADY_RUNNING: Indicates that an OTA update is currently underway.
WM_ERR_NO_MEM: Memory allocation for the OTA context or URL has failed.
WM_ERR_INVALID_PARAM: One or more parameters provided are invalid.
WM_ERR_OTA_NO_GOT_IP: The device is either not connected to Wi-Fi or has not yet acquired an IP address.
Other errors may be propagated from the functions invoked during this process.