add code annotation for ota request firmware

This commit is contained in:
ethan.du 2020-05-29 14:44:45 +08:00
parent 4641bf7471
commit f201e8b771
1 changed files with 6 additions and 3 deletions

View File

@ -31,6 +31,8 @@
#define OTA_BUF_LEN (1024)
#define CURRENT_VER "1.0.0"
static void event_handler(void *pClient, void *handle_context, MQTTEventMsg *msg)
{
switch(msg->event_type) {
@ -121,13 +123,14 @@ int main(int argc, char **argv)
return FAILURE_RET;
}
/* Must report version first */
if (IOT_OTA_ReportVersion(h_ota, "1.0.0") < 0) {
/* Must report current version first */
if (IOT_OTA_ReportVersion(h_ota, CURRENT_VER) < 0) {
LOG_ERROR("report OTA version failed");
return FAILURE_RET;
}
if (IOT_OTA_RequestFirmware(h_ota, "1.0.0") < 0) {
/* request new firmware with current version */
if (IOT_OTA_RequestFirmware(h_ota, CURRENT_VER) < 0) {
LOG_ERROR("Request firmware failed");
return FAILURE_RET;
}