From a6742234cd94fe9c57f92308adeeb42d0f89cb85 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Fri, 5 Sep 2025 17:25:00 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0cat1=20HFPAG=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- cat1modem/src/cat1Service.py | 4 +- .../nativeui/assistant/src/AssistantModel.cpp | 5 +- .../src/BluetoothDeviceCaseListAdapter.cpp | 4 +- .../bluetooth/src/BluetoothItemView.cpp | 4 +- .../nativeui/bluetooth/src/BluetoothModel.cpp | 17 +++--- .../nativeui/callerlog/src/CallerLogModel.cpp | 13 +++-- .../nativeui/makephone/src/CallingView.cpp | 2 +- .../phone/src/DialingMethodPresenter.cpp | 4 +- .../nativeui/phone/src/MainPhoneView.cpp | 1 + .../phoneservice/src/PhoneAGService.cpp | 2 +- .../nativeui/phoneservice/src/PhoneAudio.cpp | 3 +- .../phoneservice/src/PhoneService.cpp | 8 ++- .../msg_center/src/msg_center_customer.cpp | 7 +++ .../src/BluetoothDeviceCaseListAdapter.cpp | 2 +- .../bluetooth/src/BluetoothItemView.cpp | 2 +- .../nativeui/bluetooth/src/BluetoothModel.cpp | 2 +- .../nativeui/callerlog/src/CallerLogModel.cpp | 2 +- .../nativeui/makephone/src/CallingView.cpp | 2 +- .../phoneservice/src/PhoneService.cpp | 4 ++ .../wrapper/audio_manager_c_wrapper.cpp | 37 +++++++----- .../voice_call_volte_bluetooth_wrapper.cpp | 39 ++++++++----- .../zhihui/4g/cat1Service/Service/cat1_ctl.c | 2 +- .../4g/cat1Service/Service/cat1_server.c | 16 +++-- .../4g/cat1Service/include/cat1_porting.h | 2 + code/sdk/zhihui/4gTest/cat1_porting.c | 58 +++++++++++++++++-- code/sdk/zhihui/utils/custom_utils.h | 2 + 26 files changed, 164 insertions(+), 80 deletions(-) diff --git a/cat1modem/src/cat1Service.py b/cat1modem/src/cat1Service.py index 9c4e630ba..7fc79b546 100644 --- a/cat1modem/src/cat1Service.py +++ b/cat1modem/src/cat1Service.py @@ -916,7 +916,7 @@ class Cat1Service: clog.info("Socket_SEND_Thread data:{} {}".format(data[0],data[1])) count=20 - while count & self.ack_sem : + while count and self.ack_sem : utime.sleep_ms(1) count=count-1 # if data[2]: @@ -927,7 +927,7 @@ class Cat1Service: clog.info("Socket_SEND_Thread while data:{} {}".format(data[0],data[1])) if data: - clog.info("data ok!!") + clog.info("data ok!! {} {}".format(self.ack_sem,count)) else: clog.error("data error!!") except Exception : 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 4f0deeedf..3b5135c97 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 @@ -20,7 +20,7 @@ #endif #ifdef SUPPORT_PHONE_SERVICE -#include "PhoneService.h" +#include "phoneservice/include/PhoneService.h" #include "phoneservice/include/PhoneServiceC.h" #endif @@ -166,8 +166,7 @@ bool AssistantModel::GetHFPStatus(void) { bool AssistantModel::StartAssistant(void) { #ifdef SUPPORT_PHONE_SERVICE if (uapi_open_voice_recognition() == 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_open_voice_recognition is - ok"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_open_voice_recognition is ok"); //成功开启语音助手 uapi_dev_runtime_set_voice_status(1); return true; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp index 074d4c407..37ef66137 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp @@ -16,7 +16,7 @@ #include "custom_utils.h" #include "notification_manager.h" -#ifdef SUPPORT_PHONE_SERVICE +#ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" #endif @@ -62,7 +62,7 @@ namespace OHOS jumpView->ChangeView(JumpView::BluetoothJumpViewNum::BLUETOOTHDEVICELISTVIEW, JumpView::BluetoothJumpViewNum::BLUETOOTHEOPTIONSVIEW); } - #ifdef SUPPORT_BT_SERVICE + #ifdef SUPPORT_CAT1_HFP_AG_SERV else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING) { MainBluetoothView *mainBluetoothView = MainBluetoothView::GetInstance(); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp index 1562b624e..0250e227c 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp @@ -15,7 +15,7 @@ #include "custom_utils.h" #include "notification_manager.h" -#ifdef SUPPORT_PHONE_SERVICE +#ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" #endif @@ -181,7 +181,7 @@ namespace OHOS if(OHOS::CallerLogModel::GetInstance()->GetCallSource() == OHOS::CallerLogModel::CallSourceCat1 && OHOS::NotificationManager::GetInstance()->GetWatchCallStatus()) { - #ifdef SUPPORT_BT_SERVICE + #ifdef SUPPORT_CAT1_HFP_AG_SERV bool SCOConnected = headset_SCO_Is_connect_extend( (bd_addr_t *)&infoData.addr); #else bool SCOConnected = false; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp index a4d116fe6..42ac17afb 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp @@ -48,6 +48,10 @@ #include "lwip_driver_adapter.h" #endif +#ifdef SUPPORT_CAT1_HFP_AG_SERV +#include "phoneservice/include/PhoneAGService.h" +#endif + #ifdef SUPPORT_BLE_SERVICE #include #include "bleService.h" @@ -70,9 +74,6 @@ #include "vibrator_service.h" #include "ConfigModel.h" -#ifdef SUPPORT_PHONE_SERVICE -#include "phoneservice/include/PhoneAGService.h" -#endif #include "custom_save_runtime.h" #include "bluetooth/include/BluetoothHeadsetEvent.h" @@ -1305,15 +1306,13 @@ static void A2dpSrcConnectstateChanged(bd_addr_t *bdAddr, int connState) PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_A2DP, AUDIO_DEVICE_CONNECTED); GraphicService::GetInstance()->PostGraphicEvent(std::bind(ACLConnectionSuss, *bdAddr)); - #ifdef SUPPORT_BLE_SERVICE - // SendMsgToUIService(EARPHONE_CONNECTED_TO_UI, 0, nullptr, 0); + #ifdef SUPPORT_CAT1_HFP_AG_SERV + SendMsgToUIService(EARPHONE_CONNECTED_TO_UI, 0, nullptr, 0); - - uapi_dev_runtime_set_earphone_connect_stat(1); uapi_save_runtime_log(RUNTIME_LOG_BR_CONNECT_A2DP_HEADSET); - // if(headset_Is_connect() == false) - // do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0); + if(headset_Is_connect() == false) + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CONNECT_AG, nullptr, 0); #endif diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp index a3a304015..eed58dace 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp @@ -36,9 +36,9 @@ #endif #include "alarm/include/AlarmClockModel.h" -// #ifdef SUPPORT_PHONE_SERVICE +#ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" -// #endif +#endif #include "custom_save_runtime.h" @@ -193,7 +193,7 @@ void StatusReset(void) #ifdef SUPPORT_CAT1_HFP_AG_SERV if(headset_Is_connect()) { - // cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLENDED,NULL); + cat1_ag_send_call_event(TOPIC_EVENT_CAT1_CALLENDED,NULL); } #endif } @@ -264,11 +264,14 @@ static void CallTimerCallbackProc(int data) } if(headset_SCO_Is_connect()==true && cat1_api_get_cat1_volte_voice_state()!=2) { - if(cat1_api_get_cat1_volte_voice_state()==2) + if(cat1_api_get_cat1_volte_voice_state()==1) { do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT1_AUDIO_STOP, nullptr, 0); } - do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0); + else + { + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0); + } } } #endif diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/CallingView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/CallingView.cpp index 760674c5a..844b1af03 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/CallingView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/CallingView.cpp @@ -26,7 +26,7 @@ #include "ui_resource_string.h" -#ifdef SUPPORT_PHONE_SERVICE +#ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" #endif diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp index 8f8462508..ef0a1fa06 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/phone/src/DialingMethodPresenter.cpp @@ -99,7 +99,9 @@ namespace OHOS DialingMethodView::GetInstance()->fail_Dial_show(1); } else - DialCall((unsigned char *)get_address_number(),strlen(get_address_number())); + { + DialCall((unsigned char *)get_address_number(),strlen(get_address_number())); + } } else { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/phone/src/MainPhoneView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/phone/src/MainPhoneView.cpp index da464a5a7..9ce55b6f3 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/phone/src/MainPhoneView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/phone/src/MainPhoneView.cpp @@ -290,6 +290,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallLOGListitemView::SetItemInfo"); if(data==NULL) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallLOGListitemView::data is NULL"); return; } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneAGService.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneAGService.cpp index 84a24fa38..389b92935 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneAGService.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneAGService.cpp @@ -188,7 +188,7 @@ void HFP_SCO_STATE_DISCONNECTEDPro(void) static void sample_hfp_ag_sco_conn_state_changed_callback(const bd_addr_t *bd_addr, hfp_sco_connect_state_t state) { // sample_hfp_ag_print_addr(bd_addr); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"state: %d\n", state); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"sample_hfp_ag_sco_conn_state_changed_callback state: %d\n", state); osal_kthread_handler task_body = NULL; switch (state) { case HFP_SCO_STATE_CONNECTING: diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneAudio.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneAudio.cpp index e02186071..8c71d741f 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneAudio.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneAudio.cpp @@ -157,8 +157,9 @@ int32_t PhoneAudioSetMicMuteCat1(bool isMute) { return 0; } + + cat1_api_set_MicMute_volte_voice(isMute); #endif - ret=AudioStreamOutSetMute(isMute); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioStreamOutSetMute] end! ret = %d", ret); return 0; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneService.cpp index b5a4bc742..3f19185c1 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/phoneservice/src/PhoneService.cpp @@ -42,7 +42,9 @@ #include "gfx_utils/mem_api.h" #include "ConfigModelC.h" #include "UiConfig.h" +#ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" +#endif #include "cmath" #include "phone_crt.h" @@ -1788,7 +1790,7 @@ static void RegisterHfpHfCallbacks(void) void PhoneServiceInit(void) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] start"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] start"); g_scoFlag = HFP_SCO_STATE_DISCONNECTED; AudioInit(); InitMutex(); @@ -1801,10 +1803,10 @@ void PhoneServiceInit(void) RegisterHfpHfCallbacks(); //AG 服务注册 #ifdef SUPPORT_CAT1_HFP_AG_SERV - // hfp_ag_reg_callback(); + hfp_ag_reg_callback(); #endif - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] end"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] end"); } // 手表主动拨打电话 diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp index 62376637a..27e0e8677 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp @@ -41,6 +41,11 @@ #endif #ifdef FD230 + +#ifdef SUPPORT_CAT1_HFP_AG_SERV +#include "phoneservice/include/PhoneAGService.h" +#endif + #include "ConfigModel.h" #include "PlayersModelC.h" #include "PlayersModel.h" @@ -741,6 +746,7 @@ void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req) } else { + if(cat1_api_get_cat1_volte_voice_state()==0) do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "headset_Is_connect is false"); } @@ -802,6 +808,7 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req) if(headset_SCO_Is_connect()) { + if(cat1_api_get_cat1_volte_voice_state()==0) do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_CAT_HFP_SCO_AUDIO_START, nullptr, 0); } } diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp index 074d4c407..d7939c387 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp @@ -16,7 +16,7 @@ #include "custom_utils.h" #include "notification_manager.h" -#ifdef SUPPORT_PHONE_SERVICE +#ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" #endif diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp index 1562b624e..547206b7e 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp @@ -15,7 +15,7 @@ #include "custom_utils.h" #include "notification_manager.h" -#ifdef SUPPORT_PHONE_SERVICE +#ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" #endif diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp index a4d116fe6..df79aca8e 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp @@ -70,7 +70,7 @@ #include "vibrator_service.h" #include "ConfigModel.h" -#ifdef SUPPORT_PHONE_SERVICE +#ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" #endif diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp index eb9883552..2ea2b5dad 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp @@ -33,7 +33,7 @@ #endif #include "alarm/include/AlarmClockModel.h" -#ifdef SUPPORT_PHONE_SERVICE +#ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" #endif diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/makephone/src/CallingView.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/makephone/src/CallingView.cpp index 760674c5a..844b1af03 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/makephone/src/CallingView.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/makephone/src/CallingView.cpp @@ -26,7 +26,7 @@ #include "ui_resource_string.h" -#ifdef SUPPORT_PHONE_SERVICE +#ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" #endif diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/phoneservice/src/PhoneService.cpp index 5e530a795..140821b81 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/phoneservice/src/PhoneService.cpp @@ -42,7 +42,11 @@ #include "gfx_utils/mem_api.h" #include "ConfigModelC.h" #include "UiConfig.h" + +#ifdef SUPPORT_CAT1_HFP_AG_SERV #include "phoneservice/include/PhoneAGService.h" +#endif + #include "cmath" #ifdef __cplusplus extern "C" { diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp index a804a4f72..77838057c 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp @@ -223,9 +223,9 @@ int32_t AudioStreamInObtainBuffer(uint8_t *data, uint32_t *size) int32_t AudioStreamInSetBitRate(uint32_t bitrate) { std::string str("setbitrate = " + std::to_string(bitrate)); - if (g_streamIn == nullptr) { + if (g_streamIn == nullptr) { ALOGE("audio stream in handle is NUll!"); - return AUDIO_ERROR; + return AUDIO_ERROR; } int32_t ret = g_streamIn->SetParam(str.c_str(), str.size()); if (ret != AUDIO_SUCCESS) { @@ -279,14 +279,21 @@ int32_t AudioStreamOutInit(AudioRendererConfig renderConfig) int32_t AudioStreamOutSetMute(bool mute) { - int32_t ret = g_streamOut->SetMute(mute); - if (ret != AUDIO_SUCCESS) { - ALOGE("audio stream out set mute failed 0x%x", ret); - return AUDIO_ERROR; - } + if(g_streamOut) + { + int32_t ret = g_streamOut->SetMute(mute); + if (ret != AUDIO_SUCCESS) { + ALOGE("audio stream out set mute failed 0x%x", ret); + return AUDIO_ERROR; + } + - ALOGD("success"); - return AUDIO_SUCCESS; + ALOGD("success"); + return AUDIO_SUCCESS; + } + ALOGD("g_streamOut is null"); + return AUDIO_ERROR; + } int32_t AudioManagerSetSeaEnable(bool enable) @@ -443,9 +450,9 @@ int32_t AudioManagerA2dpSinkSetAefParam(int32_t effectType, const char *param, u ALOGE("aef param null"); return AUDIO_ERROR; } - if (g_a2dpCtx == nullptr || g_a2dpCtx->a2dpAsohandle == nullptr) { + if (g_a2dpCtx == nullptr || g_a2dpCtx->a2dpAsohandle == nullptr) { ALOGE("aso handle is null!"); - return AUDIO_ERROR; + return AUDIO_ERROR; } char *aefBuf = (char *)malloc(AEF_BUFFER_SIZE); if (aefBuf == nullptr) { @@ -486,10 +493,10 @@ int32_t AudioManagerA2dpSinkSetAefEnable(int32_t effectType, bool enable) ALOGE("sprintf_s failed"); return AUDIO_ERROR; } - if (g_a2dpCtx == nullptr || g_a2dpCtx->a2dpAsohandle == nullptr) { - ALOGE("aso handle is null!"); - return AUDIO_ERROR; - } + if (g_a2dpCtx == nullptr || g_a2dpCtx->a2dpAsohandle == nullptr) { + ALOGE("aso handle is null!"); + return AUDIO_ERROR; + } ret = g_a2dpCtx->a2dpAsohandle->SetParam(buf, BUFFER_SIZE); if (ret != AUDIO_SUCCESS) { ALOGE("set aso param failed"); diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_bluetooth_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_bluetooth_wrapper.cpp index 1cf10cd64..f969c02a6 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_bluetooth_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_bluetooth_wrapper.cpp @@ -397,14 +397,14 @@ static void *VoiceCallVolteThread(void *priv) MEDIA_ERR_LOG("release audio focus failed"); return nullptr; } - + return nullptr; } static int32_t StartVoiceCall(const char **param) { MediaMutexLock(g_voiceCallVolteContextMutex); - int32_t type = strtol(param[0x1], nullptr, NUMBER_BASE); + int32_t type = 0;//strtol(param[0x1], nullptr, NUMBER_BASE); if (g_voiceCallVolteContext != nullptr) { MEDIA_ERR_LOG("invalid operation"); goto EXIT; @@ -427,7 +427,7 @@ static int32_t StartVoiceCall(const char **param) // For Bluetooth voice call, we only support type 0 (normal voice call) if (type == 0) { - MediaThreadattr attr = { "VoiceCallVolteThread", 0x2000, THREAD_SCHED_INVALID, 0, true }; + MediaThreadattr attr = { "VoiceCallVolteThreadbluetooth", 0x2000, THREAD_SCHED_INVALID, 0, false }; MediaThreadIdHandle taskHandle = MediaThreadCreate(VoiceCallVolteThread, g_voiceCallVolteContext, &attr); if (taskHandle == nullptr) { MEDIA_ERR_LOG("create voice call volte thread failed"); @@ -436,7 +436,7 @@ static int32_t StartVoiceCall(const char **param) return -1; } g_voiceCallVolteContext->taskHandle = taskHandle; - } else { + } else { MEDIA_ERR_LOG("unsupported voice call type: %d", type); free(g_voiceCallVolteContext); g_voiceCallVolteContext = nullptr; @@ -467,7 +467,7 @@ static int32_t StopVoiceCall(const char **param) g_voiceCallVolteContext->isVoiceCallVolteStopped = true; MediaThreadCondSignal(g_voiceCallVolteContext->cond); MediaMutexUnLock(g_voiceCallVolteContext->mutex); - + MediaThreadJoin(&g_voiceCallVolteContext->taskHandle); (void)MediaThreadCondDestroy(&g_voiceCallVolteContext->cond); (void)MediaMutexDestroy(&g_voiceCallVolteContext->mutex); @@ -509,14 +509,23 @@ static int32_t VoiceCallMicMute(const char **param) MEDIA_ERR_LOG("not support set mic mute!"); return -1; } - + printf("VoiceCallMicMute : %s\r\n",param[0x1]); + int32_t mute=0; int32_t mute = strtol(param[0x1], nullptr, NUMBER_BASE); - int32_t ret = 0; - if (mute == 0) { - ret = AudioStreamOutSetMute(false); - } else { - ret = AudioStreamOutSetMute(true); + int32_t ret = -1; + printf("AudioStreamOutSetMute : %d\r\n",mute); + + if(g_streamOutUplink) + { + ret = g_streamOutUplink->SetMute(mute); } + + if(g_streamOutDownink) + { + ret = g_streamOutDownink->SetMute(mute); + } + + if (ret != 0) { MEDIA_ERR_LOG("set mic mute failed"); @@ -553,9 +562,9 @@ static int32_t VoiceCallSetVolume(const char **param) int32_t VoiceCallVolteBluetoothSample(int32_t argc, const char *argv[]) { MEDIA_UNUSED(argc); - MEDIA_INFO_LOG("enter bluetooth voice call volte sample"); + printf("enter bluetooth voice call volte sample\r\n"); - MEDIA_INFO_LOG("input param:%s", argv[0]); + printf("input param:%s\r\n", argv[0]); int32_t ret = -1; for (uint32_t i = 0; i < ARRAY_SIZE(g_voiceCallVolteFuncs); i++) { @@ -564,11 +573,11 @@ int32_t VoiceCallVolteBluetoothSample(int32_t argc, const char *argv[]) } else { continue; } - MEDIA_INFO_LOG("%s execute %s", g_voiceCallVolteFuncs[i].cmd, (ret != 0) ? "failed" : "success"); + printf("%s execute %s \r\n", g_voiceCallVolteFuncs[i].cmd, (ret != 0) ? "failed" : "success"); } // will free g_voiceCallVolteContext when voice call volte exit - MEDIA_INFO_LOG("exit"); + printf("exit\r\n"); return 0; } diff --git a/code/sdk/zhihui/4g/cat1Service/Service/cat1_ctl.c b/code/sdk/zhihui/4g/cat1Service/Service/cat1_ctl.c index 60e74191d..b141d7dc9 100644 --- a/code/sdk/zhihui/4g/cat1Service/Service/cat1_ctl.c +++ b/code/sdk/zhihui/4g/cat1Service/Service/cat1_ctl.c @@ -320,7 +320,7 @@ void power_off_cat1(void) extern void restart_sleep_cat1_timer(void); void cat1_ring_isr_callback(pin_t pin, uintptr_t param) { - // cat1_print_warning("cat1_ring_isr_callback %d 0x%X\n",pin,param); + printf("cat1_ring_isr_callback %d 0x%X\n",pin,param); uapi_gpio_clear_interrupt(pin); // do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_ADD_CAT1VOTE,NULL,0); cat1_api_add_cat1_vote(); diff --git a/code/sdk/zhihui/4g/cat1Service/Service/cat1_server.c b/code/sdk/zhihui/4g/cat1Service/Service/cat1_server.c index 82d6bfa51..9f2ba67ba 100644 --- a/code/sdk/zhihui/4g/cat1Service/Service/cat1_server.c +++ b/code/sdk/zhihui/4g/cat1Service/Service/cat1_server.c @@ -918,9 +918,9 @@ void cat1_call_dial(char* phonenum) // #if PY_SRV_VER_CURRENT >=16 if(g_py_ver>=16) { - if(osTimerIsRunning(g_timer_time_Dial)==0 ) + if(osTimerIsRunning(g_timer_time_Dial)==0 ) { - osStatus_t ret = osTimerStart(g_timer_time_Dial,5000); + osStatus_t ret = osTimerStart(g_timer_time_Dial,8000); cat1_print_info("cat1 g_timer_time_Dial timer ret %d\n",ret); } } @@ -1150,11 +1150,11 @@ static void time_sync_func(void) g_msg_callback_func(MESSAGE_4G_NETWORK_STAT_CHANGED,NULL,0); } } - if(osTimerIsRunning(g_timer_time_sync)==1 ) - { - osStatus_t ret = osTimerStop(g_timer_time_sync); - cat1_print_info("cat1 powered off, stop timer , ret %d\n",ret); - } + // if(osTimerIsRunning(g_timer_time_sync)==1 ) + // { + // osStatus_t ret = osTimerStop(g_timer_time_sync); + // cat1_print_info("cat1 powered off, stop timer , ret %d\n",ret); + // } return ; }else{ if (cat1_api_runtime_get_cat1_powerstat()==0) @@ -1229,7 +1229,6 @@ int cat1_handle_call_connected(char* phonenum) if (g_msg_callback_func!=NULL) g_msg_callback_func(MESSAGE_4G_CALL_CONNECTED,phonenum,strlen(phonenum)); - cat1_api_start_cat1_volte_voice(); return 1; } //来电挂断处理 @@ -1241,7 +1240,6 @@ int cat1_handle_call_disconnected(char* phonenum) if (g_msg_callback_func!=NULL) g_msg_callback_func(MESSAGE_4G_CALL_DISCONNECTED,phonenum,strlen(phonenum)); - cat1_api_stop_cat1_volte_voice(); return 1; } diff --git a/code/sdk/zhihui/4g/cat1Service/include/cat1_porting.h b/code/sdk/zhihui/4g/cat1Service/include/cat1_porting.h index 6312d02b7..6056377cf 100644 --- a/code/sdk/zhihui/4g/cat1Service/include/cat1_porting.h +++ b/code/sdk/zhihui/4g/cat1Service/include/cat1_porting.h @@ -61,6 +61,8 @@ int32_t cat1_cat1_start_SCO_volte_voice(void); void cat1_UI_call_dial(char *tell); +int32_t cat1_api_set_MicMute_volte_voice(bool data); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/code/sdk/zhihui/4gTest/cat1_porting.c b/code/sdk/zhihui/4gTest/cat1_porting.c index fe97fefec..ade2f7fa9 100644 --- a/code/sdk/zhihui/4gTest/cat1_porting.c +++ b/code/sdk/zhihui/4gTest/cat1_porting.c @@ -145,12 +145,19 @@ int32_t cat1_api_stop_cat1_volte_voice(void) if(cat1_voice!=0) { - ret = VoiceCallVolteSample(argc, (const char **)&argv); + if(cat1_voice==2) + { + ret = VoiceCallVolteBluetoothSample(argc, (const char **)&argv); + } + else + { + ret = VoiceCallVolteSample(argc, (const char **)&argv); + } if(ret==0) cat1_voice=0; } - cat1_print_dbg("ret %d %d ",ret, cat1_voice); + cat1_print_dbg("cat1_api_stop_cat1_volte_voice ret %d %d ",ret, cat1_voice); return ret; } @@ -161,20 +168,61 @@ int32_t cat1_cat1_start_SCO_volte_voice(void) int32_t argc = 1; uint8_t *argv = (uint8_t *)"start"; - if(cat1_voice!=0) + cat1_print_dbg("cat1_cat1_start_SCO_volte_voice %d \n",cat1_voice); + + if(cat1_voice==0) { ret = VoiceCallVolteBluetoothSample(argc, (const char **)&argv); if(ret==0) cat1_voice=2; } + else + { + cat1_print_dbg("cat1_voice!=0"); + } - cat1_print_dbg("ret %d %d ",ret, cat1_voice); + cat1_print_dbg("cat1_cat1_start_SCO_volte_voice ret %d %d ",ret, cat1_voice); return ret; } + +int32_t cat1_api_set_MicMute_volte_voice(bool data) +{ + cat1_print_dbg("cat1_api_set_MicMute_volte_voice\n"); + + int32_t ret = ERRCODE_FAIL; + int32_t argc = 2; + const char * argv[] ={"mute", "1"}; + if(data) + { + argv[1]="1"; + } + else + { + argv[1]="0"; + } + + if(cat1_voice!=0) + { + if(cat1_voice==2) + { + ret = VoiceCallVolteBluetoothSample(argc, argv); + } + else + { + ret = VoiceCallVolteSample(argc, argv); + } + } + + cat1_print_dbg("cat1_api_set_MicMute_volte_voice ret %d %d ",ret, cat1_voice); + + return ret; +} + + #include "power_display_service.h" /*获取屏幕状态: return 1 need update */ @@ -183,7 +231,7 @@ uint8_t cat1_api_need_update_signal(void) const power_display_svr_api_t *display_api = power_display_svr_get_api(); screen_state_t state = display_api->get_screen_state(); - // printf("uapi_get_screen_state = %s . \r\n", state==SCREEN_ON?"on":"off"); + printf("uapi_get_screen_state = %s . \r\n", state==SCREEN_ON?"on":"off"); if( state == SCREEN_ON){ return 1; }else{ diff --git a/code/sdk/zhihui/utils/custom_utils.h b/code/sdk/zhihui/utils/custom_utils.h index c5c1f896d..130de2677 100644 --- a/code/sdk/zhihui/utils/custom_utils.h +++ b/code/sdk/zhihui/utils/custom_utils.h @@ -241,6 +241,8 @@ uint32_t uapi_calendar_store_date(void); #define CUSTOM_CMD_MSG_STOP_CHECK_MIC 0x1E +#define CUSTOM_CMD_MSG_CONNECT_AG 0x1F + typedef enum { BR_HFP_CONNECT=1, BR_HFP_DISCONNECT, -- 2.17.1