From: Caisking Date: Thu, 28 Aug 2025 06:10:09 +0000 (+0800) Subject: 增加语音助手Slice的相关宏 X-Git-Tag: leiniao_debug_1.0.0_20250922_020716~147 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=5062c7ba95fbc5fa5840c783c5085fa83b8f7181;p=mirrors%2FFD230.git 增加语音助手Slice的相关宏 --- diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantModel.cpp index 4d0388c09..4f0deeedf 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantModel.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/assistant/src/AssistantModel.cpp @@ -7,11 +7,24 @@ #include "AppViewIDs.h" #include "NativeAbility.h" -// #include "bleEvent.h" -// #include "cat1_ctl.h" -// #include "cat1_server.h" -// #include "http_client.h" -// #include "vibrator_service.h" +#ifdef SUPPORT_BLE_SERVICE +#include +#include "bleService.h" +#endif + +#ifdef SUPPORT_CAT1_SERVICE +#include "cat1_ctl.h" +#include "cat1_server.h" +#include "http_client.h" +#include "lwip/err.h" +#endif + +#ifdef SUPPORT_PHONE_SERVICE +#include "PhoneService.h" +#include "phoneservice/include/PhoneServiceC.h" +#endif + +#include "vibrator_service.h" #include "broadcast_feature.h" #include "broadcast_service.h" @@ -36,8 +49,6 @@ #include #include -// #include "PhoneService.h" -// #include "phoneservice/include/PhoneServiceC.h" extern "C" { int uapi_open_voice_recognition(void); @@ -142,35 +153,41 @@ void AssistantModel::Init() { //获取状态[hfp] bool AssistantModel::GetHFPStatus(void) { - // if (uapi_hfp_connect_state()) { - // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "uapi_hfp_connect_state is ok"); - // return true; - // } +#ifdef SUPPORT_PHONE_SERVICE + if (uapi_hfp_connect_state()) { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "uapi_hfp_connect_state is ok"); + return true; + } +#endif WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "uapi_hfp_connect_state is failed"); return false; } //开启语音助手[soc] bool AssistantModel::StartAssistant(void) { - // if (uapi_open_voice_recognition() == 0) { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_open_voice_recognition is - // ok"); - // //成功开启语音助手 - // uapi_dev_runtime_set_voice_status(1); - // return true; - // } +#ifdef SUPPORT_PHONE_SERVICE + if (uapi_open_voice_recognition() == 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_open_voice_recognition is + ok"); + //成功开启语音助手 + uapi_dev_runtime_set_voice_status(1); + return true; + } +#endif WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_open_voice_recognition is failed"); return false; } //关闭语音助手 void AssistantModel::StopAssistant(void) { - // if (uapi_close_voice_recognition() == 0) { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, - // "uapi_close_voice_recognition is ok"); - // } else { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, - // "uapi_close_voice_recognition is failed"); - // } +#ifdef SUPPORT_PHONE_SERVICE + if (uapi_close_voice_recognition() == 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, + "uapi_close_voice_recognition is ok"); + } else { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, + "uapi_close_voice_recognition is failed"); + } +#endif } //语音回答界面->主界面 @@ -186,7 +203,7 @@ bool AssistantModel::ChangeToMainView(void) { p_AssistantView->GetAssistantScrollView(ASSISTANT_MAIN_VIEW) ->IsVisible() == false) { //设置退出状态 - // uapi_dev_runtime_set_voice_status(0); + uapi_dev_runtime_set_voice_status(0); p_AssistantView->ChangeView(ASSISTANT_ANSWER_VIEW, ASSISTANT_MAIN_VIEW); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "退出语音助手成功\r\n"); } diff --git a/code/sdk/zhihui/utils/custom_runtime.h b/code/sdk/zhihui/utils/custom_runtime.h index a834b4b63..a352589a4 100644 --- a/code/sdk/zhihui/utils/custom_runtime.h +++ b/code/sdk/zhihui/utils/custom_runtime.h @@ -279,6 +279,10 @@ void uapi_dev_runtime_set_safemode_flag(uint8_t status); // 安全模式 uint8_t uapi_dev_runtime_get_safemode_flag(void); +//是否使用语音助手状态 +void uapi_dev_runtime_set_voice_status(uint8_t status); +uint8_t uapi_dev_runtime_get_voice_status(void); + void uapi_dev_runtime_set_hrs_passivity(uint8_t status); // 获取被动心率检测状态