From c5654ccf131dc39dd13a246ddc9b68f133ee1b08 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=83=A1=E4=BC=A0=E5=86=9B?= <1224667075@qq.com> Date: Fri, 22 Nov 2024 07:28:40 +0000 Subject: [PATCH] Merge #1447 into sdk602patch0911 from refs/changes/1447/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 蓝牙接口增加初始化限制 * refs/changes/1447/head: (2 commits squashed) - 蓝牙接口增加初始化限制 - 非4G电话界面结束4G电话场景修改 Signed-off-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: Caisking <3449750381@qq.com> Reviewed-by: 罗正 <1732036298@qq.com> Reviewed-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Reviewed-by: aliyun6865282430 <1624952103@qq.com> Merged-by: Caisking <3449750381@qq.com> CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1447 --- .../bluetooth/include/BluetoothModelC.h | 1 + .../nativeui/bluetooth/src/BluetoothModel.cpp | 20 ++++++++++++++++ .../phoneservice/src/PhoneService.cpp | 20 ++++++++++++---- .../src/notify/makephone_notification.cpp | 23 ++++++++++++------- 4 files changed, 52 insertions(+), 12 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothModelC.h b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothModelC.h index ab02f9fcf..8f76d5b50 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothModelC.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothModelC.h @@ -31,6 +31,7 @@ int32_t BtA2dpSnkAudioDestroy(void); int uapi_reconnect_(void); +int get_BT_is_init(void); #ifdef __cplusplus } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp index 38743aaed..0f7384c0c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp @@ -1809,8 +1809,19 @@ void BleAdvStart(void) WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BleAdvStart bt gap_ble_start_adv ret = 0x%x", ret); } //////////////////////////////////A2DP sink端 代码/////////////////////////////////////////////// + +int get_BT_is_init() +{ + return g_bluetooth_initialled; +} + int uapi_a2dp_snk_get_device_connect_state() { + if(get_BT_is_init()==0) + { + return 0; + } + int ret = a2dp_snk_get_device_connect_state(&g_bd_addr); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP,"state(int): %d\n", ret); @@ -1860,6 +1871,11 @@ int uapi_a2dp_snk_connect() int uapi_a2dp_snk_connect_() { + if(get_BT_is_init()==0) + { + return 0; + } + bd_addr_t bdaddr={0}; uapi_get_br_address(&bdaddr); @@ -1881,6 +1897,10 @@ int uapi_a2dp_snk_disconnect() int uapi_a2dp_snk_disconnect_() { + if(get_BT_is_init()==0) + { + return 0; + } bd_addr_t bdaddr={0}; uapi_get_br_address(&bdaddr); 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 3c800e987..a9ca82338 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -789,6 +789,7 @@ static void ScoStateChanged(const bd_addr_t *bdAddr, hfp_sco_connect_state_t sta case HFP_SCO_STATE_CONNECTED: // 同步音量 SyncVolume(); + if(TransCallToMobilePhone_falg) { TransCallToMobilePhone(); @@ -2253,6 +2254,11 @@ int TransCallToMobilePhone(void) int uapi_hfp_disconnect_(void) { + if( get_BT_is_init()==0) + { + return 0; + } + int ret; bd_addr_t bdaddr={0}; OHOS:: uapi_get_br_address(&bdaddr); @@ -2266,10 +2272,11 @@ int uapi_hfp_disconnect_(void) int uapi_hfp_connect_(void) { - // if(uapi_hfp_connect_state()==1) - // { - // return; - // } + if( get_BT_is_init()==0) + { + return 0; + } + int ret; bd_addr_t bdaddr={0}; OHOS:: uapi_get_br_address(&bdaddr); @@ -2330,6 +2337,11 @@ int uapi_hfp_connect_(void) int uapi_hfp_connect_state(void) { + if( get_BT_is_init()==0) + { + return 0; + } + int ret; bd_addr_t bdaddr={0}; OHOS:: uapi_get_br_address(&bdaddr); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp index 12556026a..6d8d8b395 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp @@ -681,6 +681,8 @@ static void WatchFinishHandle(void) { if (NotificationManager::GetInstance()->GetWatchCallStatus()) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetWatchCallStatus !!"); + if(get_falg_SOS()) { addcalllog(); @@ -688,14 +690,18 @@ static void WatchFinishHandle(void) } else { - if(CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone) - { - addcalllog(); - } - else if(uapi_dev_runtime_get_train_status() || transmittingISShow()) + if(CallerLogModel::GetInstance()->GetCallSource()==CallerLogModel::CallSourcePhone + || uapi_dev_runtime_get_train_status() || transmittingISShow() ) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "addcalllogend !!"); + addcalllog(); - StatusReset(); + + if(uapi_dev_runtime_get_train_status() || transmittingISShow()) + { + StatusReset(); + } + } else { @@ -801,8 +807,9 @@ void CalldialTimerCallBackProc(int data) dail_falg++; if(dail_falg>=DIAL_TIME) { - // cat1_call_hungup_timer(); - cat1_handle_call_disconnected("callfail"); + cat1_call_hungup_timer(); + + // cat1_handle_call_disconnected((char *)CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); } } -- 2.17.1