From 6d25875b3e29f33c6afc79b4e12e9ab797008187 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Fri, 27 Sep 2024 16:32:29 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E6=89=8B=E6=9C=BA=E8=AF=AD?= =?utf8?q?=E9=9F=B3=E5=8A=A9=E6=89=8B=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../phoneservice/include/PhoneServiceC.h | 5 +++++ .../nativeui/phoneservice/src/PhoneService.cpp | 17 ++++++++++++++++- .../peripheral/utils/custom_utils_at_cmd.c | 6 ++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneServiceC.h b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneServiceC.h index 5a5639b4e..be1825b31 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneServiceC.h +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/include/PhoneServiceC.h @@ -17,6 +17,11 @@ int uapi_hfp_disconnect_(void); int uapi_hfp_connect_(void); int uapi_hfp_fail_cbk(int32_t errcode); + +int uapi_open_voice_recognition(void ); + +int uapi_close_voice_recognition(void ); + #ifdef __cplusplus } #endif diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp index 197d537e1..3397d0f30 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -723,7 +723,7 @@ static void ScoStateChanged(const bd_addr_t *bdAddr, hfp_sco_connect_state_t sta case HFP_SCO_STATE_DISCONNECTED: WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoStateChanged] SCO disconnected!"); ScoDisconnectPro(); - //PhoneServiceScreenCtr(0); + PhoneServiceScreenCtr(0); break; default: @@ -2180,7 +2180,22 @@ int uapi_hfp_fail_cbk(int32_t errcode) } +int uapi_open_voice_recognition(void ) +{ + bd_addr_t bdaddr={0}; + OHOS:: uapi_get_br_address(&bdaddr); + errcode_t ret = (errcode_t)hfp_hf_open_voice_recognition(&bdaddr); + return ret; +} + +int uapi_close_voice_recognition(void ) +{ + bd_addr_t bdaddr={0}; + OHOS:: uapi_get_br_address(&bdaddr); + errcode_t ret = (errcode_t)hfp_hf_close_voice_recognition(&bdaddr); + return ret; +} #ifdef __cplusplus diff --git a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c index b4a9de5d5..d22244926 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c @@ -19,6 +19,7 @@ #define CUSTOM_UTILS_SUCCESS 0 #define CUSTOM_UTILS_FAILED (-1) +#include "PhoneServiceC.h" #include "common.h" @@ -1103,6 +1104,11 @@ static uint32_t BLE_TEST(uint8_t *para, uint32_t paraLen, char *strCommonCmd) break; case 13: CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,(uint8_t *)&type_2,1); + case 14: + if(type_2) + uapi_open_voice_recognition( ); + else + uapi_close_voice_recognition( ); default: break; } -- 2.17.1