Skip to content

Commit

Permalink
Merge branch 'bugfix/eanble_bluedroid_host_adv_ind_report_individuall…
Browse files Browse the repository at this point in the history
…y' into 'master'

allow bluedroid host to report adv_ind separately

See merge request espressif/esp-idf!20305
  • Loading branch information
Weijian-Espressif committed Oct 8, 2022
2 parents 0fa55c8 + 01faa7b commit 3b20bc7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion components/bt/host/bluedroid/Kconfig.in
Expand Up @@ -1037,7 +1037,7 @@ config BT_SMP_ENABLE

config BT_BLE_ACT_SCAN_REP_ADV_SCAN
bool "Report adv data and scan response individually when BLE active scan"
depends on BT_BLUEDROID_ENABLED && (BTDM_CTRL_MODE_BTDM || BTDM_CTRL_MODE_BLE_ONLY)
depends on BT_BLUEDROID_ENABLED && BT_BLE_ENABLED
default n
help
Originally, when doing BLE active scan, Bluedroid will not report adv to application layer
Expand Down
29 changes: 14 additions & 15 deletions components/bt/host/bluedroid/stack/btm/btm_ble_gap.c
Expand Up @@ -3673,21 +3673,20 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
0x04 Scan Response (SCAN_RSP)
0x05-0xFF Reserved for future use
*/
//if scan duplicate is enabled, the adv packet without scan response is allowed to report to higher layer
if(p_le_inq_cb->scan_duplicate_filter == BTM_BLE_SCAN_DUPLICATE_ENABLE) {
/*
Bluedroid will put the advertising packet and scan response into a packet and send it to the higher layer.
If two advertising packets are not with the same address, or can't be combined into a packet, then the first advertising
packet will be discarded. So we added the following judgment:
1. For different addresses, send the last advertising packet to higher layer
2. For same address and same advertising type (not scan response), send the last advertising packet to higher layer
3. For same address and scan response, do nothing
*/
int same_addr = memcmp(bda, p_le_inq_cb->adv_addr, BD_ADDR_LEN);
if (same_addr != 0 || (same_addr == 0 && evt_type != BTM_BLE_SCAN_RSP_EVT)) {
btm_ble_process_last_adv_pkt();
}
}
// The adv packet without scan response is allowed to report to higher layer
/*
Bluedroid will put the advertising packet and scan response into a packet and send it to the higher layer.
If two advertising packets are not with the same address, or can't be combined into a packet, then the first advertising
packet will be discarded. So we added the following judgment:
1. For different addresses, send the last advertising packet to higher layer
2. For same address and same advertising type (not scan response), send the last advertising packet to higher layer
3. For same address and scan response, do nothing
*/
int same_addr = memcmp(bda, p_le_inq_cb->adv_addr, BD_ADDR_LEN);
if (same_addr != 0 || (same_addr == 0 && evt_type != BTM_BLE_SCAN_RSP_EVT)) {
btm_ble_process_last_adv_pkt();
}


p_i = btm_inq_db_find (bda);

Expand Down

0 comments on commit 3b20bc7

Please sign in to comment.