From: luozheng <1732036298@qq.com> Date: Thu, 9 Oct 2025 08:50:19 +0000 (+0800) Subject: 解决随机故事模式ui文本不更新问题,添加音频播放结束ui通知 X-Git-Tag: V1.0.9_20251128_194606_LN~275^2 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=df63e3e28dbfe9957e3f2575ca723cd52ec42e6b;p=mirrors%2FFD230.git 解决随机故事模式ui文本不更新问题,添加音频播放结束ui通知 --- 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 97d2e735e..43e43ce9d 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 @@ -64,6 +64,7 @@ typedef enum { HAND_DOWNLOAD_FILE_NOTIFY, // 下载文件通知 HAND_DOWNLOAD_SUCCESS_NOTIFY, // 下载成功通知 HAND_DOWNLOAD_FAIL_NOTIFY, // 下载失败通知 + HAND_AUDIO_PLAYBACK_END_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 34e9fb5a2..2d1e1e217 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 @@ -100,6 +100,7 @@ static void HandTextUpdateNotify(Request *request); static void HandDownloadFileNotify(Request *request); static void HandDownloadSuccessNotify(Request *request); static void HandDownloadFailNotify(Request *request); +static void HandAudioPlaybackEndNotify(Request *request); // 消息处理程序项数组(每个消息类型对应一个处理函数,函数名以 Handle 开头) MsgHandlerEntry msgHandlers[] = { {HANDLE_JUMP_OTA_VIEW, HandleJumpOtaView}, @@ -116,6 +117,7 @@ MsgHandlerEntry msgHandlers[] = { {HAND_DOWNLOAD_FILE_NOTIFY,HandDownloadFileNotify}, {HAND_DOWNLOAD_SUCCESS_NOTIFY,HandDownloadSuccessNotify}, {HAND_DOWNLOAD_FAIL_NOTIFY,HandDownloadFailNotify}, + {HAND_AUDIO_PLAYBACK_END_NOTIFY,HandAudioPlaybackEndNotify}, }; /* -------------------------------------------------------------------------- */ void ScreenTurnOn(int32_t timeout) @@ -598,6 +600,11 @@ void HandDownloadFailNotify(Request *request) int type = *(int *)request->data; WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "HandDownloadFailNotify type = %d", type); } +// 音频播放结束通知 +void HandAudioPlaybackEndNotify(Request *request) +{ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "HandAudioPlaybackEndNotify msg_id = %d", request->msgId); +} /* -------------------------------------------------------------------------- */ #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 1bedf9dfd..38ffd0f60 100644 --- a/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c +++ b/code/sdk/zhihui/leiniao/imsl_ln/ln_api.c @@ -672,6 +672,16 @@ void ln_ws_process_message(const ws_data_msg_t *data_msg, ws_command_t type) push_text_to_ui(data_msg->text_content); break; } + case WS_CMD_RANDOM_STORY_RESPONSE: + { + push_text_to_ui(data_msg->text_content); + break; + } + case WS_CMD_AUDIO_PLAYBACK_END: + { + push_audio_playback_end_notification(); + break; + } default: { printf("[WS] Unknown command=%s\n", cmd_str ? cmd_str : ""); 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 1e4b9c973..5d4da4d93 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 @@ -252,6 +252,11 @@ void push_download_progress_notification(int progress) { } +//通知音频播放结束了 +void push_audio_playback_end_notification(void) +{ + SendMsgToUIService(HAND_AUDIO_PLAYBACK_END_NOTIFY, 0, NULL, 0); +} #ifdef __cplusplus }; #endif \ No newline at end of file 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 ebbcfe3ae..8fa6d05e9 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 @@ -98,6 +98,8 @@ void push_download_success_notification(int type); void push_download_fail_notification(int type); // 推送文件下载进度通知到UI void push_download_progress_notification(int progress); +//通知音频播放结束了 +void push_audio_playback_end_notification(void); #ifdef __cplusplus } #endif