ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers baidu_iot_ota_reporter.h Source File

baidu_iot_ota_reporter.h

00001 #pragma once
00002 #include "rtos.h"
00003 #include "package_info.h"
00004 #include "baidu_ca_object.h"
00005 
00006 class OTAReporter
00007 {
00008 public:
00009     OTAReporter(const char *transaction_id);
00010     ~OTAReporter();
00011     enum {
00012         OTA_STATE_IDLE=0,
00013         OTA_STATE_DOWNLOADING,
00014         OTA_STATE_DOWNLOADED,
00015         OTA_STATE_INSTALLING,
00016         OTA_STATE_INSTALLED
00017     };
00018     enum {
00019         OTA_EVENT_BEGIN,
00020         OTA_EVENT_CONNECT_FAIL,
00021         OTA_EVENT_CONNECTION_LOST,
00022         OTA_EVENT_TIMEOUT,
00023         OTA_EVENT_DOWNLOADING,
00024         OTA_EVENT_DOWNLOAD_COMPLETE,
00025         OTA_EVENT_DOWNLOAD_FAIL,
00026         OTA_EVENT_INSTALLING,
00027         OTA_EVENT_IMAGE_INVALID,
00028         OTA_EVENT_WRITE_ERROR,
00029         OTA_EVENT_INSTALLED,
00030         OTA_EVENT_DELETED,
00031         OTA_EVENT_REJECT,
00032     };
00033     int report_state(int state, ...);
00034     int report_event(int event, ...);
00035     static int report_package_info(os_info_t& os);
00036     static void ota_report_status(duer::Object& values);
00037 private:
00038     static void get_packageInfo(duer::Object& obj);
00039     char *m_szTransaction_id;
00040     int m_current_event;
00041     rtos::Mutex    m_Lock;
00042 };