Merge branch 'bugfix/ble_active_scan_not_wait_scan_rsp_v3.0' into 'release/v3.0'
component/bt: add a option to make report adv data and scan response individually (backport v3.0) See merge request idf/esp-idf!4158
This commit is contained in:
commit
1b1053c863
5 changed files with 37 additions and 1 deletions
|
@ -193,6 +193,15 @@ config SMP_ENABLE
|
||||||
depends on BLUEDROID_ENABLED
|
depends on BLUEDROID_ENABLED
|
||||||
default CLASSIC_BT_ENABLED || BLE_SMP_ENABLE
|
default CLASSIC_BT_ENABLED || BLE_SMP_ENABLE
|
||||||
|
|
||||||
|
config BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY
|
||||||
|
bool "Report adv data and scan response individually when BLE active scan"
|
||||||
|
depends on BLUEDROID_ENABLED
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Originally, when doing BLE active scan, Bluedroid will not report adv to application layer
|
||||||
|
until receive scan response. This option is used to disable the behavior. When enable this option,
|
||||||
|
Bluedroid will report adv data or scan response to application layer immediately.
|
||||||
|
|
||||||
# Memory reserved at start of DRAM for Bluetooth stack
|
# Memory reserved at start of DRAM for Bluetooth stack
|
||||||
config BT_RESERVE_DRAM
|
config BT_RESERVE_DRAM
|
||||||
hex
|
hex
|
||||||
|
|
|
@ -211,6 +211,12 @@
|
||||||
#define BTA_AV_CO_CP_SCMS_T FALSE//FALSE
|
#define BTA_AV_CO_CP_SCMS_T FALSE//FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY
|
||||||
|
#define BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY FALSE
|
||||||
|
#else
|
||||||
|
#define BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This feature is used to eanble interleaved scan*/
|
/* This feature is used to eanble interleaved scan*/
|
||||||
#ifndef BTA_HOST_INTERLEAVE_SEARCH
|
#ifndef BTA_HOST_INTERLEAVE_SEARCH
|
||||||
#define BTA_HOST_INTERLEAVE_SEARCH FALSE//FALSE
|
#define BTA_HOST_INTERLEAVE_SEARCH FALSE//FALSE
|
||||||
|
|
|
@ -2855,7 +2855,9 @@ BOOLEAN btm_ble_update_inq_result(BD_ADDR bda, tINQ_DB_ENT *p_i, UINT8 addr_type
|
||||||
BTM_TRACE_DEBUG("btm_ble_update_inq_result scan_rsp=false, to_report=false,\
|
BTM_TRACE_DEBUG("btm_ble_update_inq_result scan_rsp=false, to_report=false,\
|
||||||
scan_type_active=%d", btm_cb.ble_ctr_cb.inq_var.scan_type);
|
scan_type_active=%d", btm_cb.ble_ctr_cb.inq_var.scan_type);
|
||||||
p_i->scan_rsp = FALSE;
|
p_i->scan_rsp = FALSE;
|
||||||
|
#if BTM_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY == FALSE
|
||||||
to_report = FALSE;
|
to_report = FALSE;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
p_i->scan_rsp = TRUE;
|
p_i->scan_rsp = TRUE;
|
||||||
}
|
}
|
||||||
|
|
7
examples/bluetooth/gatt_client/main/Kconfig.projbuild
Normal file
7
examples/bluetooth/gatt_client/main/Kconfig.projbuild
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
menu "Example Configuration"
|
||||||
|
|
||||||
|
config EXAMPLE_DUMP_ADV_DATA_AND_SCAN_RESP
|
||||||
|
bool "Dump whole adv data and scan response data in example"
|
||||||
|
default n
|
||||||
|
|
||||||
|
endmenu
|
|
@ -337,7 +337,19 @@ static void esp_gap_cb(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *par
|
||||||
ESP_BLE_AD_TYPE_NAME_CMPL, &adv_name_len);
|
ESP_BLE_AD_TYPE_NAME_CMPL, &adv_name_len);
|
||||||
ESP_LOGI(GATTC_TAG, "searched Device Name Len %d", adv_name_len);
|
ESP_LOGI(GATTC_TAG, "searched Device Name Len %d", adv_name_len);
|
||||||
esp_log_buffer_char(GATTC_TAG, adv_name, adv_name_len);
|
esp_log_buffer_char(GATTC_TAG, adv_name, adv_name_len);
|
||||||
|
|
||||||
|
#if CONFIG_EXAMPLE_DUMP_ADV_DATA_AND_SCAN_RESP
|
||||||
|
if (scan_result->scan_rst.adv_data_len > 0) {
|
||||||
|
ESP_LOGI(GATTC_TAG, "adv data:");
|
||||||
|
esp_log_buffer_hex(GATTC_TAG, &scan_result->scan_rst.ble_adv[0], scan_result->scan_rst.adv_data_len);
|
||||||
|
}
|
||||||
|
if (scan_result->scan_rst.scan_rsp_len > 0) {
|
||||||
|
ESP_LOGI(GATTC_TAG, "scan resp:");
|
||||||
|
esp_log_buffer_hex(GATTC_TAG, &scan_result->scan_rst.ble_adv[scan_result->scan_rst.adv_data_len], scan_result->scan_rst.scan_rsp_len);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
ESP_LOGI(GATTC_TAG, "\n");
|
ESP_LOGI(GATTC_TAG, "\n");
|
||||||
|
|
||||||
if (adv_name != NULL) {
|
if (adv_name != NULL) {
|
||||||
if (strlen(remote_device_name) == adv_name_len && strncmp((char *)adv_name, remote_device_name, adv_name_len) == 0) {
|
if (strlen(remote_device_name) == adv_name_len && strncmp((char *)adv_name, remote_device_name, adv_name_len) == 0) {
|
||||||
ESP_LOGI(GATTC_TAG, "searched device %s\n", remote_device_name);
|
ESP_LOGI(GATTC_TAG, "searched device %s\n", remote_device_name);
|
||||||
|
|
Loading…
Reference in a new issue