From 0687a78ba6768ca959fad66134c9f34fd4bfeb3f Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Wed, 2 Jul 2025 10:53:37 +0800 Subject: [PATCH] =?utf8?q?1.=E8=A7=A3=E5=86=B3=E8=93=9D=E7=89=99=E5=92=8C4?= =?utf8?q?g=E5=90=8C=E6=97=B6=E8=BF=9E=E6=8E=A5=E7=9A=84=E6=97=B6=E5=80=99?= =?utf8?q?=EF=BC=8C=E9=80=89=E6=8B=A9=E8=93=9D=E7=89=99AI=E6=96=B9?= =?utf8?q?=E5=BC=8F=E6=AD=BB=E6=9C=BA=E9=97=AE=E9=A2=98=202.=E6=B7=BB?= =?utf8?q?=E5=8A=A0=E8=A1=A8=E5=86=A0=E8=B0=83=E8=8A=82AI=E9=9F=B3?= =?utf8?q?=E9=87=8F=E5=8A=9F=E8=83=BD=203.=E8=81=94=E8=B0=834GAi,?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../wearable/fd230app/CMakeLists.txt | 1 + .../nativeui/aivoice/include/AiVoiceModel.h | 9 + .../aivoice/include/AiVoicePresenter.h | 5 + .../nativeui/aivoice/include/AiVoiceView.h | 11 ++ .../aivoice/include/AiVoiceVolumeView.h | 23 +++ .../include/AivoiceReturnResultTextView.h | 1 + .../nativeui/aivoice/src/AiVoiceModel.cpp | 27 ++- .../nativeui/aivoice/src/AiVoicePresenter.cpp | 168 +++++++++++++----- .../aivoice/src/AiVoiceSelectView.cpp | 2 + .../nativeui/aivoice/src/AiVoiceView.cpp | 120 +++++++++++-- .../aivoice/src/AiVoiceVolumeView.cpp | 77 ++++++++ .../aivoice/src/Aivoice4gServiceConView.cpp | 12 +- .../src/AivoiceReturnResultTextView.cpp | 26 ++- ...oundAndVibrationVolumeSettingPresenter.cpp | 3 +- .../res/AIVoice/aimodels/aimodels_lingxi.bin | 3 + .../peripheral/slip/cat1Service/cat1_ws.cpp | 2 +- .../peripheral/slip/cat1Service/cat1_ws.h | 2 +- .../peripheral/utils/custom_cmd_service.c | 4 +- 18 files changed, 416 insertions(+), 80 deletions(-) create mode 100644 code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceVolumeView.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceVolumeView.cpp create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_lingxi.bin diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 1c6084ca6..7852f4cd9 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -534,6 +534,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/aivoice/src/apikeys/SetApiKeysView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/aivoice/src/Aivoice4gServiceConView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/aivoice/src/AiVoiceSelectView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/aivoice/src/AiVoiceVolumeView.cpp #Ai Models ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/aimodels/src/AiModelsModel.cpp diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h index 57bc8df67..f8b3915fe 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h @@ -21,6 +21,13 @@ // 设置当前使用的音频类型,0 表示 PCM,1 表示 SBC,2 表示 MSBC #define CURRENT_AIAUDIO_TYPE AIAUDIO_TYPE_SBC +#if defined(SUPPORT_CHINA_MOBILE_DMP) || defined(SUPPORT_CHINA_MOBILE_AI_REGULATION) + #define AI_VOICE_JIUTIAN 1 // 九天版本 +#else + #define AI_VOICE_JIUTIAN 1 // 九天版本 +#endif + + namespace OHOS { #define AI_SELECT_DEFAULT -1 @@ -136,6 +143,8 @@ namespace OHOS bool GetInit_4gai_task(void); void SetSelect4gorbt(int state); int GetSelect4gorbt(void); + + void cancel_tts_play(void); private: AiVoiceModel(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h index 805f00a30..257255bd2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoicePresenter.h @@ -12,6 +12,7 @@ #include "View.h" #include "ui_resource_string.h" #include "components/ui_time_picker.h" +#include "components/ui_slider.h" #include "ModelListenerSample.h" namespace OHOS { @@ -22,6 +23,7 @@ namespace OHOS public UIView::OnDragListener, public RootView::OnKeyActListener, public UIPicker::SelectedListener, + public UIView::OnRotateListener, public UIView::OnTouchListener // public ModelListenerSample { @@ -54,6 +56,7 @@ namespace OHOS void FunctionKeyOnClickToChangeAIModel(void); void DragLeftToRightChangeAIModel(void); void DragRightToLetfChangeAIModel(void); + void ChangeVolume(UIView &view, const RotateEvent &event); private: bool OnClick(UIView &view, const ClickEvent &event) override; @@ -63,6 +66,8 @@ namespace OHOS bool OnDragEnd(UIView &view, const DragEvent &event) override; bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 void OnPickerStoped(UIPicker &picker) override; + bool OnRotate(UIView& view, const RotateEvent& event); + bool OnRotateEnd(UIView& view, const RotateEvent& event); AiVoiceModel *model; bool X_DRAG_FLAG{false}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceView.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceView.h index c8029bef7..2d743b946 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceView.h @@ -15,6 +15,7 @@ #include "components/ui_scroll_view.h" #include "components/ui_image_view.h" #include "components/ui_picker.h" +#include "components/ui_slider.h" #include "aivoice/include/AiVoiceBluetoothFailedStartView.h" #include "aivoice/include/AivoiceMobileDataFailedStartView.h" #include "aivoice/include/AivoiceConnectTimeoutView.h" @@ -27,6 +28,7 @@ #include "aivoice/include/AiVoiceConnectingView.h" #include "aivoice/include/AiVoiceSelectView.h" #include "aivoice/include/Aivoice4gServiceConView.h" +#include "aivoice/include/AiVoiceVolumeView.h" #include "ui_resource_string.h" #include "iostream" #include "string" @@ -41,6 +43,7 @@ namespace OHOS static constexpr const char *AIMODEL_TONGYI_QIANWEN_PATH = "/user/res/AIVoice/aimodels/aimodes_tongyi_qianwen.bin"; /*通义千问*/ static constexpr const char *AIMODEL_IFLYTEK_SPARK_PATH = "/user/res/AIVoice/aimodels/aimodes_iflytek_spark.bin"; /*讯飞星火*/ static constexpr const char *AIMODEL_DEEPSEEK_PATH = "/user/res/AIVoice/aimodels/aimodes_deepseek.bin"; /*deepseek*/ + static constexpr const char *AIMODEL_LINGXI_PATH = "/user/res/AIVoice/aimodels/aimodels_lingxi.bin"; /*jiutian*/ /*组件ID*/ static constexpr const char *AIVOICE_START_CHAT_BUTTON_VIEW_ID = "aivoice_start_chat_button_view_id"; // 开始对话 @@ -64,6 +67,7 @@ namespace OHOS AIVOICE_AIMODE_CONNECTING, // AI Mode正在连接视图 AIVOICE_SELECT_VIEW, // AI选择界面 AIVOICE_4GSERVICECON_VIEW, // AI4G连接中界面 + AIVOICE_VOLUME_VIEW, // AI音量界面 MAX_AIVOICE_VIEWID, } AIVOICEVIEWID; @@ -75,6 +79,7 @@ namespace OHOS {STR_DEEPSEEK, AIMODEL_DEEPSEEK_PATH}, {STR_IFLYTEK_SPARK, AIMODEL_IFLYTEK_SPARK_PATH}, {STR_AIMODES_CHATGPT, AIMODEL_CHATGPT_ON_PATH}, + {STR_JIUTIAN, AIMODEL_LINGXI_PATH}, }; class AiVoicePresenter; @@ -133,6 +138,7 @@ namespace OHOS bool ChangeAiVoicConnectingView(int16_t thisView); bool ChangeAiVoicSelectView(int16_t thisView); bool ChangeAiVoic4gServiceConView(int16_t thisView); + bool ChangeAiVoicVolumeView(int16_t thisView); void SetAiVoiceViewAllComponentsVisibilityStatus(); void ChangeAiModelAndUpdateComponentsStatus(void); @@ -155,6 +161,7 @@ namespace OHOS AiVoiceConnectingView *p_AiVoiceConnectingView{nullptr}; AiVoiceSelectView *p_AiVoiceSelectView{nullptr}; AiVoice4gServiceConView *p_Aivoice4gServiceConView{nullptr}; + AiVoiceVolumeView *p_AiVoiceVolumeView{nullptr}; private: UILabelExt *AiVoiceViewLabelInit(LabelConfig &labelconfig); @@ -165,6 +172,7 @@ namespace OHOS bool CreateAiVoiceViewButton(void); bool CreateAiVoiceViewPicker(void); bool CreateAiVoiceScrollView(void); + bool CreateAiVoiceVoiceView(void); UIScrollView *CreateAiVoiceView(void); void ClearAllAiVoiceScrollView(void); void ClearAll(void); @@ -182,6 +190,9 @@ namespace OHOS UIButton *apiKeysButton{nullptr}; /*API Keys按钮,,暂时不用*/ UIPicker *aiModelPicker{nullptr}; /*ai模型选择器*/ UIScrollView *AiVoiceScrollView[MAX_AIVOICE_VIEWID]{nullptr}; + /* ----------------------------------- 九天 ----------------------------------- */ + UISlider *VolumeProcess{nullptr}; + /* -------------------------------------------------------------------------- */ }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceVolumeView.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceVolumeView.h new file mode 100644 index 000000000..b52aa2ab7 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceVolumeView.h @@ -0,0 +1,23 @@ +#ifndef AIVOICEVOLUMEVIEW_H +#define AIVOICEVOLUMEVIEW_H + +#include "components/ui_scroll_view.h" +#include "soundandvibration/include/SoundAndVibrationVolumeSettingView.h" +namespace OHOS +{ + class AiVoiceVolumeView + { + public: + AiVoiceVolumeView(); + ~AiVoiceVolumeView(); + static AiVoiceVolumeView *GetInstance(void); + UIScrollView *CreateAiVoiceVolumeView(void); + void SetRequestFocus(); + + private: + void ClearAll(); + UIScrollView *SystemVolumeScrollView{nullptr}; + SoundAndVibrationVolumeSettingView *p_SoundAndVibrationVolumeSettingView{nullptr}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceReturnResultTextView.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceReturnResultTextView.h index 27d9e34aa..f3d8408f6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceReturnResultTextView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AivoiceReturnResultTextView.h @@ -60,6 +60,7 @@ namespace OHOS UIList *GetChatContentList(void); void UpdateTitleTextId(int textId); void IsScrollChatContentList(bool isScroll); + void SetRequestFocus(); private: void ClearAll(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp index c3ac0345f..ad97b1cb7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp @@ -768,6 +768,7 @@ namespace OHOS isLimitDisplayed = false; AI_4G_state = false; AI_BT_state = false; + select4gorbt = -1; // init_4gai_task = false;//TOOD:之后需要销毁 ClearQuestionAndAiAnswerStr(); StopListenAndRecordingUserQuestion(); @@ -784,6 +785,7 @@ namespace OHOS AiVoiceModel::GetInstance().AIVoice_StopTimer(); AiVoiceModel::GetInstance().SetErrnote("连接超时,请重新开始对话"); std::string str = AiVoiceModel::GetInstance().GetErrnote(); + dinit_ai_task(); // 所有服务都删除重新连一下服务器 SendMsgToUIService(UI_AI_JUMP_TO_RESPONDERR_VIEW, 0, (void *)str.c_str(), str.length()); } else @@ -983,7 +985,6 @@ namespace OHOS if (AiVoiceView::GetInstance() && AivoiceListeningView::GetInstance()) { AiVoiceView::GetInstance()->ChangeView(AIVOICE_LISTENING_VIEWID, AIVOICE_THINKING_VIEWID); // 切换到思考中界面 - AiVoiceModel::GetInstance().AIVoice_StartTimer(); } } else @@ -1068,6 +1069,7 @@ namespace OHOS if ((view_->GetAiVoiceScrollView(AIVOICE_AIMODE_CONNECTING) != nullptr) && (view_->GetAiVoiceScrollView(AIVOICE_AIMODE_CONNECTING)->IsVisible())) { + dinit_ai_task(); // 所有服务都删除重新连一下服务器 p_AiVoicePresenter->ChangeViewAndLogicOperator(AIVOICE_AIMODE_CONNECTING, AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID); } } @@ -1151,6 +1153,7 @@ namespace OHOS if ((view_->GetAiVoiceScrollView(AIVOICE_4GSERVICECON_VIEW) != nullptr) && (view_->GetAiVoiceScrollView(AIVOICE_4GSERVICECON_VIEW)->IsVisible())) { + dinit_ai_task(); // 所有服务都删除重新连一下服务器 p_AiVoicePresenter->ChangeViewAndLogicOperator(AIVOICE_4GSERVICECON_VIEW, AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID); } } @@ -1218,7 +1221,7 @@ namespace OHOS // 检查定时器是否存在 if (g_ai4g_is_suc_connected_Handle != nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::stop_ai_isready_timer"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::stop_ai4g_connect_timer"); osTimerStop(g_ai4g_is_suc_connected_Handle); // 删除定时器并置为 nullptr osStatus_t ret = osTimerDelete(g_ai4g_is_suc_connected_Handle); @@ -1316,7 +1319,11 @@ namespace OHOS // 设置选择的ai模型 void AiVoiceModel::SetSelectAiModel(int index) { +#if AI_VOICE_JIUTIAN + ConfigModel::GetInstance()->SetSelectAiModel(0); +#else ConfigModel::GetInstance()->SetSelectAiModel(index); +#endif } int AiVoiceModel::GetSelectAiModel(void) @@ -1346,13 +1353,13 @@ namespace OHOS } bool AiVoiceModel::GetInit_4gai_task(void) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::GetInit_4gai_task %d", init_4gai_task); uint8_t asr_state = 0; uint8_t chat_state = 0; uint8_t tts_state = 0; asr_state = get_ai_asr_service_init_flag(); chat_state = get_ai_chat_service_init_flag(); tts_state = get_ai_tts_server_init_flag(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "asr_state:%d,chat_state:%d,tts_state:%d", asr_state, chat_state, tts_state); if ((asr_state == 1) && (chat_state == 1) && (tts_state == 1)) { init_4gai_task = true; @@ -1372,6 +1379,11 @@ namespace OHOS { return select4gorbt; } + // 打断tts播放 + void AiVoiceModel::cancel_tts_play(void) + { + tts_server_deinit(); + } /*获取已选择的ai模型的textid*/ int AiVoiceModel::GetAiModelTextId() @@ -1407,6 +1419,13 @@ namespace OHOS textId = STR_AIMODES_CHATGPT; } #endif +#if AI_VOICE_JIUTIAN + int textId = 0; + selectAiModelToTextId = { + {0, {STR_JIUTIAN, 5}}, + }; + textId = STR_JIUTIAN; +#else // 客户新需求需要改模型顺序: int textId = 0; selectAiModelToTextId = { @@ -1425,7 +1444,7 @@ namespace OHOS { return it->second.first; } - +#endif return textId; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp index 75e92dea1..01ffa305e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -168,8 +168,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::ChangeToAIVoiceListeningView"); if (model->GetSelect4gorbt() == AI_SELECT_4G) { - model->stop_ai_isready_timer(); // 停止定时器 - if (val) /*如果查询的AI模型可用跳转到聆听中界面*/ + if (val) /*如果查询的AI模型可用跳转到聆听中界面*/ { ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_LISTENING_VIEWID); } @@ -189,20 +188,19 @@ namespace OHOS { if (view_->GetAiVoiceScrollView(AIVOICE_AIMODE_CONNECTING) != nullptr && view_->GetAiVoiceScrollView(AIVOICE_AIMODE_CONNECTING)->IsVisible()) { - model->stop_ai_isready_timer(); // 停止定时器 - if (val) /*如果查询的AI模型可用跳转到聆听中界面*/ + if (val) /*如果查询的AI模型可用跳转到聆听中界面*/ { - ChangeViewAndLogicOperator(AIVOICE_AIMODE_CONNECTING, AIVOICE_LISTENING_VIEWID); + ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_LISTENING_VIEWID); } else { if (model->GetAiModelTextId() == STR_AIMODES_CHATGPT) // 如果当前是在chatgpt模型*/ { - ChangeViewAndLogicOperator(AIVOICE_AIMODE_CONNECTING, AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ + ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ } else { - ChangeViewAndLogicOperator(AIVOICE_AIMODE_CONNECTING, AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID); + ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_AIMODEL_CONNECT_FAILED_VIEWID); } } } @@ -299,34 +297,15 @@ namespace OHOS switch (hideView) { case AIVOICE_STARTCHAT_VIEWID: - // if (model->GetAI_4G_state() == true || model->GetAI_BT_state() == true) - // { - // model->QuerySelectedAiModelIsConnect(); /*查询用户选择的AI模型是否已经连接*/ - // } - if (showView == AIVOICE_LISTENING_VIEWID) - { - model->StartListenAndRecordingUserQuestion(); - } - else if (showView == AIVOICE_AIMODE_CONNECTING) - { - model->start_ai_isready_timer(); /*开启一个查询AI模型是否连接成功定时器*/ - } break; case AIVOICE_AIMODE_CONNECTING: - if (showView == AIVOICE_LISTENING_VIEWID) - { - model->StartListenAndRecordingUserQuestion(); - } + model->stop_ai_isready_timer(); // 停止定时器 break; case AIVOICE_LISTENING_VIEWID: model->StopListenAndRecordingUserQuestion(); model->stop_listening_timer(); - if (showView == AIVOICE_THINKING_VIEWID) // 聆听中->思考中界面 - { - model->AIVoice_StartTimer(); - } break; case AIVOICE_THINKING_VIEWID: @@ -337,21 +316,32 @@ namespace OHOS AiVoiceModel::GetInstance().ClearQuestionAndAiAnswerStr(); // 清空上次用户问题和Ai回答字符串 AiVoiceModel::GetInstance().SetIsClickable(false); AiVoiceModel::GetInstance().SetIsLimitDisplayed(false); - if (showView == AIVOICE_LISTENING_VIEWID) - { - model->StartListenAndRecordingUserQuestion(); - } - else if (showView == AIVOICE_AIMODE_CONNECTING) - { - model->start_ai_isready_timer(); /*开启一个查询AI模型是否连接成功定时器*/ - } break; - default: // Handle other cases if needed break; } + switch (showView) + { + case AIVOICE_AIMODE_CONNECTING: + model->QuerySelectedAiModelIsConnect(); + AiVoiceModel::GetInstance().start_ai_isready_timer(); + break; + + case AIVOICE_LISTENING_VIEWID: + AiVoiceModel::GetInstance().StartListenAndRecordingUserQuestion(); + AiVoiceModel::GetInstance().start_listening_timer(); + break; + + case AIVOICE_THINKING_VIEWID: + AiVoiceModel::GetInstance().AIVoice_StartTimer(); + break; + + default: + break; + } + return true; } @@ -418,6 +408,14 @@ namespace OHOS // AiVoiceModel::GetInstance().sendAIIsReady(); } } + else if (it->first == AIVOICERETURNRESULTTEXT_RETURN_BUTTON_VIEW_ID) + { + if (model->GetSelect4gorbt() == AI_SELECT_4G) + { + model->cancel_tts_play(); + usleep(50000); + } + } ChangeViewAndLogicOperator(it->second.first, it->second.second); return true; } @@ -461,10 +459,37 @@ namespace OHOS model->SetAI_4G_state(netWork4GState); model->SetAI_BT_state(appBluetoothConnectState); - if (netWork4GState && appBluetoothConnectState) + if ((netWork4GState && appBluetoothConnectState)) { - // 用户自行进行选择哪种方式 - ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_SELECT_VIEW); // LOADING + // 获取用户上次的选择 + int lastSelectedType = model->GetSelect4gorbt(); + // 两者都可用,检查是否有上次的选择 + if (lastSelectedType == AI_SELECT_4G) + { + // 使用4G + model->SetSelect4gorbt(AI_SELECT_4G); + if (!model->GetInit_4gai_task()) + { + init_ai_task(); + 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网络正常 { @@ -478,7 +503,6 @@ namespace OHOS } else { - model->QuerySelectedAiModelIsConnect(); ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_AIMODE_CONNECTING); // LOADING } } @@ -486,7 +510,6 @@ namespace OHOS { // 通过蓝牙连接APP调用大模型 model->SetSelect4gorbt(AI_SELECT_BT); - model->QuerySelectedAiModelIsConnect(); ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_AIMODE_CONNECTING); // LOADING } else // 4.两者连接都异常 @@ -510,12 +533,11 @@ namespace OHOS { init_ai_task(); model->start_ai4g_connect_timer(); - ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_4GSERVICECON_VIEW); // LOADING + ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_4GSERVICECON_VIEW); // LOADING } else { - model->QuerySelectedAiModelIsConnect(); /*查询用户选择的AI模型是否已经连接*/ - ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_AIMODE_CONNECTING); // LOADING + ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_AIMODE_CONNECTING); // LOADING } return true; } @@ -523,8 +545,8 @@ namespace OHOS { model->SetSelect4gorbt(AI_SELECT_BT); dinit_ai_task(); - model->QuerySelectedAiModelIsConnect(); /*查询用户选择的AI模型是否已经连接*/ ChangeViewAndLogicOperator(model->GetCurView(), AIVOICE_AIMODE_CONNECTING); + return true; } std::unordered_map> viewIdMap = { @@ -613,6 +635,11 @@ namespace OHOS /*连接超时界面右滑退到AI对话界面*/ ChangeViewAndLogicOperator(AIVOICE_SELECT_VIEW, AIVOICE_STARTCHAT_VIEWID); } + else if (scrollView == view_->GetAiVoiceScrollView(AIVOICE_VOLUME_VIEW)) + { + /*连接超时界面右滑退到AI对话界面*/ + ChangeViewAndLogicOperator(AIVOICE_VOLUME_VIEW, AIVOICE_STARTCHAT_VIEWID); + } AiVoicePresenter::X_DRAG_FLAG = false; } else if (model->GetAiModelTextId() == STR_AIMODES_CHATGPT && event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP) /*上滑*/ @@ -706,4 +733,55 @@ namespace OHOS // } // return; // } + + void AiVoicePresenter::ChangeVolume(UIView &view, const RotateEvent &event) + { + if ((view_->GetAiVoiceScrollView(AIVOICE_RETURN_RESULT_TEXT_VIEWID) != nullptr) && + (view_->GetAiVoiceScrollView(AIVOICE_RETURN_RESULT_TEXT_VIEWID)->IsVisible())) + { + UISlider *slider = dynamic_cast(&view); + if (slider) + { + int value = slider->GetValue(); + if (value >= 100 || value <= 0) + { + return; + } + if (event.GetRotate() > 0) + { + value += 20; + if (value > 100) + { + value = 100; + } + } + else + { + value -= 10; + if (value < 0) + { + value = 0; + } + } + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_CHANGE_SYSTEM_VOLUME, (void *)(&value), sizeof(value)); + } + } + } + + bool AiVoicePresenter::OnRotate(UIView &view, const RotateEvent &event) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnRotateEnd"); + ChangeVolume(view,event); + return true; + } + + bool AiVoicePresenter::OnRotateEnd(UIView &view, const RotateEvent &event) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnRotateEnd"); + // if (view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID) && view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)->IsVisible() == true) + // { + // ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_VOLUME_VIEW); + // } + return true; + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceSelectView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceSelectView.cpp index 87c2aa43d..934c24202 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceSelectView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceSelectView.cpp @@ -7,10 +7,12 @@ namespace OHOS static AiVoiceSelectView *g_pAivoiceSelectView{nullptr}; AiVoiceSelectView::AiVoiceSelectView() { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceSelectView::AiVoiceSelectView"); g_pAivoiceSelectView = this; } AiVoiceSelectView::~AiVoiceSelectView() { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceSelectView::~AiVoiceSelectView"); ClearAll(); g_pAivoiceSelectView = nullptr; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp index 7f567a23b..d26ea4e0f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp @@ -41,6 +41,9 @@ namespace OHOS delete scrollView; scrollView = nullptr; + delete VolumeProcess; + VolumeProcess = nullptr; + delete title; title = nullptr; @@ -157,6 +160,11 @@ namespace OHOS delete p_Aivoice4gServiceConView; p_Aivoice4gServiceConView = nullptr; } + if (p_AiVoiceVolumeView) + { + delete p_AiVoiceVolumeView; + p_AiVoiceVolumeView = nullptr; + } for (int i = 0; i < MAX_AIVOICE_VIEWID; i++) { if (AiVoiceScrollView[i] != nullptr) @@ -423,20 +431,24 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "aiModelPicker new fail!"); return false; } + aiModelPicker->SetPosition(203, 203, 60, 60); + aiModelPicker->SetViewId(AIVOICE_PICKER_VIEW_ID); + aiModelPicker->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + aiModelPicker->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + aiModelPicker->SetStyle(STYLE_BORDER_RADIUS, 150); + aiModelPicker->SetItemHeight(40); + aiModelPicker->SetLoopState(true); +#ifndef AI_VOICE_JIUTIAN + aiModelPicker->SetRotateFactor(1.0); + aiModelPicker->RequestFocus(); +#endif + aiModelPicker->RegisterSelectedListener(presenter_); + // 设置文本颜色为透明 + 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->SetPosition(203, 203, 60, 60); - aiModelPicker->SetViewId(AIVOICE_PICKER_VIEW_ID); - aiModelPicker->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); - aiModelPicker->SetStyle(STYLE_BACKGROUND_OPA, 0x00); - aiModelPicker->SetStyle(STYLE_BORDER_RADIUS, 150); - aiModelPicker->SetItemHeight(40); - aiModelPicker->SetLoopState(true); - aiModelPicker->SetRotateFactor(1.0); - aiModelPicker->RequestFocus(); - aiModelPicker->RegisterSelectedListener(presenter_); - aiModelPicker->SetTextColor(Color::GetColorFromRGBA(0x00, 0x00, 0x00, 0xff), Color::GetColorFromRGBA(0xff, 0x00, 0x00, 0xff)); - const char *uiPicker1Data[] = {"0", "1", "2", "3", "4", "5"}; - aiModelPicker->SetValues(uiPicker1Data, sizeof(uiPicker1Data) / sizeof(uiPicker1Data[0])); return true; } @@ -454,21 +466,54 @@ namespace OHOS } } scrollView->SetPosition(0, 0, 466, 466); + scrollView->SetHorizontalScrollState(false); + scrollView->SetVerticalScrollState(false); scrollView->SetTouchable(true); scrollView->SetDraggable(true); scrollView->SetOnDragListener(presenter_); return true; } + bool AiVoiceView::CreateAiVoiceVoiceView(void) + { + /* ------------------------------ VolumeProcess ----------------------------- */ + if (VolumeProcess == nullptr) + { + VolumeProcess = new UISlider(); + if (VolumeProcess == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VolumeProcess new fail"); + return false; + } + } + VolumeProcess->SetSliderColor(Color::Gray(), Color::Silver()); + VolumeProcess->SetPosition(-200, 77, 130, 310); + VolumeProcess->SetDirection(UISlider::Direction::DIR_BOTTOM_TO_TOP); + VolumeProcess->SetRange(100, 0); + VolumeProcess->SetStyle(STYLE_BORDER_RADIUS, 100); + VolumeProcess->SetBackgroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + VolumeProcess->SetForegroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + VolumeProcess->SetSliderColor(Color::GetColorFromRGBA(0x19, 0x19, 0x19, 0xff), Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff)); + VolumeProcess->SetForegroundStyle(STYLE_BACKGROUND_OPA, 0xff); + VolumeProcess->SetKnobStyle(StyleDefault::GetSliderKnobStyle()); + VolumeProcess->RequestFocus(); + VolumeProcess->SetRotateFactor(1.0); + // VolumeProcess->SetVisible(false); + VolumeProcess->SetOnRotateListener(presenter_); + container_->Add(VolumeProcess); + return true; + } + UIScrollView *AiVoiceView::CreateAiVoiceView(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceView"); if (!CreateAiVoiceScrollView() || !CreateAiVoiceViewImageView() || !CreateAiVoiceViewPicker() || - !CreateAiVoiceViewLabel() || !CreateAiVoiceViewButton()) + !CreateAiVoiceViewLabel() || !CreateAiVoiceViewButton() || !CreateAiVoiceVoiceView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceView fail!"); return nullptr; } + // scrollView->Add(VolumeProcess); scrollView->Add(title); scrollView->Add(aiModelPicker); scrollView->Add(aiModelImage); @@ -500,6 +545,9 @@ namespace OHOS container_->SetOnClickListener(presenter_); ChangeView(MAX_AIVOICE_VIEWID, AIVOICE_STARTCHAT_VIEWID); +#if AI_VOICE_JIUTIAN + CreateAiVoiceVoiceView(); +#endif SetAiVoiceViewAllComponentsVisibilityStatus(); @@ -546,6 +594,13 @@ namespace OHOS AiVoiceScrollView[thisView] = scrollview; container_->Add(AiVoiceScrollView[thisView]); } + else + { + if (VolumeProcess) + { + VolumeProcess->RequestFocus(); + } + } if (AiVoiceModel::GetInstance().GetSelect4gorbt() == AI_SELECT_BT) { AiVoiceModel::GetInstance().CancelCurAIChat(); @@ -657,7 +712,6 @@ namespace OHOS p_AivoiceListeningView->GetShowtimeoutLabel()->SetText("10"); p_AivoiceListeningView->GetShowtimeoutLabel()->Invalidate(); } - AiVoiceModel::GetInstance().start_listening_timer(); return true; } @@ -713,6 +767,10 @@ namespace OHOS AiVoiceScrollView[thisView] = scrollview; container_->Add(AiVoiceScrollView[thisView]); } + // if(p_AivoiceReturnResultTextView) + // { + // p_AivoiceReturnResultTextView->SetRequestFocus(); + // } return true; } @@ -862,6 +920,29 @@ namespace OHOS return true; } + bool AiVoiceView::ChangeAiVoicVolumeView(int16_t thisView) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::ChangeAiVoic4gServiceConView"); + if (AiVoiceScrollView[thisView] == nullptr) + { + p_AiVoiceVolumeView = new AiVoiceVolumeView(); + if (p_AiVoiceVolumeView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView); + return false; + } + UIScrollView *scrollview = p_AiVoiceVolumeView->CreateAiVoiceVolumeView(); + if (scrollview == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new AiVoiceScrollView[%d] fail", thisView); + return false; + } + AiVoiceScrollView[thisView] = scrollview; + container_->Add(AiVoiceScrollView[thisView]); + } + return true; + } + struct AiVoiceViewMapper { const int16_t viewId; @@ -882,6 +963,7 @@ namespace OHOS {AIVOICE_AIMODE_CONNECTING, &AiVoiceView::ChangeAiVoicConnectingView}, {AIVOICE_SELECT_VIEW, &AiVoiceView::ChangeAiVoicSelectView}, {AIVOICE_4GSERVICECON_VIEW, &AiVoiceView::ChangeAiVoic4gServiceConView}, + {AIVOICE_VOLUME_VIEW, &AiVoiceView::ChangeAiVoicVolumeView}, }; bool AiVoiceView::ClickFunc(int16_t interface) @@ -932,6 +1014,7 @@ namespace OHOS AIVOICE_ALERT_APPBLUETOOTH_AND_4GNETWORK_VIEWID, // AIVOICE_STARTCHAT_VIEWID, AIVOICE_RETURN_RESULT_TEXT_VIEWID, + AIVOICE_VOLUME_VIEW, }; void AiVoiceView::DestroyTempView(int16_t hideView) @@ -1023,6 +1106,13 @@ namespace OHOS p_AivoiceReturnResultTextView = nullptr; } break; + case AIVOICE_VOLUME_VIEW: + if (p_AiVoiceVolumeView) + { + delete p_AiVoiceVolumeView; + p_AiVoiceVolumeView = nullptr; + } + break; default: break; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceVolumeView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceVolumeView.cpp new file mode 100644 index 000000000..81317191b --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceVolumeView.cpp @@ -0,0 +1,77 @@ +#include "aivoice/include/AiVoiceVolumeView.h" +#include "aivoice/include/AiVoicePresenter.h" +#include "wearable_log.h" +#include +namespace OHOS +{ + static AiVoiceVolumeView *g_pAiVoiceVolumeView{nullptr}; + AiVoiceVolumeView::AiVoiceVolumeView() + { + g_pAiVoiceVolumeView = this; + } + + AiVoiceVolumeView::~AiVoiceVolumeView() + { + ClearAll(); + g_pAiVoiceVolumeView = nullptr; + } + + AiVoiceVolumeView *AiVoiceVolumeView::GetInstance(void) + { + return g_pAiVoiceVolumeView; + } + + void AiVoiceVolumeView::ClearAll() + { + delete p_SoundAndVibrationVolumeSettingView; + p_SoundAndVibrationVolumeSettingView = nullptr; + SystemVolumeScrollView = nullptr; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemVolumeView::ClearAll end!!"); + } + void AiVoiceVolumeView::SetRequestFocus() + { + if (p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()) + { + p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->RequestFocus(); + } + } + + UIScrollView *AiVoiceVolumeView::CreateAiVoiceVolumeView(void) + { + if (p_SoundAndVibrationVolumeSettingView == nullptr) + { + p_SoundAndVibrationVolumeSettingView = new SoundAndVibrationVolumeSettingView(SYSTEM_VOLUME); + if (p_SoundAndVibrationVolumeSettingView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "p_SoundAndVibrationVolumeSettingView is nullptr!"); + return nullptr; + } + } + if (SystemVolumeScrollView == nullptr) + { + SystemVolumeScrollView = p_SoundAndVibrationVolumeSettingView->SetUpVolumeProcess(); + if (SystemVolumeScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolumeScrollView is nullptr!"); + return nullptr; + } + } + + SetRequestFocus(); + + int SystemVolume = uapi_systemVolumeGet(); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemVolume = %d", SystemVolume); + p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(SystemVolume); + + UIView::OnDragListener *dragListener = static_cast(AiVoicePresenter::GetInstance()); + if (dragListener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AivoiceThinkingView::dragListener new fail!"); + return nullptr; + } + SystemVolumeScrollView->SetOnDragListener(dragListener); + + return SystemVolumeScrollView; + } + +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/Aivoice4gServiceConView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/Aivoice4gServiceConView.cpp index 55eba426f..f51a41253 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/Aivoice4gServiceConView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/Aivoice4gServiceConView.cpp @@ -55,8 +55,16 @@ namespace OHOS scrollView->RemoveAll(); delete label; label = nullptr; - delete AI4GImageAni; - AI4GImageAni = nullptr; + if (AI4GImageAni) + { + AI4GImageAni->Stop(); + delete AI4GImageAni; + AI4GImageAni = nullptr; + for (int i = 0; i < 8; i++) + { + ImageCacheManager::GetInstance().UnloadSingleRes(AI4GsearchImagePath[i]); + } + } delete scrollView; scrollView = nullptr; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceReturnResultTextView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceReturnResultTextView.cpp index 6f0141073..62b50aed1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceReturnResultTextView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AivoiceReturnResultTextView.cpp @@ -115,6 +115,13 @@ namespace OHOS scrollView = nullptr; } } + void AivoiceReturnResultTextView::SetRequestFocus() + { + if (chatContentList) + { + chatContentList->RequestFocus(); + } + } UILabelExt *AivoiceReturnResultTextView::AivoiceReturnResultTextLabelInit(LabelConfig &labelconfig) { @@ -126,11 +133,11 @@ namespace OHOS label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height); label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize); label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeight); - //TOOD: 待优化 - // if(labelconfig.textId == STR_DEEPSEEK) { - // label->SetText("DeepSeek"); - // } else - label->SetTextId(labelconfig.textId); + // TOOD: 待优化 + // if(labelconfig.textId == STR_DEEPSEEK) { + // label->SetText("DeepSeek"); + // } else + label->SetTextId(labelconfig.textId); label->SetLineBreakMode(labelconfig.lineBreakMode); label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize); @@ -179,6 +186,7 @@ namespace OHOS scrollView->SetTouchable(true); scrollView->SetDraggable(true); scrollView->SetDirection(UIScrollView::VERTICAL); + scrollView->IsIntercept(); return true; } @@ -256,8 +264,8 @@ namespace OHOS chatContentList->SetMaxScrollDistance(MAX_SCR_DIS); chatContentList->SetSwipeACCLevel(200); // 800: compensation distance chatContentList->SetDragACCLevel(5); // 5: drag acceleration - chatContentList->SetRotateFactor(2); - chatContentList->RequestFocus(); + // chatContentList->SetRotateFactor(2); + // chatContentList->RequestFocus(); // chatContentList->SetIntercept(true); chatContentList->SetAdapter(chatContentListAdapter); chatContentList->RefreshList(); @@ -356,8 +364,8 @@ namespace OHOS // if(textId == STR_DEEPSEEK) // { // title->SetText("DeepSeek"); - // } - // else + // } + // else // { title->SetTextId(textId); title->ForceResetText(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp index 4923e93f2..5a9db28a4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingPresenter.cpp @@ -221,10 +221,11 @@ extern "C" */ void SystemVolumeSet(int32_t sounding) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolumeSet %d", sounding); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemVolumeSet %d", sounding); Audio::AudioManager::GetInstance().SetVolume(AUDIO_STREAM_MUSIC, sounding); // 系统音量设置 Audio::AudioManager::GetInstance().SetVolume(AUDIO_STREAM_NOTIFICATION_SYSTEM, sounding); // 查找手表,闹钟,倒计时铃声也受系统音量控制 Audio::AudioManager::GetInstance().SetVolume(AUDIO_STREAM_RING, sounding); //来电铃声 + Audio::AudioManager::GetInstance().SetVolume(AUDIO_STREAM_VOICE_ASSISTANT, sounding); //AI语言 } int SystemVolumeGet(void) diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_lingxi.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_lingxi.bin new file mode 100644 index 000000000..0c4bb19ff --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_lingxi.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33763925d0358af3d2f1e4c6cb8fbf5c5c8190a918a5a86636a4dafbfaf86d80 +size 9624 diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp index 1b6c2b405..bce9422b5 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.cpp @@ -913,7 +913,7 @@ errcode_t chat_server_init(void); errcode_t tts_server_init(void); -void tts_server_deinit(void); +// void tts_server_deinit(void); void uapi_UI_start_asr(void) diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.h b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.h index 15e3ad771..a7a8a7cbc 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.h +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_ws.h @@ -22,7 +22,7 @@ void uapi_UI_stop_start_asr_timeout(void); //////////////////////////////////////////////////////////////////////// - +void tts_server_deinit(void); diff --git a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c index 1e2f9b59e..89dba3aea 100644 --- a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c +++ b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c @@ -163,7 +163,7 @@ static void custom_cmd_service_check_task(void const *arg) { value |= (mail.data[i] << (i * 8)); } - printf("uapi_systemVolumeSet: %d\n", value); + // printf("uapi_systemVolumeSet: %d\n", value); uapi_systemVolumeSet(value); } break; @@ -175,7 +175,7 @@ static void custom_cmd_service_check_task(void const *arg) { value |= (mail.data[i] << (i * 8)); } - printf("uapi_callVolumeSet: %d\n", value); + // printf("uapi_callVolumeSet: %d\n", value); uapi_callVolumeSet(value); } break; -- 2.17.1