Merge pull request #32 from ucloud/add_code_annotation_for_ota_request_firmware

add code annotation for ota request firmware
This commit is contained in:
ethanDu1 2020-05-29 14:45:34 +08:00 committed by GitHub
commit e5a4f0bbde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

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