From 30834fd81ab9aabfa2373ef5a15c8fc972df8431 Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Thu, 6 Nov 2025 14:55:54 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E4=BA=8C=E6=AC=A1=E7=A1=AE?= =?utf8?q?=E8=AE=A4=E5=93=84=E7=9D=A1=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../thunderbird/src/ThunderBirdModel.cpp | 18 +++++++++++++++++- .../thunderbird/src/ThunderBirdPresenter.cpp | 10 ++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index 773bf27c2..9864d53d3 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -2166,6 +2166,23 @@ expressionPath += "/"; expressionPath += eyeColor; expressionPath += ".mp4"; + // 检查文件是否存在(宽松检查) + if (access(expressionPath.c_str(), F_OK) != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::SwitchExpressionVideo: file does not exist: %s", expressionPath.c_str()); + return false; + } + + // 尝试检查文件大小(非强制) + struct stat fileStat; + if (stat(expressionPath.c_str(), &fileStat) == 0) { + if (fileStat.st_size == 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::SwitchExpressionVideo: file is empty: %s", expressionPath.c_str()); + return false; + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::SwitchExpressionVideo: file size: %ld bytes", fileStat.st_size); + } else { + WEARABLE_LOGW(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::SwitchExpressionVideo: cannot get file stat for %s, proceeding anyway", expressionPath.c_str()); + } WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::SwitchExpression: switching to %s", expressionPath.c_str()); // 通过图形服务调用 ThunderBirdMainView 的 SwitchVideo 函数 @@ -2303,7 +2320,6 @@ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleSleepModeStart: 意图识别结果,跳转到2"); //看后续是否需要 ln_ws_end_audio_chat();//结束对话 - ln_ws_send_sleep_mode_inquire("哄我睡觉"); ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_2); } } else { diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp index 224b4e3b2..0796deaf7 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdPresenter.cpp @@ -172,7 +172,7 @@ namespace OHOS int16_t currentSubView = ThunderBirdMainView::GetInstance()->GetCurrentSubView(); //如果在二维码界面 要一直判断绑定状态 绑定成功就返回主界面 - if(currentSubView == ThunderBirdGuideView::THUNDERBIRD_GUIDEVIEW_3) + if(currentSubView == ThunderBirdGuideView::THUNDERBIRD_GUIDEVIEW_5) { //更新二维码 UpdateQrcodeIfValid(); @@ -455,6 +455,7 @@ namespace OHOS void ThunderBirdPresenter::ShowVolumeAdjustment(int volumeDelta) { ThunderBirdMainView::GetInstance()->ChangeThunderBirdReminderView(THUNDERBIRD_REMINDERVIEW); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "音量调节"); if (ThunderBirdReminderView::GetInstance()) { ThunderBirdModel::GetInstance()->StartReminderHideTimer(1000); ThunderBirdReminderView::GetInstance()->Show(ThunderBirdReminderView::THUNDERBIRD_REMINDERVIEW_VOLUME); @@ -580,10 +581,11 @@ namespace OHOS case ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_2: ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3); //清空文本队列 - ln_ws_end_audio_chat();//结束对话 - AI_ForceInterrupt(); - ln_ws_send_voice_chat_interrupt("进入哄睡"); + // ln_ws_end_audio_chat();//结束对话 + // AI_ForceInterrupt(); + // ln_ws_send_voice_chat_interrupt("进入哄睡"); ThunderBirdModel::GetInstance()->ClearAudioTextQueue(); + ln_ws_send_sleep_mode_inquire("StartSleepMode");//二次确认后询问 // ln_ws_start_audio_chat(LN_AUDIO_CHAT_CHOOSE_STORY_REQUEST); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HandleLullabyViewNavigation: 选择故事"); //ln_ws_send_random_story_request("随机故事"); -- 2.17.1