From c98f287c7e049919c19a5ecd72b90c9f6fe36533 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Tue, 11 Feb 2025 09:53:28 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9cat1=E6=8B=A8=E5=8F=B7?= =?utf8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=B6=85=E6=97=B6=E9=87=8D=E6=8B=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/BluetoothDeviceCaseListAdapter.cpp | 2 +- .../slip/cat1Service/cat1_server.cpp | 53 +++++++++++- .../peripheral/utils/custom_audio_gate.c | 83 +++++++++++++++++++ .../drivers/peripheral/utils/custom_runtime.h | 13 ++- 4 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 code/sdk/drivers/peripheral/utils/custom_audio_gate.c diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp index c59fc5b05..0185671ef 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp @@ -91,7 +91,7 @@ namespace OHOS } else { - uint8_t time=0; + uint8_t time=200; do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_CONNECT, &time, sizeof(uint8_t)); } } diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index de1b199c9..6901e18b4 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -267,6 +267,11 @@ static osTimerId_t g_timer_time_answer = NULL; static osTimerId_t g_timer_time_Dial = NULL; +#define DIAL_OVERTIME 3000 + +void cat1_rep_call_dial(void); + +static uint8_t dial_count=0; /**如果 * g_python_updated == 0 && * g_py_ver >= PY_SRV_VER_SUPORT_PY_OTA_MINI_VER && @@ -867,6 +872,28 @@ void cat1_ota_update(char *url) { udp_send_msg_toCat1(UDP_CMD_CAT1_OTA_UPDATE,url); } + +static char *dial_phonenum=NULL; + +void cat1_rep_call_dial(void) +{ + bool volte = OHOS::ConfigModel::GetInstance()->GetVoLTE_Call(); + if (volte == true){ + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"cat1_call_dial %s\n",dial_phonenum); + // #if PY_SRV_VER_CURRENT >=16 + if(g_py_ver>=16) + { + if(osTimerIsRunning(g_timer_time_Dial)==0 ) + { + osStatus_t ret = osTimerStart(g_timer_time_Dial,5000); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 g_timer_time_Dial timer ret %d\n",ret); + } + } + udp_send_msg_toCat1(UDP_CMD_DIAL_NUMB,dial_phonenum); + } + + +} void cat1_call_dial(char* phonenum) { @@ -878,12 +905,20 @@ void cat1_call_dial(char* phonenum) { if(osTimerIsRunning(g_timer_time_Dial)==0 ) { - osStatus_t ret = osTimerStart(g_timer_time_Dial,5000); + osStatus_t ret = osTimerStart(g_timer_time_Dial,DIAL_OVERTIME); WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 g_timer_time_Dial timer ret %d\n",ret); } } + // #endif + if(dial_phonenum) + free(dial_phonenum); + + dial_phonenum=(char *)malloc(strlen(phonenum)+1); + memset(dial_phonenum,0,strlen(phonenum)+1); + memcpy_s(dial_phonenum,30,phonenum,strlen(phonenum)); + dial_count=0; udp_send_msg_toCat1(UDP_CMD_DIAL_NUMB,phonenum); } @@ -1159,13 +1194,29 @@ static void time_answer_func(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"time_answer_func\n"); cat1_handle_call_disconnected("callfail"); } +#define CAT1_DAIL_REP +#define CAT1_DAIL_REP_COUNT 1 //电话接听超时 static void time_dial_func(void) { osTimerStop(g_timer_time_Dial); WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"time_dial_func\n"); + #ifdef CAT1_DAIL_REP + if(dial_count + +#include "audio_base_type.h" + +typedef enum +{ + TYPE_DEFAULT = -1, + /** Media */ + TYPE_PHONE = 0, +}Audio_runtime_status; + + +typedef enum +{ + TYPE_DEFAULT = 0, + /** Media */ + TYPE_WATCH , + TYPE_A2DP , + TYPE_HFP, +}Audio_Output_type; + +typedef enum +{ + TYPE_DEFAULT = -1, + /** Media */ + TYPE_A2DP = 0, + TYPE_HFP, + TYPE_HFP, +}Audio_Input_type; + +typedef struct +{ + AudioStreamType AudioStreamType; + Audio_runtime_status runtime_status; + char *source; + Audio_Input_type Input_type; + Audio_Output_type Output_type; + bool mixture; +}Audio_status_t; + + +static Audio_status_t g_audio_gate={0}; + + +void uapi_updata_audio_gate(uint32_t AudioStreamType,uint32_t runtime_status,bool mixture) +{ + g_audio_gate.AudioStreamType=AudioStreamType; + g_audio_gate.runtime_status=runtime_status; + g_audio_gate.mixture=mixture; +} + + +void uapi_updata_audio_gate_source(char *source) +{ + if( g_audio_gate.source) + { + free(g_audio_gate.source); + g_audio_gate.source=NULL; + } + g_audio_gate.source=(char *)malloc(strlen(source)+1); + memset(g_audio_gate.source,0,strlen(source)+1); + memcpy(g_audio_gate.source,source,strlen(source)+1);; + +} + +void uapi_updata_audio_gate_type(uint32_t Input_type,uint32_t Output_type) +{ + g_audio_gate.Input_type=Input_type; + g_audio_gate.Output_type=Output_type; +} + + +uint32_t uapi_get_gate_AudioStreamType_status(void) +{ + return g_audio_gate.AudioStreamType; +} + +bool uapi_get_gate_mixture_status(void) +{ + return g_audio_gate.mixture; +} \ No newline at end of file diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.h b/code/sdk/drivers/peripheral/utils/custom_runtime.h index 1f414c9be..0fb18c413 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.h +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.h @@ -13,7 +13,7 @@ #include #include "errcode.h" #include "soc_osal.h" - +#include "stdbool.h" #ifdef __cplusplus #if __cplusplus extern "C" { @@ -321,6 +321,17 @@ void uapi_dev_runtime_atuoota_status_status(uint8_t data); uint8_t uapi_dev_runtime_get_atuoota_status(void); + +void uapi_updata_audio_gate(uint32_t AudioStreamType,uint32_t runtime_status,bool mixture); + +void uapi_updata_audio_gate_source(char *source); + +void uapi_updata_audio_gate_type(uint32_t Input_type,uint32_t Output_type); + +uint32_t uapi_get_gate_AudioStreamType_status(void); + +bool uapi_get_gate_mixture_status(void); + #ifdef __cplusplus #if __cplusplus } -- 2.17.1