From: luozheng <1732036298@qq.com> Date: Fri, 17 Oct 2025 09:36:39 +0000 (+0800) Subject: ln:文件下载添加debug投票,下载后去投票 X-Git-Tag: V1.0.9_20251128_194606_LN~213 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=72437aaf06e4004d904493af4d6aaf3b0c895889;p=mirrors%2FFD230.git ln:文件下载添加debug投票,下载后去投票 --- diff --git a/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c b/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c index b8c4664ac..f3e1142c5 100644 --- a/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c +++ b/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c @@ -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; } diff --git a/code/sdk/zhihui/leiniao/imsl_ln/ln_api.h b/code/sdk/zhihui/leiniao/imsl_ln/ln_api.h index 5c852abad..5df754cd4 100644 --- a/code/sdk/zhihui/leiniao/imsl_ln/ln_api.h +++ b/code/sdk/zhihui/leiniao/imsl_ln/ln_api.h @@ -13,6 +13,7 @@ extern "C" #include #include "wearable_log.h" #include "ln_api_interface.h" +#include "pm_definition.h" // 产品名称:Amby Box // 产品型号:AB101 diff --git a/code/sdk/zhihui/leiniao/imsl_ln/ln_api_ota.c b/code/sdk/zhihui/leiniao/imsl_ln/ln_api_ota.c index 31461d7ec..c0fb39036 100644 --- a/code/sdk/zhihui/leiniao/imsl_ln/ln_api_ota.c +++ b/code/sdk/zhihui/leiniao/imsl_ln/ln_api_ota.c @@ -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