fd230:蓝牙ai添加
authorluozheng <1732036298@qq.com>
Fri, 10 Oct 2025 08:50:23 +0000 (16:50 +0800)
committerluozheng <1732036298@qq.com>
Fri, 10 Oct 2025 08:50:23 +0000 (16:50 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/include/AiVoiceModelC.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoiceModel.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/aivoice/src/AiVoicePresenter.cpp

index cfa8550..e80c804 100644 (file)
@@ -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
index b236bb1..3bf3842 100644 (file)
@@ -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);
     }