Merge "add_get_absys_type" into mbtk_source_v2
diff --git a/mbtk/include/mbtk/mbtk_fota.h b/mbtk/include/mbtk/mbtk_fota.h
index bf166d8..3fe224d 100755
--- a/mbtk/include/mbtk/mbtk_fota.h
+++ b/mbtk/include/mbtk/mbtk_fota.h
@@ -35,6 +35,12 @@
QUEC_FOTA_FAILED /*failed*/
}QL_FOTA_STATUS;
+typedef enum mbtkabsystem
+{
+ mbtk_sys_A = 0,
+ mbtk_sys_B = 1
+} mbtk_absystem_t;
+
/*callback function define, used to get upgrade state and rate of process*/
typedef int(*fota_callback)(int state, int percent);
@@ -96,6 +102,10 @@
int mbtk_fota_status(void);
int mbtk_fota_get_asr_reboot_cnt_flag(void);
+int mbtk_fota_get_active_absys_type(void);
+int mbtk_fota_get_tmp_absys_type(void);
+int mbtk_fota_get_sync_absys_type(void);
+int mbtk_fota_get_mtd_check_type(void);
#ifdef __cplusplus
}
diff --git a/mbtk/libmbtk_lib/fota/mbtk_fota.c b/mbtk/libmbtk_lib/fota/mbtk_fota.c
index 68e2ba0..323ec9b 100755
--- a/mbtk/libmbtk_lib/fota/mbtk_fota.c
+++ b/mbtk/libmbtk_lib/fota/mbtk_fota.c
@@ -8,10 +8,20 @@
#include <pthread.h>
#include <libubox/blobmsg_json.h>
#include "libubus.h"
-#include "mbtk_fota.h"
+
#include <semaphore.h>
#include <cutils/properties.h>
+#include <libubox/blob.h>
+#include <libubox/uloop.h>
+#include <libubox/usock.h>
+#include <libubox/list.h>
+#include <libubus.h>
+#include <uci.h>
+#include <sys/ioctl.h>
+#include <mtd/mtd-user.h>
+
+#include "mbtk_fota.h"
#include "mbtk_log.h"
@@ -425,3 +435,73 @@
MBTK_SOURCE_INFO_PRINT("mbtk_fota_lib");
}
+int mbtk_fota_get_active_absys_type(void)
+{
+ int type = 0;
+ char tmp_type[] ={0};
+
+ property_get("persist.mbtk.absys_active", tmp_type, "0");
+ type = atoi(tmp_type);
+ if (type == 97)
+ {
+ type = mbtk_sys_A;
+ }
+ else if (type == 98)
+ {
+ type = mbtk_sys_B;
+ }
+ else
+ {
+ LOGE("get_active_absys_type %s fail",tmp_type);
+ type = -1;
+ }
+
+ return type;
+}
+
+int mbtk_fota_get_tmp_absys_type(void)
+{
+ int type = 0;
+ char tmp_type[] ={0};
+
+ property_get("persist.mbtk.absys_tmp", tmp_type, "0");
+ type = atoi(tmp_type);
+ if (type == 97)
+ {
+ type = mbtk_sys_A;
+ }
+ else if (type == 98)
+ {
+ type = mbtk_sys_B;
+ }
+ else
+ {
+ LOGE("get_tmp_absys_type %s fail",tmp_type);
+ type = -1;
+ }
+
+ return type;
+}
+
+int mbtk_fota_get_sync_absys_type(void)
+{
+ int type = 0;
+ char tmp_type[] ={0};
+
+ property_get("persist.mbtk.absys_sync", tmp_type, "0");
+ type = atoi(tmp_type);
+
+ return type;
+}
+
+int mbtk_fota_get_mtd_check_type(void)
+{
+ int type = 0;
+ char tmp_type[] ={0};
+
+ property_get("persist.mbtk.mtd_check", tmp_type, "0");
+ type = atoi(tmp_type);
+
+ return type;
+}
+