From 00196fa8048f3431f75a16cae09b2b7b22551300 Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Wed, 3 Jun 2026 16:02:21 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9ai=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/aivoice/include/AiVoiceModel.h | 7 +- .../nativeui/aivoice/include/AiVoiceView.h | 2 +- .../src/AiVoiceBluetoothFailedStartView.cpp | 2 +- .../nativeui/aivoice/src/AiVoiceModel.cpp | 212 +++--------- .../nativeui/aivoice/src/AiVoicePresenter.cpp | 302 ++---------------- .../nativeui/aivoice/src/AiVoiceView.cpp | 82 +---- 6 files changed, 85 insertions(+), 522 deletions(-) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/include/AiVoiceModel.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/include/AiVoiceModel.h index 4a13a3736..eb090bb1b 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/include/AiVoiceModel.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/include/AiVoiceModel.h @@ -45,7 +45,6 @@ namespace OHOS { #define AI_SELECT_DEFAULT -1 #define AI_SELECT_4G 1 -#define AI_SELECT_BT 0 class AiVoiceModel { @@ -69,7 +68,6 @@ namespace OHOS bool IsExistOpenAIAPIKeys(); void DeleteLocalOpenAIAPIKeys(); - bool GetAPPBluetoothIsConnect(void); bool GetMobileDataIsOpen(void); void QuerySelectedAiModelIsConnect(); void CancelCurAIChat(void); @@ -153,8 +151,6 @@ namespace OHOS void SetAI_4G_state(bool state); bool GetAI_4G_state(void); - void SetAI_BT_state(bool state); - bool GetAI_BT_state(void); void SetInit_4gai_task(bool state); bool GetInit_4gai_task(void); void SetSelect4gorbt(int state); @@ -202,9 +198,8 @@ namespace OHOS bool isLimitDisplayed{false};//AI答案是否显示到极限了 bool AI_4G_state{false}; //4g网络状态 - bool AI_BT_state{false}; //蓝牙连接状态 bool init_4gai_task{false}; //4g服务器连接状态 - uint8_t select4gorbt{-1}; //0:4g 1:蓝牙 -1:未连接 + uint8_t select4gorbt{-1}; //1:4G -1:未连接 bool isFirstReceive{true}; //静态变量标记是否是首次接收 bool hasTtsStartSucceeded{false}; // uapi_start_tts 成功后置位,仅允许发送一次 diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/include/AiVoiceView.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/include/AiVoiceView.h index c86a2ef3b..3bb02cb5f 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/include/AiVoiceView.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/include/AiVoiceView.h @@ -57,7 +57,7 @@ namespace OHOS typedef enum { AIVOICE_STARTCHAT_VIEWID = 0, // 开始对话界面 - AIVOICE_ALERT_APPBLUETOOTH_AND_4GNETWORK_VIEWID, // APP蓝牙与4G网络都连接异常界面 + AIVOICE_ALERT_APPBLUETOOTH_AND_4GNETWORK_VIEWID, // 4G网络未连接异常界面 AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID, // 模型连接失败弹窗界面 AIVOICE_CONNECT_TIMEOUT_VIEWID, // 连接超时界面 AIVOICE_LISTENING_VIEWID, // 聆听中界面 diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceBluetoothFailedStartView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceBluetoothFailedStartView.cpp index 80752ad6b..43233a5b5 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceBluetoothFailedStartView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoiceBluetoothFailedStartView.cpp @@ -178,7 +178,7 @@ namespace OHOS /* -------------------------------------------------------------------------- */ labelconfig.left = 53; labelconfig.width = 360; - int textId[] = {STR_BOOT_FAILED, STR_PCY4GC_OR_AS}; /*启动失败,请检查4G或打开APP连接*/ + int textId[] = {STR_BOOT_FAILED, STR_PE4GC}; /*启动失败,请检查4G网络*/ for (int i = 0; i < sizeof(textId) / sizeof(textId[0]); i++) { labelconfig.top = 222 + i * 35; 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 b44167ec3..b59adf923 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 @@ -36,6 +36,7 @@ #include #include "websocket_server_manager.h" #include "font/ui_font.h" +#include "ct_ai_api.h" namespace OHOS { @@ -148,16 +149,6 @@ namespace OHOS ConfigModel::GetInstance()->SetOpenAIAPIKeys("-1"); } - // 获取APP蓝牙是否已连接 - bool AiVoiceModel::GetAPPBluetoothIsConnect(void) - { -#ifdef SUPPORT_BLE_SERVICE - return get_ble_connect(); -#else - return false; -#endif - } - // 获取4G网络是否正常 bool AiVoiceModel::GetMobileDataIsOpen(void) { @@ -175,26 +166,15 @@ namespace OHOS if (it != selectAiModelToTextId.end()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[QuerySelectedAiModelIsConnect] SelectAiModel = %d", it->second.second); - if (GetSelect4gorbt() == AI_SELECT_4G) + if (GetInit_4gai_task()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetSelect4gorbt() == AI_SELECT_4G"); - if (GetInit_4gai_task()) - { #ifdef SUPPORT_AI_SERVICE - uapi_start_AI_asr(); + uapi_start_AI_asr(); #endif - } - else - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "init_4gai_task fail!!"); - } } - else if (GetSelect4gorbt() == AI_SELECT_BT) + else { -#ifdef SUPPORT_BLE_SERVICE - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "蓝牙:查询Ai是否就绪:%d", it->second.second); - inquire_AI_is_ready(it->second.second); -#endif + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "init_4gai_task fail!!"); } } } @@ -551,30 +531,12 @@ namespace OHOS /*设置用户问题的字符串*/ void AiVoiceModel::SetUserQuestionStr(std::string str) { - if (GetSelect4gorbt() == AI_SELECT_4G) - { - if (str.empty()) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "传入的问题为空"); - return; - } - userQuestionStr += str; - } - else if (GetSelect4gorbt() == AI_SELECT_BT) + if (str.empty()) { - if (!entryTextViewState) - { - SendMsgToUIService(UI_AI_JUMP_TO_RESULT_VIEW, 0, nullptr, 0); - entryTextViewState = true; // 进入返回结果界面的标志 避免重复发消息 - usleep(50000); // 延时等待创建完成,0.05秒 - } - /* -------------------------------------------------------------------------- */ - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "传入的问题:%s", str.c_str()); - userQuestionStr = str; - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "拼接的问题:%s", userQuestionStr.c_str()); - /* -------------------------------------------------------------------------- */ - SendMsgToUIService(UI_UPDATE_USER_QUESTION_STR, 0, nullptr, 0); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "传入的问题为空"); + return; } + userQuestionStr += str; } /*获取Ai回答的字符串*/ @@ -859,57 +821,18 @@ namespace OHOS void AiVoiceModel::SetAiAnswerStrStr(std::string str, uint8_t type) { + UNUSED(type); AiVoiceView *view_ = AiVoiceView::GetInstance(); - if (GetSelect4gorbt() == AI_SELECT_4G) // 4G + if (view_ != nullptr) { - if (view_ != nullptr) + if (view_->GetAiVoiceScrollView(AIVOICE_RETURN_RESULT_TEXT_VIEWID) && + view_->GetAiVoiceScrollView(AIVOICE_RETURN_RESULT_TEXT_VIEWID)->IsVisible()) { - if (view_->GetAiVoiceScrollView(AIVOICE_RETURN_RESULT_TEXT_VIEWID) && - view_->GetAiVoiceScrollView(AIVOICE_RETURN_RESULT_TEXT_VIEWID)->IsVisible()) + start_update_ai_answer_timer(); + if (!OHOS::AiVoiceModel::GetInstance().GetIsLimitDisplayed()) // 如果ai答案没有显示到极限了,就更新ai答案字符串 { - start_update_ai_answer_timer(); - // delete_start_line_break_str(str); - if (!OHOS::AiVoiceModel::GetInstance().GetIsLimitDisplayed()) // 如果ai答案没有显示到极限了,就更新ai答案字符串 - { - aiAnswerStr += str; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "接受字的符串:%s", aiAnswerStr.c_str()); - // SendMsgToUIService(UI_UPDATE_AI_ANSWER_STR, 0, nullptr, 0); - } - } - } - } - else if (GetSelect4gorbt() == AI_SELECT_BT) // 蓝牙 - { - AIResponseType = type; - errnote = str; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AIResponseType = %d,errnote = %s\n", AIResponseType, errnote.c_str()); - // 如果是:AI录音解析错误或AI 回应错误 ,或者重传多次录音数据->跳转AI回应错误界面 - if (AIResponseType == AiVoiceModel::AI_RECORDING_PARSING_ERROR || AIResponseType == AiVoiceModel::AI_RESPONSE_ERROR || AIResponseType == AiVoiceModel::AI_BLE_ERROR) - { - SendMsgToUIService(UI_AI_JUMP_TO_RESPONDERR_VIEW, 0, (void *)errnote.c_str(), errnote.length()); - return; - } - else if (AiVoiceModel::AI_RESPONSE_END) // 如果是AI 回应结束 - { - if (errnote.empty()) // 如果没有回应数据 - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::GetErrnote is empty!!"); - // AiVoiceModel::GetInstance().SetErrnote("响应内容为空"); - // std::string str = AiVoiceModel::GetInstance().GetErrnote(); - // SendMsgToUIService(UI_AI_JUMP_TO_RESPONDERR_VIEW, 0, (void *)str.c_str(), str.length()); - return; - } - } - if (view_ != nullptr) - { - if (view_->GetAiVoiceScrollView(AIVOICE_RETURN_RESULT_TEXT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_RETURN_RESULT_TEXT_VIEWID)->IsVisible()) - { - if (!OHOS::AiVoiceModel::GetInstance().GetIsLimitDisplayed()) // 如果ai答案没有显示到极限了,就更新ai答案字符串 - { - aiAnswerStr += str; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "接受字的符串:%s", aiAnswerStr.c_str()); - SendMsgToUIService(UI_UPDATE_AI_ANSWER_STR, 0, nullptr, 0); - } + aiAnswerStr += str; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "接受字的符串:%s", aiAnswerStr.c_str()); } } } @@ -956,17 +879,9 @@ namespace OHOS if ((view_->GetAiVoiceScrollView(AIVOICE_LISTENING_VIEWID) != nullptr) && (view_->GetAiVoiceScrollView(AIVOICE_LISTENING_VIEWID)->IsVisible())) { + ct_ai_ws_voice_stream_start(); #if IS_SUPPORT_REALTIME_RECORD_SEND_AI - int type = GetCurUsingAiModelType(); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "type = %d", type); - if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_BT) - { - streamingRecordAndSend_AI(type); // 实时发送录音数据 - } - else if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_4G) - { - // uapi_start_asr_StartTranscription();录音同步移动到开启asr了,所有这里不调用 - } + /* 4G 上行由 ct_ai_ws_audio_init + voice_stream 会话发送 PCM */ #else std::string audioPath = AiVoiceModel::GetInstance().GetAIAudioPath(); if (uapi_delete_files(audioPath.c_str())) // 先删除文件 @@ -995,20 +910,10 @@ namespace OHOS void AiVoiceModel::StopListenAndRecordingUserQuestion(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "停止录音"); - if (GetSelect4gorbt() == AI_SELECT_4G) // 选的是4G需要关闭asr - { + ct_ai_ws_voice_stream_end(); #ifdef SUPPORT_AI_SERVICE - uapi_stop_AI_asr(); + uapi_stop_AI_asr(); #endif - } - else if (GetSelect4gorbt() == AI_SELECT_BT) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "停止录音BT"); - int32_t argc = 1; - uint8_t *argv = (uint8_t *)"stop"; - AudioCaptureSample(argc, (const char **)&argv); - StopStreamingRecordAndSend_AI(); - } uapi_save_runtime_log(RUNTIME_LOG_RECORD_STOP_AI); // TOOD* return; } @@ -1046,8 +951,7 @@ namespace OHOS isClickable = false; isLimitDisplayed = false; AI_4G_state = false; - AI_BT_state = false; - select4gorbt = -1; + select4gorbt = AI_SELECT_DEFAULT; // init_4gai_task = false;//TOOD:之后需要销毁 } @@ -1066,35 +970,18 @@ namespace OHOS AiVoiceModel::GetInstance().SetErrnote("连接超时,请重新开始对话"); std::string str = AiVoiceModel::GetInstance().GetErrnote(); - if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_4G) - { - // dinit_ai_task(); // 所有服务都删除重新连一下服务器 #ifdef SUPPORT_AI_SERVICE - uapi_stop_all_websocket_servers(); - uapi_destroy_all_websocket_servers(); + uapi_stop_all_websocket_servers(); + uapi_destroy_all_websocket_servers(); #endif - } SendMsgToUIService(UI_AI_JUMP_TO_RESPONDERR_VIEW, 0, (void *)str.c_str(), str.length()); } else { - if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_4G) + if (AiVoiceModel::GetInstance().is_need_to_jump_result_view()) { - if (AiVoiceModel::GetInstance().is_need_to_jump_result_view()) - { - SendMsgToUIService(UI_AI_JUMP_TO_RESULT_VIEW, 0, nullptr, 0); - } - return; - } - else if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_BT) - { - if (AiVoiceModel::GetInstance().GetAPPBluetoothIsConnect() == false) // 蓝牙的连接状态判断,如果AI思考过程中途断连,直接弹窗提示,不在硬等 - { - AiVoiceModel::GetInstance().SetErrnote("手机蓝牙已断开"); - std::string str = AiVoiceModel::GetInstance().GetErrnote(); - SendMsgToUIService(UI_AI_JUMP_TO_RESPONDERR_VIEW, 0, (void *)str.c_str(), str.length()); - } + SendMsgToUIService(UI_AI_JUMP_TO_RESULT_VIEW, 0, nullptr, 0); } } return; @@ -1184,10 +1071,6 @@ namespace OHOS { // 60s后息屏停止定时 AiVoiceModel::GetInstance().ai_stop_screen60s_timer(); - if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_BT) - { - ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); // 取消常亮屏 - } } } static void ai_start_screen60s_timer_callback(int data) @@ -1361,33 +1244,24 @@ namespace OHOS if ((view_->GetAiVoiceScrollView(AIVOICE_AIMODE_CONNECTING) != nullptr) && (view_->GetAiVoiceScrollView(AIVOICE_AIMODE_CONNECTING)->IsVisible())) { - if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_4G) - { - // dinit_ai_task(); // 所有服务都删除重新连一下服务器 #ifdef SUPPORT_AI_SERVICE - uapi_stop_all_websocket_servers(); - uapi_destroy_all_websocket_servers(); + uapi_stop_all_websocket_servers(); + uapi_destroy_all_websocket_servers(); #endif - } p_AiVoicePresenter->ChangeViewAndLogicOperator(AIVOICE_AIMODE_CONNECTING, AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID); } } } else { - if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_4G) + if (AiVoiceModel::GetInstance().GetInit_4gai_task()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetSelect4gorbt() == AI_SELECT_4G"); - if (AiVoiceModel::GetInstance().GetInit_4gai_task()) + uint8_t state = 0; + state = get_asr_is_ready_start_old(); + if (state) { - uint8_t state = 0; - // state = get_asr_is_ready_start(); - state = get_asr_is_ready_start_old(); - if (state) - { - bool state = true; - SendMsgToUIService(UI_AI_JUMP_TO_LISTENING_VIEW, 0, &state, sizeof(bool)); - } + bool ready = true; + SendMsgToUIService(UI_AI_JUMP_TO_LISTENING_VIEW, 0, &ready, sizeof(bool)); } } } @@ -1831,14 +1705,6 @@ namespace OHOS { return AI_4G_state; } - void AiVoiceModel::SetAI_BT_state(bool state) - { - AI_BT_state = state; - } - bool AiVoiceModel::GetAI_BT_state(void) - { - return AI_BT_state; - } void AiVoiceModel::SetInit_4gai_task(bool state) { init_4gai_task = state; @@ -1886,7 +1752,7 @@ namespace OHOS // 删除开始的换行符 void AiVoiceModel::delete_start_line_break_str(std::string &str) { - if (GetSelect4gorbt() == AI_SELECT_4G && GetAiModelTextId() == STR_AIMODELS_DOUBAO) + if (GetAiModelTextId() == STR_AIMODELS_DOUBAO) { if (isFirstReceive) { @@ -1982,13 +1848,9 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ - uint8_t getselect4gorbtai(void) // 获取AI模型选择的是4G还是蓝牙 + uint8_t getselect4gorbtai(void) // AI仅支持4G { - if (OHOS::AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_4G) - { - return 1; - } - return 0; + return 1; } #ifdef BLE_INSTRUCT diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp index e1e0f93de..8c232c616 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -17,16 +17,10 @@ #include // For std::string #include // For std::unordered_map -#ifdef SUPPORT_BLE_SERVICE -#include -#include "bleService.h" -#endif - #include #include "gfx_utils/mem_check.h" #include "player/include/PlayersModel.h" #include "NativeRegisterManager.h" -#include "aivoice/include/AiVoiceSelectView.h" #include "graphic_service.h" #include "websocket_server_manager.h" #include "custom_utils.h" @@ -67,7 +61,6 @@ namespace OHOS #ifdef __cplusplus } #endif -#define BLE_CONNECT_INTERVAL_HIGH_AI 10 // 当前Presenter属性实例化的内存指针 static AiVoicePresenter *g_pAiVoicePresenter = nullptr; @@ -103,7 +96,6 @@ namespace OHOS add_4GAI_vote(); // 4g投票 net4g_AI_init(); - uapi_ble_connect_param_update(BLE_CONNECT_INTERVAL_HIGH_AI); Audio::AudioManager::GetInstance().SetVolume(AUDIO_STREAM_VOICE_ASSISTANT, 100); } @@ -128,7 +120,6 @@ namespace OHOS uapi_destroy_all_websocket_servers(); #endif - uapi_ble_connect_param_update(BLE_CONNECT_INTERVAL_SLOW); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnStop end"); return; } @@ -142,29 +133,12 @@ namespace OHOS bool AiVoicePresenter::JumpToReturnResultTextView(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::JumpToReturnResultTextView"); - if (model->GetSelect4gorbt() == AI_SELECT_4G) - { - preHeight = 0; - if (model->GetCurView() == AIVOICE_LISTENING_VIEWID || model->GetCurView() == AIVOICE_THINKING_VIEWID) - { - if (view_->GetAiVoiceScrollView(AIVOICE_LISTENING_VIEWID) || view_->GetAiVoiceScrollView(AIVOICE_THINKING_VIEWID)) - { - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_RETURN_RESULT_TEXT_VIEWID); - } - else - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::JumpToReturnResultTextView fail"); - return false; - } - } - } - else if (model->GetSelect4gorbt() == AI_SELECT_BT) + preHeight = 0; + if (model->GetCurView() == AIVOICE_LISTENING_VIEWID || model->GetCurView() == AIVOICE_THINKING_VIEWID) { - if (view_->GetAiVoiceScrollView(AIVOICE_THINKING_VIEWID) != nullptr && - view_->GetAiVoiceScrollView(AIVOICE_THINKING_VIEWID)->IsVisible()) + if (view_->GetAiVoiceScrollView(AIVOICE_LISTENING_VIEWID) || view_->GetAiVoiceScrollView(AIVOICE_THINKING_VIEWID)) { - preHeight = 0; - ChangeViewAndLogicOperator(AIVOICE_THINKING_VIEWID, AIVOICE_RETURN_RESULT_TEXT_VIEWID); + ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_RETURN_RESULT_TEXT_VIEWID); } else { @@ -179,50 +153,21 @@ namespace OHOS bool AiVoicePresenter::ChangeToAIVoiceListeningView(bool val) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::ChangeToAIVoiceListeningView"); - if (model->GetSelect4gorbt() == AI_SELECT_4G) + if (val) /*如果查询的AI模型可用跳转到聆听中界面*/ + { + ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_LISTENING_VIEWID); + } + else { - if (val) /*如果查询的AI模型可用跳转到聆听中界面*/ + if (model->GetAiModelTextId() == STR_AIMODES_CHATGPT) // 如果当前是在chatgpt模型*/ { - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_LISTENING_VIEWID); + ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ } else { - if (model->GetAiModelTextId() == STR_AIMODES_CHATGPT) // 如果当前是在chatgpt模型*/ - { - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ - } - else - { - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID); - } + ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID); } } - else if (model->GetSelect4gorbt() == AI_SELECT_BT) - { - if (view_->GetAiVoiceScrollView(AIVOICE_AIMODE_CONNECTING) != nullptr && view_->GetAiVoiceScrollView(AIVOICE_AIMODE_CONNECTING)->IsVisible()) - { - if (val) /*如果查询的AI模型可用跳转到聆听中界面*/ - { - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_LISTENING_VIEWID); - } - else - { - if (model->GetAiModelTextId() == STR_AIMODES_CHATGPT) // 如果当前是在chatgpt模型*/ - { - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ - } - else - { - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID); - } - } - } - } - else - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::ChangeToAIVoiceListeningView fail"); - return false; - } return true; } @@ -243,52 +188,18 @@ namespace OHOS void AiVoicePresenter::FunctionKeyOnClickToChangeAIModel(void) { - if (view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true) - { - int index = model->GetSelectAiModel() + 1; - if (index >= AIMODES_MAX_NUM) - { - index = 0; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index); - model->SetSelectAiModel(index); - view_->ChangeAiModelAndUpdateComponentsStatus(); - model->reset_ai_screen60s_timer_time(); // 重置60s取消常亮屏timer - } return; } - // 右滑切换模型 + // 右滑切换模型(已取消大模型选择) void AiVoicePresenter::DragLeftToRightChangeAIModel(void) { - if (view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true) - { - int index = model->GetSelectAiModel() - 1; - if (index < 0) - { - index = AIMODES_CHATGPT; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index); - model->SetSelectAiModel(index); - view_->ChangeAiModelAndUpdateComponentsStatus(); - } return; } - // 左滑切换模型 + // 左滑切换模型(已取消大模型选择) void AiVoicePresenter::DragRightToLetfChangeAIModel(void) { - if (view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true) - { - int index = model->GetSelectAiModel() + 1; - if (index >= AIMODES_MAX_NUM) - { - index = 0; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index); - model->SetSelectAiModel(index); - view_->ChangeAiModelAndUpdateComponentsStatus(); - } return; } @@ -393,18 +304,6 @@ namespace OHOS model->reset_ai_screen60s_timer_time(); // 重置60s取消常亮屏timer - if (strcmp(view.GetViewId(), AIVOICE_IMGAE_VIEW_ID) == 0) /*点击的是Ai模型就切换模型*/ - { - int index = model->GetSelectAiModel() + 1; - if (index >= AIMODES_MAX_NUM) - { - index = 0; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiModelsPresenter::index = %d", index); - model->SetSelectAiModel(index); - view_->ChangeAiModelAndUpdateComponentsStatus(); - } - return true; } @@ -432,63 +331,13 @@ namespace OHOS { PlayersModel::GetInstance()->HandPausePhoneMusic(); // 暂停手机音乐 PlayersModel::GetInstance()->PlayerPause(); // 暂停手机音乐 - /* - * 进入对话流程: - * 1.当手表4G网络正常+与app连接正常 -> 通过4G调用大模型 - * 2.只有手表4G网络正常 -> 通过4G调用大模型 - * 3.只有与APP蓝牙连接正常 -> 通过蓝牙连接APP调用大模型 - * 4.两者连接都异常 -> 返回错误 - */ + /* 进入对话流程:仅通过4G调用大模型 */ bool netWork4GState = model->GetMobileDataIsOpen(); - bool appBluetoothConnectState = model->GetAPPBluetoothIsConnect(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "netWork4GState = %d,appBluetoothConnectState = %d", netWork4GState, appBluetoothConnectState); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "netWork4GState = %d", netWork4GState); model->SetAI_4G_state(netWork4GState); - model->SetAI_BT_state(appBluetoothConnectState); - if ((netWork4GState && appBluetoothConnectState)) + if (netWork4GState) { - // 获取用户上次的选择 - int lastSelectedType = model->GetSelect4gorbt(); - // 两者都可用,检查是否有上次的选择 - if (lastSelectedType == AI_SELECT_4G) - { - // 使用4G - model->SetSelect4gorbt(AI_SELECT_4G); - if (model->GetAiModelTextId() == STR_AIMODES_CHATGPT) // 如果当前是在chatgpt模型*/ - { - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ - return true; - } - if (!model->GetInit_4gai_task()) - { -// init_ai_task(AiVoiceModel::GetInstance().GetCurUsing4GAiModelType()); -#ifdef SUPPORT_AI_SERVICE - uapi_init_all_websocket_servers(); - uapi_start_all_websocket_servers(AiVoiceModel::GetInstance().GetCurUsing4GAiModelType()); // 连接服务器 -#endif - model->start_ai4g_connect_timer(); - ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_4GSERVICECON_VIEW); // LOADING - } - else - { - ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_AIMODE_CONNECTING); // LOADING - } - } - else if (lastSelectedType == AI_SELECT_BT) - { - // 使用蓝牙 - model->SetSelect4gorbt(AI_SELECT_BT); - ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_AIMODE_CONNECTING); // LOADING - } - else - { - // 没有上次的选择,让用户选择 - ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_SELECT_VIEW); // LOADING - } - } - else if (netWork4GState) // 1.手表4G网络正常 - { - // 通过4G调用大模型 model->SetSelect4gorbt(AI_SELECT_4G); if (model->GetAiModelTextId() == STR_AIMODES_CHATGPT) // 如果当前是在chatgpt模型*/ { @@ -497,13 +346,10 @@ namespace OHOS } if (!model->GetInit_4gai_task()) { - /* -------------------------------------------------------------------------- */ - // init_ai_task(AiVoiceModel::GetInstance().GetCurUsing4GAiModelType()); #ifdef SUPPORT_AI_SERVICE uapi_init_all_websocket_servers(); uapi_start_all_websocket_servers(AiVoiceModel::GetInstance().GetCurUsing4GAiModelType()); // 连接服务器 #endif - /* -------------------------------------------------------------------------- */ model->start_ai4g_connect_timer(); ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_4GSERVICECON_VIEW); // LOADING } @@ -512,15 +358,8 @@ namespace OHOS ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_AIMODE_CONNECTING); // LOADING } } - else if (appBluetoothConnectState) // 3.只有与APP蓝牙连接正常 - { - // 通过蓝牙连接APP调用大模型 - model->SetSelect4gorbt(AI_SELECT_BT); - ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_AIMODE_CONNECTING); // LOADING - } - else // 4.两者连接都异常 + else { - // 返回错误 model->SetSelect4gorbt(AI_SELECT_DEFAULT); ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_ALERT_APPBLUETOOTH_AND_4GNETWORK_VIEWID); } @@ -531,38 +370,6 @@ namespace OHOS ChangeViewAndLogicOperator(AIVOICE_LISTENING_VIEWID, AIVOICE_THINKING_VIEWID); return true; } - else if (viewId == AIVOICE_SELECT_VIEW_BUTTON4G_VIEW_ID) // 如果点击的是4G连接方式 - { - // 通过4G调用大模型 - model->SetSelect4gorbt(AI_SELECT_4G); - if (model->GetAiModelTextId() == STR_AIMODES_CHATGPT) // 如果当前是在chatgpt模型*/ - { - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ - return true; - } - if (!model->GetInit_4gai_task()) - { - // init_ai_task(AiVoiceModel::GetInstance().GetCurUsing4GAiModelType()); -#ifdef SUPPORT_AI_SERVICE - uapi_init_all_websocket_servers(); - uapi_start_all_websocket_servers(AiVoiceModel::GetInstance().GetCurUsing4GAiModelType()); // 连接服务器 -#endif - model->start_ai4g_connect_timer(); - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_4GSERVICECON_VIEW); // LOADING - } - else - { - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_AIMODE_CONNECTING); // LOADING - } - return true; - } - else if (viewId == AIVOICE_SELECT_VIEW_BUTTONBT_VIEW_ID) // 如果点击的是蓝牙连接方式 - { - model->SetSelect4gorbt(AI_SELECT_BT); - ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_AIMODE_CONNECTING); - return true; - } - std::unordered_map> viewIdMap = { {AIVOICERETURNRESULTTEXT_RETURN_BUTTON_VIEW_ID, {AIVOICE_RETURN_RESULT_TEXT_VIEWID, AIVOICE_STARTCHAT_VIEWID}}, // 返回一级界面,并清除手表聊天记录 {AIVOICERETURNRESULTTEXT_CONTINUECHAT_BUTTON_VIEW_ID, {AIVOICE_RETURN_RESULT_TEXT_VIEWID, AIVOICE_LISTENING_VIEWID}}, // 返回继续聆听,并清除手表聊天记录 @@ -572,33 +379,22 @@ namespace OHOS { if (it->first == AIVOICERETURNRESULTTEXT_CONTINUECHAT_BUTTON_VIEW_ID) // 点击继续对话按钮要发取消当前对话指令,避免AI回应中途按继续对话按钮没有取消上一次对话问题 { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CancelCurAIChat"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Continue chat via 4G"); PlayersModel::GetInstance()->HandPausePhoneMusic(); // 暂停手机音乐 PlayersModel::GetInstance()->PlayerPause(); // 暂停手机音乐 - if (model->GetSelect4gorbt() == AI_SELECT_4G) - { - AiVoiceModel::GetInstance().stop_ai4g_tts_play_timer(); - AiVoiceModel::GetInstance().stop_uapi_stop_tts_timer(); - ChangeViewAndLogicOperator(AIVOICE_RETURN_RESULT_TEXT_VIEWID, AIVOICE_AIMODE_CONNECTING); - return true; - } - else if (model->GetSelect4gorbt() == AI_SELECT_BT) - { - AiVoiceModel::GetInstance().CancelCurAIChat(); - AiVoiceModel::GetInstance().sendAIIsReady(); - } + AiVoiceModel::GetInstance().stop_ai4g_tts_play_timer(); + AiVoiceModel::GetInstance().stop_uapi_stop_tts_timer(); + ChangeViewAndLogicOperator(AIVOICE_RETURN_RESULT_TEXT_VIEWID, AIVOICE_AIMODE_CONNECTING); + return true; } else if (it->first == AIVOICERETURNRESULTTEXT_RETURN_BUTTON_VIEW_ID) { - if (model->GetSelect4gorbt() == AI_SELECT_4G) - { - AiVoiceModel::GetInstance().stop_ai4g_tts_play_timer(); - AiVoiceModel::GetInstance().stop_uapi_stop_tts_timer(); + AiVoiceModel::GetInstance().stop_ai4g_tts_play_timer(); + AiVoiceModel::GetInstance().stop_uapi_stop_tts_timer(); #ifdef SUPPORT_AI_SERVICE - uapi_stop_all_websocket_servers(); - uapi_destroy_all_websocket_servers(); + uapi_stop_all_websocket_servers(); + uapi_destroy_all_websocket_servers(); #endif - } } ChangeViewAndLogicOperator(it->second.first, it->second.second); return true; @@ -616,14 +412,10 @@ namespace OHOS { if (it->first != ALERT_APPBLUETOOTH_AND_4GNETWORK_ENSURE_BUTTON_VIEW_ID) { - if (model->GetSelect4gorbt() == AI_SELECT_4G) - { - // dinit_ai_task(); #ifdef SUPPORT_AI_SERVICE - uapi_stop_all_websocket_servers(); - uapi_destroy_all_websocket_servers(); + uapi_stop_all_websocket_servers(); + uapi_destroy_all_websocket_servers(); #endif - } } ChangeViewAndLogicOperator(it->second.first, it->second.second); return true; @@ -658,20 +450,15 @@ namespace OHOS model->reset_ai_screen60s_timer_time(); // 重置60s取消常亮屏timer - if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT) /*左滑*/ - { - DragRightToLetfChangeAIModel(); - } - else if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && AiVoicePresenter::X_DRAG_FLAG) /*右滑*/ + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && AiVoicePresenter::X_DRAG_FLAG) /*右滑*/ { if (scrollView == view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)) { - // 开始对话界面,右滑切换界面 - DragLeftToRightChangeAIModel(); + /* 开始对话界面不再切换大模型 */ } else if (scrollView == view_->GetAiVoiceScrollView(AIVOICE_ALERT_APPBLUETOOTH_AND_4GNETWORK_VIEWID)) { - /*APP蓝牙与4G网络都连接异常界面右滑退回到开始对话界面*/ + /*4G网络未连接界面右滑退回到开始对话界面*/ ChangeViewAndLogicOperator(AIVOICE_ALERT_APPBLUETOOTH_AND_4GNETWORK_VIEWID, AIVOICE_STARTCHAT_VIEWID); } else if (scrollView == view_->GetAiVoiceScrollView(AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID)) @@ -681,21 +468,11 @@ namespace OHOS } else if (scrollView == view_->GetAiVoiceScrollView(AIVOICE_LISTENING_VIEWID)) { - if (model->GetSelect4gorbt() == AI_SELECT_4G) - { - return true; - } - /*聆听中界面右滑退回到AI对话界面*/ - ChangeViewAndLogicOperator(AIVOICE_LISTENING_VIEWID, AIVOICE_STARTCHAT_VIEWID); + return true; } else if (scrollView == view_->GetAiVoiceScrollView(AIVOICE_THINKING_VIEWID)) { - if (model->GetSelect4gorbt() == AI_SELECT_4G) - { - return true; - } - /*思考中界面右滑退到AI对话界面*/ - ChangeViewAndLogicOperator(AIVOICE_THINKING_VIEWID, AIVOICE_STARTCHAT_VIEWID); + return true; } else if (scrollView == view_->GetAiVoiceScrollView(AIVOICE_CONNECT_TIMEOUT_VIEWID)) { @@ -744,22 +521,13 @@ namespace OHOS if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); - if (model->GetSelect4gorbt() == AI_SELECT_BT) - { - AiVoiceModel::GetInstance().CancelCurAIChat(); - } } return true; } void AiVoicePresenter::OnPickerStoped(UIPicker &picker) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnPickerStoped,%d", picker.GetSelected()); - if (view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true) - { - model->SetSelectAiModel(picker.GetSelected()); - view_->ChangeAiModelAndUpdateComponentsStatus(); - } + UNUSED(picker); return; } 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 d4b460b1d..2f28ddd5c 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 @@ -235,7 +235,7 @@ namespace OHOS .height = 35, .fontSize = 30, .lineHeigh = 35, - .textId = AiVoiceModel::GetInstance().GetAiModelTextId(), + .textId = STR_AI_VOICE, .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION, }; title = AiVoiceViewLabelInit(labelConfig); @@ -244,6 +244,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "title new fail!"); return false; } + title->SetText("AI对话"); /* ----------------------------- startChatLabel ----------------------------- */ labelConfig = { .left = 133, @@ -334,9 +335,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::aiModelImage is nullptr!!"); return false; } - aiModelImage->SetTouchable(true); - aiModelImage->SetViewId(AIVOICE_IMGAE_VIEW_ID); - aiModelImage->SetOnClickListener(presenter_); + aiModelImage->SetVisible(false); /* -------------------------------- buttonBgImage -------------------------------- */ imagecinfig = { .x = 208, @@ -454,7 +453,7 @@ namespace OHOS aiModelPicker->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x00), Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x00)); const char *uiPicker1Data[] = {"0", "1", "2", "3", "4", "5"}; aiModelPicker->SetValues(uiPicker1Data, sizeof(uiPicker1Data) / sizeof(uiPicker1Data[0])); - // aiModelPicker->SetVisible(false);//屏蔽picker组件 + aiModelPicker->SetVisible(false); } return true; @@ -514,7 +513,7 @@ namespace OHOS UIScrollView *AiVoiceView::CreateAiVoiceView(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceView"); - if (!CreateAiVoiceScrollView() || !CreateAiVoiceViewImageView() || !CreateAiVoiceViewPicker() || + if (!CreateAiVoiceScrollView() || !CreateAiVoiceViewImageView() || !CreateAiVoiceViewLabel() || !CreateAiVoiceViewButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceView fail!"); @@ -522,8 +521,6 @@ namespace OHOS } // scrollView->Add(VolumeProcess); scrollView->Add(title); - scrollView->Add(aiModelPicker); - scrollView->Add(aiModelImage); scrollView->Add(startChatButton); scrollView->Add(startChatLabel); scrollView->Add(chatButton); @@ -577,14 +574,10 @@ namespace OHOS VolumeProcess->RequestFocus(); } } - if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_BT) - { - AiVoiceModel::GetInstance().CancelCurAIChat(); - } return true; } - /*切换到APP蓝牙或4G网络未连接界面界面*/ + /*切换到4G网络未连接界面*/ bool AiVoiceView::ChangeAiVoiceBluetoothFailedStartView(int16_t thisView) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::ChangeAiVoiceBluetoothFailedStartView"); @@ -747,12 +740,9 @@ namespace OHOS { SendMsgToUIService(UI_UPDATE_USER_QUESTION_STR, 0, nullptr, 0); } - if(AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_4G) + if (VolumeProcess) { - if (VolumeProcess) - { - VolumeProcess->SetVisible(true); - } + VolumeProcess->SetVisible(true); } return true; } @@ -1179,63 +1169,11 @@ namespace OHOS void AiVoiceView::ChangeAiModelAndUpdateComponentsStatus(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::ChangeAiModelAndUpdateComponentsStatus"); - int textId = AiVoiceModel::GetInstance().GetAiModelTextId(); - if (title) - { - if(textId == STR_JIUTIAN) - { - #if AI_VOICE_XINGCHEN - title->SetText("天翼AI"); - #else - title->SetText("中国移动智能助理灵犀"); - #endif - } - else - title->SetTextId(textId); + if (title != nullptr) { + title->SetText("AI对话"); title->ForceResetText(); } - if (aiModelImage) - { - auto it = TextIdToImagePath.find(textId); - if (it != TextIdToImagePath.end()) - { - if(it->first == STR_JIUTIAN) - { - #if (AI_VOICE_XINGCHEN) - aiModelImage->SetX(60); - #else - aiModelImage->SetX(173); - #endif - } - else - { - aiModelImage->SetX(173); - } - aiModelImage->SetSrc(it->second); - aiModelImage->Invalidate(); - scrollView->Invalidate(); - } - } - SetAiVoiceViewAllComponentsVisibilityStatus(); - - /*更新title的textid*/ - if (p_AiVoiceBluetoothFailedStartView) - { - p_AiVoiceBluetoothFailedStartView->UpdateTitleTextId(textId); - } - if (p_AivoiceReturnResultTextView) - { - p_AivoiceReturnResultTextView->UpdateTitleTextId(textId); - } - if (p_AivoiceMobileDataFailedStartView) - { - p_AivoiceMobileDataFailedStartView->UpdateTitleTextId(textId); - } - if (p_AivoiceConnectTimeoutView) - { - p_AivoiceConnectTimeoutView->UpdateTitleTextId(textId); - } } } \ No newline at end of file -- 2.17.1