统一OTA升级路径
authorhcj <1224667075@qq.com>
Fri, 1 Nov 2024 07:38:07 +0000 (15:38 +0800)
committerhcj <1224667075@qq.com>
Fri, 1 Nov 2024 07:38:07 +0000 (15:38 +0800)
code/sdk/application/wearable/fd230app/nativeui/system/include/Systemupgrade.h
code/sdk/application/wearable/fd230app/nativeui/system/src/Systemupgrade.cpp
code/sdk/application/wearable/fd230app/nativeui/systemupdate/include/SystemUpdateModel.h
code/sdk/application/wearable/service/msg_center/src/ota/msg_center_ota.cpp

index 7caa5aa..b685415 100644 (file)
@@ -11,7 +11,7 @@
 #include "components/ui_label_ext.h"
 #include "components/ui_label_button_ext.h"
 #include "cat1_ctl.h"
-
+#include "upg_common_porting.h"
 
 #if USE_THISIOT
 #define HTTP_JSON_SERVER_NAME "test.iot.api.thisiot.com"//"test.app.api.thisiot.com"//获取升级服务器
@@ -25,9 +25,7 @@
  * http://icfota.snicker.com.cn:8089/fd230ota.jsp?product=FD230&pkgver=V1.1_20240316_115535&imei=864430010001091
 查看 返回的"UptoDate" == False,即可根据"url"地址下载,文件校验可以后面再加。
 { "UptoDate": false ,
- "url" : "http://icfota.snicker.com.cn:8089/FD230/V1.1_20240316_115535/update.fwpkg", 
-"OtaPackageLength" : 177504,
- "OtaPackageName" : "update.fwpkg",
+
  "OtaPackageVersion" : "V1.1_20240316_130929", 
 "SystemVersion" : "V1.1_20240316_115535", 
 "description" : " update to checkota version 3 ",
 
 #define UPDATAJSONPATH "/user/update/ota_start_.json"//获取升级的得到的json
 #define UPDATAREPORT "/user/update/ota_start_reported_.json"//点升级后保存下来的json
-#define UPDATAFWPKGPATH "/user/update/update.fwpkg" //升级包
+#define UPDATAFWPKGPATH  UPG_FILE_NAME //升级包
 #define UPDATAREPORT_  "/user/update/ota_report_.json"//上报升级得到的json
 
 #else
 
 #define UPDATAJSONPATH "/update/ota_start_.json"//获取升级的得到的json
 #define UPDATAREPORT "/update/ota_start_reported_.json"//点升级后保存下来的json
-#define UPDATAFWPKGPATH "/update/update.fwpkg" //升级包
+#define UPDATAFWPKGPATH  UPG_FILE_NAME //升级包
 #define UPDATAREPORT_  "/update/ota_report_.json"//上报升级得到的json
 
 #endif
index 4dac40e..5182cda 100644 (file)
@@ -167,34 +167,7 @@ namespace OHOS
             char msg_buf[256]={0};
             bool falg=false;
 
-            // if(code==IOT_CODE_SUCCESS)
-            // {
-            //     falg=true;
-            //     cJSON *data=cJSON_GetObjectItem(root, "data");
-            //     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "");
-
-            //     report_jsonString = cJSON_PrintUnformatted(data);
-            //     //cJSON_Delete(data);
-            
-            //     if(data!=NULL)
-            //     {
-            //         cJSON *downloadFileVo=cJSON_GetObjectItem(data, "downloadFileVo");
-
-            //         if(downloadFileVo!=NULL)
-            //         {
-                        
-            //             //"http://r-oss.thisiot.com/device-ota/2024_04_22/1782329689464958978.fwpkg?Expires=1713780167&OSSAccessKeyId=LTAI5tJa2arDBmqSUsSTQJ1T&Signature=OlbdNsfnz9Zje6ypFgXINQPXVE0%3D"
-            //             // char *uri = "http://icfota.snicker.com.cn:8089/FD230/V1.1/update.fwpkg";
-            //             char *uri = cJSON_GetObjectItem(downloadFileVo, "url")->valuestring;
-            //             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uri %s",uri); 
-            //             sprintf((char *)uri_ota_package,"%s",uri);
-            //         }
-            //     }   
-            // }
-            // else
-            // {
-            //     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "code!=IOT_CODE_SUCCESS"); 
-            // }
+     
          
             sprintf(msg_buf,"%s",msg);
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",msg); 
@@ -667,13 +640,6 @@ namespace OHOS
     {
         if(is_fwpkg_ready)
         {
-            // char* Path="/user/data/update.fwpkg";
-            // FILE * fp = fopen(Path,"rb");
-            // if(fp!=NULL)
-            // {
-            //     fclose(fp);
-            //     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "file open succse fwpkg_is_ready");
-            // }
             //开始升级
             //**********
             statr_down_fwpkg();
index 2e0675a..2c19e8a 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <iostream>
 #include <fstream>
-
+#include "upg_common_porting.h"
 #define USE_THISIOT 1
 // http://iot.api.thisiot.com/ota/task/v2?deviceId=28110668A5D4&sourceVersion=1.1.41
 #if USE_THISIOT
@@ -26,9 +26,7 @@
  * http://icfota.snicker.com.cn:8089/fd230ota.jsp?product=FD230&pkgver=V1.1_20240316_115535&imei=864430010001091
 查看 返回的"UptoDate" == False,即可根据"url"地址下载,文件校验可以后面再加。
 { "UptoDate": false ,
- "url" : "http://icfota.snicker.com.cn:8089/FD230/V1.1_20240316_115535/update.fwpkg", 
-"OtaPackageLength" : 177504,
- "OtaPackageName" : "update.fwpkg",
+
  "OtaPackageVersion" : "V1.1_20240316_130929", 
 "SystemVersion" : "V1.1_20240316_115535", 
 "description" : " update to checkota version 3 ",
@@ -48,7 +46,7 @@
 
 #define UPDATAREPORT "/user/update/ota_start_reported_.json"//点升级后保存下来的json
 
-#define UPDATAFWPKGPATH "/user/update/update.fwpkg" //升级包
+#define UPDATAFWPKGPATH UPG_FILE_NAME //升级包
 
 #define UPDATAREPORT_  "/user/update/ota_report_.json"//上报升级得到的json
 
@@ -57,7 +55,7 @@
 
 #define UPDATAREPORT "/update/ota_start_reported_.json"//点升级后保存下来的json
 
-#define UPDATAFWPKGPATH "/update/update.fwpkg" //升级包
+#define UPDATAFWPKGPATH UPG_FILE_NAME//升级包
 
 #define UPDATAREPORT_  "/update/ota_report_.json"//上报升级得到的json
 
index ca43a62..12c458b 100644 (file)
@@ -18,6 +18,7 @@
 #include "msg_center_protocol.h"
 #include "wearable_log.h"
 #include "upg_porting.h"
+
 #ifdef SUPPORT_AUTO_OTA
 #include "auto_ota_service.h"
 #endif
@@ -38,9 +39,9 @@ extern uint8_t g_auto_ota_mac_tmp[];
 
 /* 固定升级包文件长度, "/user/update/update.fwpkg"*/
 #ifdef SINGLE_USER_PARTITION
-#define UPGRADE_FILE_PATH "/user/update/update.fwpkg"
+#define UPGRADE_FILE_PATH  UPG_FILE_NAME
 #else
-#define UPGRADE_FILE_PATH "/update/update.fwpkg"
+#define UPGRADE_FILE_PATH UPG_FILE_NAME
 #endif
 #define UPGRADE_FILE_LEN strlen(UPGRADE_FILE_PATH)