ex

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

Revision:
47:9e361da97763
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DuerOS-Light-SDK-v1.1.0/duer-os-light/src/iot-baidu-ota/baidu_iot_ota_reporter.h	Tue Jul 18 16:54:45 2017 +0800
@@ -0,0 +1,42 @@
+#pragma once
+#include "rtos.h"
+#include "package_info.h"
+#include "baidu_ca_object.h"
+
+class OTAReporter
+{
+public:
+    OTAReporter(const char *transaction_id);
+    ~OTAReporter();
+    enum {
+        OTA_STATE_IDLE=0,
+        OTA_STATE_DOWNLOADING,
+        OTA_STATE_DOWNLOADED,
+        OTA_STATE_INSTALLING,
+        OTA_STATE_INSTALLED
+    };
+    enum {
+        OTA_EVENT_BEGIN,
+        OTA_EVENT_CONNECT_FAIL,
+        OTA_EVENT_CONNECTION_LOST,
+        OTA_EVENT_TIMEOUT,
+        OTA_EVENT_DOWNLOADING,
+        OTA_EVENT_DOWNLOAD_COMPLETE,
+        OTA_EVENT_DOWNLOAD_FAIL,
+        OTA_EVENT_INSTALLING,
+        OTA_EVENT_IMAGE_INVALID,
+        OTA_EVENT_WRITE_ERROR,
+        OTA_EVENT_INSTALLED,
+        OTA_EVENT_DELETED,
+        OTA_EVENT_REJECT,
+    };
+    int report_state(int state, ...);
+    int report_event(int event, ...);
+    static int report_package_info(os_info_t& os);
+    static void ota_report_status(duer::Object& values);
+private:
+    static void get_packageInfo(duer::Object& obj);
+    char *m_szTransaction_id;
+    int m_current_event;
+    rtos::Mutex    m_Lock;
+};