解决随机故事模式ui文本不更新问题,添加音频播放结束ui通知 2464/target/2 2471/1 2471/head 2472/target/1
authorluozheng <1732036298@qq.com>
Thu, 9 Oct 2025 08:50:19 +0000 (16:50 +0800)
committerluozheng <1732036298@qq.com>
Thu, 9 Oct 2025 08:50:19 +0000 (16:50 +0800)
code/sdk/application/wearable/ln/nativeapp/nativeui/include/uiservice/ui_service.h
code/sdk/application/wearable/ln/nativeapp/nativeui/uiservice/src/ui_service.cpp
code/sdk/zhihui/leiniao/imsl_ln/ln_api.c
code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.cpp
code/sdk/zhihui/leiniao/ln_api_cpp/ln_api_interface.h

index 97d2e73..43e43ce 100644 (file)
@@ -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;
 
index 34e9fb5..2d1e1e2 100644 (file)
@@ -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
 }
index 1bedf9d..38ffd0f 100644 (file)
@@ -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 : "");
index 1e4b9c9..5d4da4d 100644 (file)
@@ -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
index ebbcfe3..8fa6d05 100644 (file)
@@ -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