From f201e8b771079a7f9749835fe7d340592bb18b7a Mon Sep 17 00:00:00 2001 From: "ethan.du" Date: Fri, 29 May 2020 14:44:45 +0800 Subject: [PATCH] add code annotation for ota request firmware --- samples/ota/ota_sample.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/samples/ota/ota_sample.c b/samples/ota/ota_sample.c index b239a9b..07030db 100644 --- a/samples/ota/ota_sample.c +++ b/samples/ota/ota_sample.c @@ -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; }