From: luozheng <1732036298@qq.com> Date: Sun, 28 Sep 2025 13:24:19 +0000 (+0800) Subject: 添加通知设备切换屏保 X-Git-Tag: V1.0.9_20251128_194606_LN~294^2~1 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=e72312596df9436cf968706f282a1cba9f2755d2;p=mirrors%2FFD230.git 添加通知设备切换屏保 --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/include/uiservice/ui_service.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/include/uiservice/ui_service.h index dfa501525..4e87f19bb 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/include/uiservice/ui_service.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/include/uiservice/ui_service.h @@ -60,6 +60,7 @@ typedef enum { HAND_CHAT_STAMINA_NOTIFY, // 对话体力与流量通知 HAND_API_ERROR_NOTIFY, // 协议错误通知 HAND_BIND_AND_UNBIND_NOTIFY, // 绑定和解绑通知 + HAND_SCREEN_IMAGE_DOWNLOAD_SUCCESS_NOTIFY, // 屏保下载成功通知 MAX_NUM_HANDLER, } UiServiceMsgId; diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/uiservice/src/ui_service.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/uiservice/src/ui_service.cpp index 2b8c73bc3..d7307d71e 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/uiservice/src/ui_service.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/uiservice/src/ui_service.cpp @@ -96,6 +96,7 @@ static void HandChatStaminaNotify(Request *request); static void HandDownloadEmojiNotify(Request *request); static void HandApiErrorNotify(Request *request); static void HandBindAndUnbindNotify(Request *request); +static void HandScreenImageDownloadSuccessNotify(Request *request); // 消息处理程序项数组(每个消息类型对应一个处理函数,函数名以 Handle 开头) MsgHandlerEntry msgHandlers[] = { {HANDLE_JUMP_OTA_VIEW, HandleJumpOtaView}, @@ -108,6 +109,7 @@ MsgHandlerEntry msgHandlers[] = { {HAND_DOWNLOAD_EMOJI_NOTIFY,HandDownloadEmojiNotify}, {HAND_API_ERROR_NOTIFY,HandApiErrorNotify}, {HAND_BIND_AND_UNBIND_NOTIFY,HandBindAndUnbindNotify}, + {HAND_SCREEN_IMAGE_DOWNLOAD_SUCCESS_NOTIFY,HandScreenImageDownloadSuccessNotify}, }; /* -------------------------------------------------------------------------- */ void ScreenTurnOn(int32_t timeout) @@ -530,6 +532,14 @@ void HandBindAndUnbindNotify(Request *request) std::bind(&OHOS::ThunderBirdModel::HandleBindAndUnbind,OHOS::ThunderBirdModel::GetInstance(), is_bind)); } +// 屏保下载成功通知 +void HandScreenImageDownloadSuccessNotify(Request *request) +{ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "HandScreenImageDownloadSuccessNotify msg_id = %d", request->msgId); + // GraphicService::GetInstance()->PostGraphicEvent( + // std::bind(&OHOS::ThunderBirdModel::HandleScreenImageDownloadSuccess,OHOS::ThunderBirdModel::GetInstance())); +} + /* -------------------------------------------------------------------------- */ #ifdef __cplusplus } diff --git a/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c b/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c index 784d74714..41dd73388 100644 --- a/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c +++ b/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c @@ -1111,6 +1111,15 @@ static void ln_http_server_send_task(void const *arg) } } } + if(ret == ERRCODE_SUCC) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DEVICE_CHARACTER] 屏保下载成功,通知去切换屏保"); + push_screen_image_download_success_notification(); + } + else + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DEVICE_CHARACTER] 屏保下载失败"); + } /* 释放由发送方分配的指针 */ if (req.url) { free(req.url); req.url = NULL; } if (req.save_path) { free(req.save_path); req.save_path = NULL; } diff --git a/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.cpp b/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.cpp index 041082139..ca7763f47 100644 --- a/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.cpp +++ b/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.cpp @@ -221,7 +221,12 @@ void push_bind_and_unbind_notification(int is_bind) SendMsgToUIService(HAND_BIND_AND_UNBIND_NOTIFY, 0, &is_bind, sizeof(is_bind)); } - +// 推送屏保下载成功通知到UI +void push_screen_image_download_success_notification(void) +{ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SCREEN_IMAGE_DOWNLOAD_SUCCESS]"); + SendMsgToUIService(HAND_SCREEN_IMAGE_DOWNLOAD_SUCCESS_NOTIFY, 0, NULL, 0); +} // 检测是否有外网连接 int check_internet_connection(void) { diff --git a/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.h b/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.h index b8f6cd199..e97ce4227 100644 --- a/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.h +++ b/code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.h @@ -84,6 +84,8 @@ bool switch_expression_video(const char *video_path); void push_api_error_notification(const char *message); //通知ui绑定和解绑 void push_bind_and_unbind_notification(int is_bind); +// 推送屏保下载成功通知到UI +void push_screen_image_download_success_notification(void); // 网络连接检测 int check_internet_connection(void);