ex

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

Committer:
TMBOY
Date:
Tue Jul 18 16:54:45 2017 +0800
Revision:
47:9e361da97763
?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMBOY 47:9e361da97763 1 #pragma once
TMBOY 47:9e361da97763 2 #include "rtos.h"
TMBOY 47:9e361da97763 3 #include "package_info.h"
TMBOY 47:9e361da97763 4 #include "baidu_ca_object.h"
TMBOY 47:9e361da97763 5
TMBOY 47:9e361da97763 6 class OTAReporter
TMBOY 47:9e361da97763 7 {
TMBOY 47:9e361da97763 8 public:
TMBOY 47:9e361da97763 9 OTAReporter(const char *transaction_id);
TMBOY 47:9e361da97763 10 ~OTAReporter();
TMBOY 47:9e361da97763 11 enum {
TMBOY 47:9e361da97763 12 OTA_STATE_IDLE=0,
TMBOY 47:9e361da97763 13 OTA_STATE_DOWNLOADING,
TMBOY 47:9e361da97763 14 OTA_STATE_DOWNLOADED,
TMBOY 47:9e361da97763 15 OTA_STATE_INSTALLING,
TMBOY 47:9e361da97763 16 OTA_STATE_INSTALLED
TMBOY 47:9e361da97763 17 };
TMBOY 47:9e361da97763 18 enum {
TMBOY 47:9e361da97763 19 OTA_EVENT_BEGIN,
TMBOY 47:9e361da97763 20 OTA_EVENT_CONNECT_FAIL,
TMBOY 47:9e361da97763 21 OTA_EVENT_CONNECTION_LOST,
TMBOY 47:9e361da97763 22 OTA_EVENT_TIMEOUT,
TMBOY 47:9e361da97763 23 OTA_EVENT_DOWNLOADING,
TMBOY 47:9e361da97763 24 OTA_EVENT_DOWNLOAD_COMPLETE,
TMBOY 47:9e361da97763 25 OTA_EVENT_DOWNLOAD_FAIL,
TMBOY 47:9e361da97763 26 OTA_EVENT_INSTALLING,
TMBOY 47:9e361da97763 27 OTA_EVENT_IMAGE_INVALID,
TMBOY 47:9e361da97763 28 OTA_EVENT_WRITE_ERROR,
TMBOY 47:9e361da97763 29 OTA_EVENT_INSTALLED,
TMBOY 47:9e361da97763 30 OTA_EVENT_DELETED,
TMBOY 47:9e361da97763 31 OTA_EVENT_REJECT,
TMBOY 47:9e361da97763 32 };
TMBOY 47:9e361da97763 33 int report_state(int state, ...);
TMBOY 47:9e361da97763 34 int report_event(int event, ...);
TMBOY 47:9e361da97763 35 static int report_package_info(os_info_t& os);
TMBOY 47:9e361da97763 36 static void ota_report_status(duer::Object& values);
TMBOY 47:9e361da97763 37 private:
TMBOY 47:9e361da97763 38 static void get_packageInfo(duer::Object& obj);
TMBOY 47:9e361da97763 39 char *m_szTransaction_id;
TMBOY 47:9e361da97763 40 int m_current_event;
TMBOY 47:9e361da97763 41 rtos::Mutex m_Lock;
TMBOY 47:9e361da97763 42 };