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:
commit
e5a4f0bbde
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue