ln:文件下载添加debug投票,下载后去投票
authorluozheng <1732036298@qq.com>
Fri, 17 Oct 2025 09:36:39 +0000 (17:36 +0800)
committerluozheng <1732036298@qq.com>
Fri, 17 Oct 2025 09:36:39 +0000 (17:36 +0800)
code/sdk/zhihui/leiniao/imsl_ln/ln_api.c
code/sdk/zhihui/leiniao/imsl_ln/ln_api.h
code/sdk/zhihui/leiniao/imsl_ln/ln_api_ota.c

index b8c4664..f3e1142 100644 (file)
@@ -404,6 +404,10 @@ int uapi_ln_download_file(const char *url, const char *save_path)
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DOWNLOAD] 开始下载: %s -> %s", url, save_path);
     g_ln_is_file_downloading = 1;
 
+    #ifdef SUPPORT_CAT1_SERVICE
+    uapi_pm_add_sleep_veto(PM_ID_DEBUG);
+    #endif
+
     HttpClient client = {0};
     HttpClientData client_data = {0};
     int ret = -1;
@@ -414,6 +418,9 @@ int uapi_ln_download_file(const char *url, const char *save_path)
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DOWNLOAD] fopen failed for %s", save_path);
         g_ln_is_file_downloading = 0;
+        #ifdef SUPPORT_CAT1_SERVICE
+        uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
+        #endif
         return ERRCODE_FAIL;
     }
 
@@ -423,6 +430,9 @@ int uapi_ln_download_file(const char *url, const char *save_path)
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DOWNLOAD] prepare failed: %d", prep);
         fclose(fd);
         g_ln_is_file_downloading = 0;
+        #ifdef SUPPORT_CAT1_SERVICE
+        uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
+        #endif
         return ERRCODE_FAIL;
     }
 
@@ -434,6 +444,9 @@ int uapi_ln_download_file(const char *url, const char *save_path)
         fclose(fd);
         HttpClientUnprepare(&client_data);
         g_ln_is_file_downloading = 0;
+        #ifdef SUPPORT_CAT1_SERVICE
+        uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
+        #endif
         return ERRCODE_FAIL;
     }
 
@@ -446,6 +459,9 @@ int uapi_ln_download_file(const char *url, const char *save_path)
         HttpClientClse(&client);
         HttpClientUnprepare(&client_data);
         g_ln_is_file_downloading = 0;
+        #ifdef SUPPORT_CAT1_SERVICE
+        uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
+        #endif
         return ERRCODE_FAIL;
     }
 
@@ -467,6 +483,9 @@ int uapi_ln_download_file(const char *url, const char *save_path)
                     fclose(fd);
                     HttpClientClse(&client);
                     HttpClientUnprepare(&client_data);
+                    #ifdef SUPPORT_CAT1_SERVICE
+                    uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
+                    #endif
                     return ERRCODE_FAIL;
                 }
                 total_written += written;
@@ -503,6 +522,9 @@ int uapi_ln_download_file(const char *url, const char *save_path)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "删除不完整文件成功\r\n");
         }
+        #ifdef SUPPORT_CAT1_SERVICE
+        uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
+        #endif
     }
 
     HttpClientUnprepare(&client_data);
@@ -510,6 +532,9 @@ int uapi_ln_download_file(const char *url, const char *save_path)
     fclose(fd);
     g_ln_is_file_downloading = 0;
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DOWNLOAD] 下载过程结束,ret=%d", ret);
+    #ifdef SUPPORT_CAT1_SERVICE
+    uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
+    #endif
     return ret;
 }
 
index 5c852ab..5df754c 100644 (file)
@@ -13,6 +13,7 @@ extern "C"
 #include <unistd.h>
 #include "wearable_log.h"
 #include "ln_api_interface.h"
+#include "pm_definition.h"
 
 // 产品名称:Amby Box
 // 产品型号:AB101
index 31461d7..c0fb390 100644 (file)
@@ -99,9 +99,11 @@ static void ln_ota_handle_download_msg(const OtaDownloadMsg *msg)
                     (void)uaip_cmd_update_request();
                 } else if (md5_ok == 0) {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"[OTA_DOWNLOAD] MD5校验失败,建议重新下载");
+                    uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
                     push_ota_status(OTA_UI_STATUS_FAILED);
                 } else {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"[OTA_DOWNLOAD] MD5校验出错");
+                    uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
                     push_ota_status(OTA_UI_STATUS_FAILED);
                 }
             }
@@ -113,6 +115,7 @@ static void ln_ota_handle_download_msg(const OtaDownloadMsg *msg)
                 do_ln_http_server_send_data(LN_HTTP_SERVICE_CMD_OTA_DOWNLOAD, NULL, 0);
             }
             else {
+                uapi_pm_remove_sleep_veto(PM_ID_DEBUG);
                 push_ota_status(OTA_UI_STATUS_FAILED);
             }
             break;
@@ -363,6 +366,7 @@ static int ln_download_file_to_path(const char *full_url, const char *save_path,
     /* CAT1 网络保活处理 */
     cat1_api_add_cat1_vote();
     cat1_api_disable_cat1_cmd(0);
+    uapi_pm_add_sleep_veto(PM_ID_DEBUG);
     LOS_Msleep(500); // 等待模块就绪
 #endif