diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2023-03-07 09:36:45 -0800 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2023-03-07 09:36:45 -0800 |
commit | d91dc298a0c1c938f282826beee9f844e54e6fcc (patch) | |
tree | 0f08fc81429abb0feeedbea8d7da7154c285fa60 | |
parent | 90f7e6bb17c77e0650ae4aa9c403b36bff0cccee (diff) | |
parent | b65daa9e0f41cb2c11373a5a392378e98fe48b72 (diff) |
Merge b65daa9e0f41cb2c11373a5a392378e98fe48b72 on remote branch
Change-Id: I5c3f0ee463a7208ec2e11852ce972e905ced4269
-rw-r--r-- | bta/dm/bta_dm_act.cc | 14 | ||||
-rw-r--r-- | bta/dm/bta_dm_main.cc | 2 | ||||
-rw-r--r-- | btif/src/btif_ble_scanner.cc | 5 | ||||
-rw-r--r-- | include/hardware/ble_scanner.h | 6 | ||||
-rw-r--r-- | stack/btm/btm_ble_gap.cc | 15 | ||||
-rw-r--r-- | stack/include/btm_ble_api.h | 5 |
6 files changed, 40 insertions, 7 deletions
diff --git a/bta/dm/bta_dm_act.cc b/bta/dm/bta_dm_act.cc index a7afe08b4..d722eda44 100644 --- a/bta/dm/bta_dm_act.cc +++ b/bta/dm/bta_dm_act.cc @@ -5716,8 +5716,20 @@ void btm_dm_start_gatt_discovery(const RawAddress& bd_addr) { btm_dm_start_disc_gatt_services(bta_dm_search_cb.conn_id); } else { if (BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) { +#ifdef ADV_AUDIO_FEATURE + if (is_remote_support_adv_audio(bd_addr)) { + APPL_TRACE_DEBUG("%s ADV_AUDIO_DEVICE ", __func__); + BTA_GATTC_Open(bta_dm_search_cb.client_if, bd_addr, true, + GATT_TRANSPORT_LE, true); + } else { + APPL_TRACE_DEBUG("%s LEGACY LE DEVICE ", __func__); + BTA_GATTC_Open(bta_dm_search_cb.client_if, bd_addr, true, + GATT_TRANSPORT_LE, false); + } +#else BTA_GATTC_Open(bta_dm_search_cb.client_if, bd_addr, true, - GATT_TRANSPORT_LE, true); + GATT_TRANSPORT_LE, false); +#endif } else { //TODO review. Kept qcom Specific change only. APPL_TRACE_DEBUG("btm_dm_start_gatt_discovery: ACL is disconnected"); diff --git a/bta/dm/bta_dm_main.cc b/bta/dm/bta_dm_main.cc index 3b105adb7..9ba343ff9 100644 --- a/bta/dm/bta_dm_main.cc +++ b/bta/dm/bta_dm_main.cc @@ -274,7 +274,7 @@ const uint8_t bta_dm_search_disc_active_st_table[][BTA_DM_SEARCH_NUM_COLS] = { /* Event Action 1 Action 2 Next State */ - /* API_SEARCH */ {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, + /* API_SEARCH */ {BTA_DM_QUEUE_SEARCH, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE}, /* API_SEARCH_CANCEL */ {BTA_DM_SEARCH_CANCEL_NOTIFY, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING}, diff --git a/btif/src/btif_ble_scanner.cc b/btif/src/btif_ble_scanner.cc index 883c98077..1754a822a 100644 --- a/btif/src/btif_ble_scanner.cc +++ b/btif/src/btif_ble_scanner.cc @@ -349,7 +349,7 @@ class BleScannerInterfaceImpl : public BleScannerInterface { void StartSync(uint8_t sid, RawAddress address, uint16_t skip, uint16_t timeout, StartSyncCb start_cb, SyncReportCb report_cb, - SyncLostCb lost_cb) override { + SyncLostCb lost_cb, BigInfoReportCb biginfo_report_cb) override { const controller_t* controller = controller_get_interface(); if (!controller->supports_ble_periodic_sync_transfer()) { uint8_t status_no_resource = 2; @@ -359,7 +359,8 @@ class BleScannerInterfaceImpl : public BleScannerInterface { base::Bind(&BTM_BleStartPeriodicSync, sid, address, skip, timeout, jni_thread_wrapper(FROM_HERE, std::move(start_cb)), jni_thread_wrapper(FROM_HERE, std::move(report_cb)), - jni_thread_wrapper(FROM_HERE, std::move(lost_cb)))); + jni_thread_wrapper(FROM_HERE, std::move(lost_cb)), + jni_thread_wrapper(FROM_HERE, std::move(biginfo_report_cb)))); } void StartSync(uint8_t sid, RawAddress address, uint16_t skip, diff --git a/include/hardware/ble_scanner.h b/include/hardware/ble_scanner.h index 393963328..b8b672810 100644 --- a/include/hardware/ble_scanner.h +++ b/include/hardware/ble_scanner.h @@ -125,9 +125,13 @@ class BleScannerInterface { base::Callback<void(uint16_t sync_handle, int8_t tx_power, int8_t rssi, uint8_t status, std::vector<uint8_t> data)>; using SyncLostCb = base::Callback<void(uint16_t sync_handle)>; + + using BigInfoReportCb = base::Callback<void(uint16_t sync_handle, bool encrypted)>; + virtual void StartSync(uint8_t sid, RawAddress address, uint16_t skip, uint16_t timeout, StartSyncCb start_cb, - SyncReportCb report_cb, SyncLostCb lost_cb) = 0; + SyncReportCb report_cb, SyncLostCb lost_cb, + BigInfoReportCb biginfo_report_cb) = 0; virtual void StopSync(uint16_t handle) = 0; #if (BLE_PS_PAST_IF_SUPPORTED == TRUE) virtual void CancelCreateSync(uint8_t sid, RawAddress address) = 0; diff --git a/stack/btm/btm_ble_gap.cc b/stack/btm/btm_ble_gap.cc index 5be05cbf8..99717243e 100644 --- a/stack/btm/btm_ble_gap.cc +++ b/stack/btm/btm_ble_gap.cc @@ -164,6 +164,8 @@ using SyncReportCb = uint8_t /*status*/, std::vector<uint8_t> /*data*/)>; using SyncLostCb = base::Callback<void(uint16_t /*sync_handle*/)>; using SyncTransferCb = base::Callback<void(uint8_t /*status*/, RawAddress)>; +using BigInfoReportCb = base::Callback<void(uint16_t /*sync_handle*/, bool /*encrypted*/)>; + #define MAX_SYNC_TRANSACTION 16 #define SYNC_TIMEOUT (30 * 1000) #define ADV_SYNC_ESTB_EVT_LEN 16 @@ -185,6 +187,7 @@ typedef struct { StartSyncCb sync_start_cb; SyncReportCb sync_report_cb; SyncLostCb sync_lost_cb; + BigInfoReportCb biginfo_report_cb; } tBTM_BLE_PERIODIC_SYNC; typedef struct { @@ -1272,7 +1275,8 @@ void btm_ble_periodic_adv_sync_lost(uint8_t *param, uint16_t param_len) { ******************************************************************************/ void BTM_BleStartPeriodicSync(uint8_t adv_sid, RawAddress address, uint16_t skip, - uint16_t timeout, StartSyncCb syncCb, SyncReportCb reportCb, SyncLostCb lostCb) { + uint16_t timeout, StartSyncCb syncCb, SyncReportCb reportCb, SyncLostCb lostCb, + BigInfoReportCb biginfo_reportCb) { BTM_TRACE_DEBUG("[PSync]%s",__func__); int index = btm_ble_get_free_psync_index(); tBTM_BLE_PERIODIC_SYNC *p = &btm_ble_pa_sync_cb.p_sync[index]; @@ -1286,6 +1290,7 @@ void BTM_BleStartPeriodicSync(uint8_t adv_sid, RawAddress address, uint16_t skip p->sync_start_cb = syncCb; p->sync_report_cb = reportCb; p->sync_lost_cb = lostCb; + p->biginfo_report_cb = biginfo_reportCb; btm_queue_start_sync_req(adv_sid, address, skip, timeout); } @@ -1484,6 +1489,14 @@ void btm_ble_biginfo_adv_report_rcvd(uint8_t *p, uint16_t param_len) { "sdu_interval = %d, max_sdu = %d, phy = %d, framing = %d, encryption = %d", __func__, sync_handle, num_bises, nse, iso_interval, bn, pto, irc, max_pdu, sdu_interval, max_sdu, phy, framing, encryption); + int index = btm_ble_get_psync_index_from_handle(sync_handle); + if (index == MAX_SYNC_TRANSACTION) { + BTM_TRACE_ERROR("[PSync]%s: index not found", __func__); + return; + } + tBTM_BLE_PERIODIC_SYNC *ps = &btm_ble_pa_sync_cb.p_sync[index]; + BTM_TRACE_DEBUG("[PSync]%s: invoking callback", __func__); + ps->biginfo_report_cb.Run(sync_handle, encryption ? true: false); } /******************************************************************************* diff --git a/stack/include/btm_ble_api.h b/stack/include/btm_ble_api.h index c55cc5d4e..d4ea5a65b 100644 --- a/stack/include/btm_ble_api.h +++ b/stack/include/btm_ble_api.h @@ -1326,6 +1326,8 @@ using SyncReportCb = uint8_t /*status*/, std::vector<uint8_t> /*data*/)>; using SyncLostCb = base::Callback<void(uint16_t /*sync_handle*/)>; +using BigInfoReportCb = base::Callback<void(uint16_t /*sync_handle*/, bool /*encrypted*/)>; + extern void btm_ble_periodic_adv_sync_established(uint8_t *param, uint16_t param_len); extern void btm_ble_periodic_adv_report(uint8_t *param, uint16_t param_len); extern void btm_ble_periodic_adv_sync_lost(uint8_t *param, uint16_t param_len); @@ -1350,7 +1352,8 @@ extern void BTM_BleStartPeriodicSync(uint8_t adv_sid, RawAddress address, uint16_t skip, uint16_t timeout, StartSyncCb syncCb, SyncReportCb reportCb, - SyncLostCb lostCb); + SyncLostCb lostCb, + BigInfoReportCb biginfo_reportCb); /******************************************************************************* * * Function BTM_BleStopPeriodicSync |