namespace OHOS
{
+ int start_report_timer(void);
class SystemModel
{
public:
#include "components/ui_label_button_ext.h"
#include "cat1_ctl.h"
+#define HTTP_JSON_SERVER_NAME "test.iot.api.thisiot.com"//"test.app.api.thisiot.com"//获取升级服务器
+#define HTTP_FWPGK_SERVER_NAME "r-oss.thisiot.com"//"//升级包服务器
+#define PORT (80)//(443)//http端口号
+#define UPDATAJSONPATH "/update/ota_start_.json"//获取升级的得到的json
+
+#define UPDATAREPORT "/update/ota_start_reported_.json"//点升级后保存下来的json
+
+#define UPDATAFWPKGPATH "/update/update.fwpkg" //升级包
+
+#define UPDATAREPORT_ "/update/ota_report_.json"//上报升级得到的json
+
+#define POST_URL "http://test.iot.api.thisiot.com/ota/update-result"//上报url
+#define JSON_URL "http://test.iot.api.thisiot.com/ota/task?deviceId=%s&sourceVersion=%s"//获取升级url
+
namespace OHOS
{
typedef enum {
#include "system/include/SystemModel.h"
+#include "system/include/Systemupgrade.h"
+#include "wearable_log.h"
+#include "UiConfig.h"
+#include "custom_utils.h"
+#include "stdio.h"
+#include <iostream>
+#include <fstream>
+#include "cJSON.h"
+#include "config/include/ConfigModel.h"
+#include "lwip/err.h"
+#include "power_display_service.h"
+#include "cmsis_os2.h"
+#include "los_memory.h"
+#include "thread_init.h"
+ #include "lwip/apps/http_client.h"
+ #include "tcxo.h"
+ #include "cat1_server.h"
+ #include "linux/delay.h"
+
+#define UPDATAREPORT_M UPDATAREPORT
namespace OHOS
{
+ static void upgrade_report_task(void *arg)
+ {
+ FILE * fp = fopen(UPDATAREPORT_M,"rb+");
+ bool falg=false;
+ if(fp!=NULL)
+ {
+ falg=true;
+ PRINT("UPDATAREPORT_M IS TRUE!\r\n");
+ fclose(fp);
+ }
+
+ while (falg)
+ {
+
+ for(int i=0;i<60;i++)
+ {
+ msleep(1000);
+ }
+ if(ConfigModel::GetInstance()->GetCat1_4Gability())
+ {
+ upgrade_reported_data();
+ }
+ for(int i=0;i<60;i++)
+ {
+ msleep(1000);
+ }
+ fp = fopen(UPDATAREPORT_M,"rb+");
+ if(fp!=NULL)
+ {
+ falg=true;
+ fclose(fp);
+ }
+ else
+ {
+ falg=false;
+ }
+ }
+ PRINT("UPDATAREPORT IS OK!\r\n");
+ }
+
+ int start_report_timer(void)
+ {
+ PRINT("uapi_upgrade_service_init !\r\n");
+ app_task_definition_t taskcfg={0};
+ taskcfg.create_queue_handle = NULL;
+ taskcfg.attr.name="report_upgrade_service";
+ taskcfg.attr.priority = TASK_PRIORITY_APP;
+ taskcfg.attr.stack_size = 1024*4;
+ taskcfg.func = upgrade_report_task;
+ taskcfg.use_mem = USE_EXTEND_MEM;
+
+ errcode_t ret=uapi_create_osThread_custom(&taskcfg);
+ if(ret != ERRCODE_SUCC)
+ {
+ PRINT("create uapi_upgrade_service_init failed %d!\r\n",ret);
+ return ERRCODE_FAIL;
+ }
+
+ return ERRCODE_SUCC;
+
+ }
SystemModel *SystemModel::GetInstance(void)
{
#include "cat1_server.h"
#include "linux/delay.h"
-#define HTTP_JSON_SERVER_NAME "test.iot.api.thisiot.com"//"test.app.api.thisiot.com"
-#define HTTP_FWPGK_SERVER_NAME "r-oss.thisiot.com"//"
-#define PORT (80)//(443)
-#define UPDATAJSONPATH "/update/ota_start_.json"
-#define UPDATAREPORT "/update/ota_start_reported_.json"
-
-#define UPDATAFWPKGPATH "/update/update.fwpkg"
-
-#define POST_URL "http://test.iot.api.thisiot.com/ota/update-result"
-#define JSON_URL "http://test.iot.api.thisiot.com/ota/task?deviceId=%s&sourceVersion=%s"
//https://test.app.api.thisiot.com/ota/task?deviceId=deviceId&sourceVersion=sourceVersion
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "httpc_download_result_ui");
PRINT("httpc_download_result , httpc_result_t %d, rx_content_len %d , srv_res %d, err %d\n",
httpc_result,rx_content_len,srv_res,err);
+ if(srv_res==200 && err==0)
+ remove(UPDATAREPORT);
+
return ;
}
+
+
-
+
// // httpc_get_file(
// const ip_addr_t* server_addr,
// u16_t port,
settings.use_post=1;
settings.args=(u8_t*)data;
settings.arglen=data_len;
- uint8_t *otadatapath =(uint8_t *)"/update/ota_report_.json";
+ uint8_t *otadatapath =(uint8_t *)UPDATAREPORT_;
settings.result_fn=httpc_download_result_report_data;
u16_t buf_len=strlen(buf);
report_data_by_get_file(buf,buf_len);
- remove(UPDATAREPORT);
-
+
// }
}
cJSON_Delete(data);
if(is_new_version)
{
//下载差分包
- // //**********
+ // // //**********
container_updating->SetVisible(true);
scrollView->SetTouchable(false);
scrollView->SetDraggable(false);
if(data_len!=0)
{
FILE *FP_= fopen(UPDATAREPORT,"w+");
+ printf("升级文件保存\r\n");
fwrite(report_jsonString,1,data_len,FP_);
fclose(FP_);
printf("data%d %s\r\n",data_len,report_jsonString);
${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits
${ROOT_DIR}/application/wearable/nativeapp/nativeui/heartrate/include
${ROOT_DIR}/application/wearable/fd230app/nativeui/phone/include
+ ${ROOT_DIR}/application/wearable/fd230app/nativeui/system/include
)
set(SOURCES
#include "samgr_lite.h"
#include "thread_adapter.h"
#include "graphic_service.h"
-
+#include "SystemModel.h"
#ifdef __cplusplus
extern "C" {
return ERRCODE_SUCC;
}
+void up_report_timer(void)
+{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "up_report_timer_");
+ OHOS::start_report_timer();
+}
int incomingcall_event_sendmsg_toUI(char* callno);
int calldial_event_sendmsg_toUI(char* callno);
int cat1_msg_event_sendmsg_toUI(char* callno);
+void up_report_timer(void);
#ifdef __cplusplus
#if __cplusplus
}
LOS_Msleep(5000);
addressbookToRead(NULL);
+ up_report_timer();
if ( poweron_cat1_on_bootup_flag() )
{
PRINT("PowerOn Cat1 !\r\n");
//添加post
u8_t use_post;
- u8_t arglen;
+ u16_t arglen;
u8_t* args;