From: luozheng <1732036298@qq.com> Date: Fri, 10 Oct 2025 08:50:23 +0000 (+0800) Subject: fd230:蓝牙ai添加 X-Git-Tag: V1.0.9_20251128_194606_LN~265^2~8 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=f6dbbcea34219204819ef84d2da68cacd2c9f3c4;p=mirrors%2FFD230.git fd230:蓝牙ai添加 --- diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoiceModelC.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoiceModelC.h index d90540f74..c5ea62451 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoiceModelC.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoiceModelC.h @@ -11,6 +11,7 @@ extern "C" uint8_t getselect4gorbtai(void); void ble_AI_init(void); + void net4g_AI_init(void); #ifdef __cplusplus #if __cplusplus 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 cfa8550e3..e80c80418 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 @@ -2186,10 +2186,16 @@ extern "C" void ble_set_ai_Answer_str_(char *buf, uint8_t type) { - chat_filter_result_chars(buf); + // chat_filter_result_chars(buf); OHOS::AiVoiceModel::GetInstance().SetAiAnswerStrStr(std::string(buf), type); } + void ble_app_reply_(bool data) + { + bool state = data; + SendMsgToUIService(UI_AI_JUMP_TO_LISTENING_VIEW, 0, &state, sizeof(bool)); + } + extern bleInstruct_t_ bleInstruct_t; void ble_AI_init(void) @@ -2197,6 +2203,21 @@ extern "C" bleInstruct_t.ble_set_ai_Question_str = ble_set_ai_Question_str_; bleInstruct_t.ble_set_ai_Answer_str = ble_set_ai_Answer_str_; + + bleInstruct_t.ble_app_reply = ble_app_reply_; + } + + static void ws_chat_filter_cb_wrapper(char *result) + { + /* 复用现有过滤实现,忽略返回长度 */ + chat_filter_result_chars(result); + } + + void net4g_AI_init(void) + { + ws_register_chat_filter_callback(ws_chat_filter_cb_wrapper); + ws_register_ai_question_callback(ble_set_ai_Question_str_); + ws_register_ai_answer_callback(ble_set_ai_Answer_str_); } #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 b236bb1fc..3bf384283 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 @@ -104,6 +104,7 @@ namespace OHOS model->ai_start_screen60s_timer(); 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); }