From 5b4ba679f6494388dd75a48a3731708f464dd9c0 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 14 Oct 2025 11:37:30 +0800 Subject: [PATCH] =?utf8?q?n9=E8=A7=A3=E5=86=B3=E8=93=9D=E7=89=99ai?= =?utf8?q?=E4=B8=8D=E5=8F=AF=E7=94=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/aivoice/src/AiVoiceModel.cpp | 2 +- .../nativeui/aivoice/src/AiVoicePresenter.cpp | 9 -------- .../nativeui/aivoice/src/AiVoiceView.cpp | 13 ++++++++--- .../nativeui/aivoice/src/AiVoiceModel.cpp | 3 +-- .../nativeui/aivoice/src/AiVoiceView.cpp | 23 ++++++++++++------- 5 files changed, 27 insertions(+), 23 deletions(-) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp index e80c80418..b5e2123b8 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp @@ -192,7 +192,7 @@ namespace OHOS else if (GetSelect4gorbt() == AI_SELECT_BT) { #ifdef SUPPORT_BLE_SERVICE - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "蓝牙:查询Ai是否就绪"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "蓝牙:查询Ai是否就绪:%d",it->second.second); inquire_AI_is_ready(it->second.second); #endif } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp index c6a9110d2..d0bc2dcd9 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -45,7 +45,6 @@ namespace OHOS #include #include #include - extern void set_need_tts_reconnect(uint8_t flag); void remove_4GAI_vote(void) { @@ -98,7 +97,6 @@ namespace OHOS void AiVoicePresenter::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnStart"); - Presenter::OnStart(); ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 开启一个60s取消长亮屏timer model->ai_start_screen60s_timer(); @@ -113,7 +111,6 @@ namespace OHOS void AiVoicePresenter::OnStop(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnStop start"); - Presenter::OnStop(); ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); model->StatusResume(); model->AIVoice_StopTimer(); @@ -130,9 +127,6 @@ namespace OHOS uapi_stop_all_websocket_servers(); uapi_destroy_all_websocket_servers(); #endif - - // dinit_ai_task(); - // ai_cleanup_resources(); uapi_ble_connect_param_update(BLE_CONNECT_INTERVAL_SLOW); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnStop end"); @@ -341,7 +335,6 @@ namespace OHOS break; case AIVOICE_RETURN_RESULT_TEXT_VIEWID: - // set_need_tts_reconnect(0); // 停止tts重连 AiVoiceModel::GetInstance().ClearQuestionAndAiAnswerStr(); // 清空上次用户问题和Ai回答字符串 AiVoiceModel::GetInstance().SetIsClickable(false); AiVoiceModel::GetInstance().SetIsLimitDisplayed(false); @@ -365,10 +358,8 @@ namespace OHOS AiVoiceModel::GetInstance().start_ai_isready_timer(); break; case AIVOICE_RETURN_RESULT_TEXT_VIEWID: - // set_need_tts_reconnect(1); // 开始tts重连 break; case AIVOICE_LISTENING_VIEWID: - // set_stop_send_ai_flag(0); // 开始发送AI数据 AiVoiceModel::GetInstance().StartListenAndRecordingUserQuestion(); AiVoiceModel::GetInstance().start_listening_timer(); break; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp index 7f5ea7c1a..820f3510e 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp @@ -487,7 +487,7 @@ namespace OHOS VolumeProcess->SetKnobStyle(StyleDefault::GetSliderKnobStyle()); VolumeProcess->RequestFocus(); VolumeProcess->SetRotateFactor(5.0); - // VolumeProcess->SetVisible(false); + VolumeProcess->SetVisible(false); VolumeProcess->SetOnRotateListener(presenter_); AddViewToRootContainer(VolumeProcess); } @@ -498,7 +498,7 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceView"); if (!CreateAiVoiceScrollView() || !CreateAiVoiceViewImageView() || !CreateAiVoiceViewPicker() || - !CreateAiVoiceViewLabel() || !CreateAiVoiceViewButton() || !CreateAiVoiceVoiceView()) + !CreateAiVoiceViewLabel() || !CreateAiVoiceViewButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceView fail!"); return nullptr; @@ -730,6 +730,13 @@ namespace OHOS { SendMsgToUIService(UI_UPDATE_USER_QUESTION_STR, 0, nullptr, 0); } + if(AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_4G) + { + if (VolumeProcess) + { + VolumeProcess->SetVisible(true); + } + } return true; } @@ -1086,7 +1093,7 @@ namespace OHOS void AiVoiceView::ChangeView(int16_t hideView, int16_t showView) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::ChangeView hideView:%d, showView:%d", hideView, showView); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::ChangeView hideView:%d, showView:%d", hideView, showView); if (!CheckViewParam(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CheckViewParam failed."); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp index 8931f3018..cdfc8d787 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp @@ -867,7 +867,6 @@ namespace OHOS } else if (AiVoiceModel::AI_RESPONSE_END) // 如果是AI 回应结束 { - return; if (errnote.empty()) // 如果没有回应数据 { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::GetErrnote is empty!!"); @@ -884,7 +883,7 @@ namespace OHOS if (!OHOS::AiVoiceModel::GetInstance().GetIsLimitDisplayed()) // 如果ai答案没有显示到极限了,就更新ai答案字符串 { aiAnswerStr += str; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "接受字的符串:%s", aiAnswerStr.c_str()); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "接受字的符串:%s", aiAnswerStr.c_str()); SendMsgToUIService(UI_UPDATE_AI_ANSWER_STR, 0, nullptr, 0); } } diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp index 85a668a05..a0a8fd7b0 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceView.cpp @@ -1,10 +1,10 @@ /* - * @Author: luozheng 1732036298@qq.com - * @Date: 2024-05-07 11:25:58 - * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2025-03-06 16:07:08 - * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AiVoiceView.cpp - */ +* @Author: luozheng 1732036298@qq.com +* @Date: 2024-05-07 11:25:58 +* @LastEditors: luozheng 1732036298@qq.com +* @LastEditTime: 2025-03-06 16:07:08 +* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AiVoiceView.cpp +*/ #include "aivoice/include/AiVoicePresenter.h" #include "aivoice/include/AiVoiceView.h" #include "aivoice/include/AiVoiceModel.h" @@ -487,7 +487,7 @@ namespace OHOS VolumeProcess->SetKnobStyle(StyleDefault::GetSliderKnobStyle()); VolumeProcess->RequestFocus(); VolumeProcess->SetRotateFactor(5.0); - // VolumeProcess->SetVisible(false); + VolumeProcess->SetVisible(false); VolumeProcess->SetOnRotateListener(presenter_); AddViewToRootContainer(VolumeProcess); } @@ -498,7 +498,7 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceView"); if (!CreateAiVoiceScrollView() || !CreateAiVoiceViewImageView() || !CreateAiVoiceViewPicker() || - !CreateAiVoiceViewLabel() || !CreateAiVoiceViewButton() || !CreateAiVoiceVoiceView()) + !CreateAiVoiceViewLabel() || !CreateAiVoiceViewButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceView fail!"); return nullptr; @@ -730,6 +730,13 @@ namespace OHOS { SendMsgToUIService(UI_UPDATE_USER_QUESTION_STR, 0, nullptr, 0); } + if(AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_4G) + { + if (VolumeProcess) + { + VolumeProcess->SetVisible(true); + } + } return true; } -- 2.17.1