1.ESP32-S3蓝牙扫描修改了蓝牙扫描参数为1s,但为什么触发不了ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件
2.已修改扫描参数为BLE_50的参数
esp_ble_gap_prefer_ext_connect_params_set(param->ext_adv_report.params.addr,
ESP_BLE_GAP_PHY_1M_PREF_MASK,
&phy_1m_conn_params, NULL, NULL);
static esp_ble_ext_scan_params_t ext_scan_params = {
.own_addr_type = BLE_ADDR_TYPE_PUBLIC,
.filter_policy = BLE_SCAN_FILTER_ALLOW_ALL,
.scan_duplicate = BLE_SCAN_DUPLICATE_DISABLE,
.cfg_mask = ESP_BLE_GAP_EXT_SCAN_CFG_UNCODE_MASK,
.uncoded_cfg = {BLE_SCAN_TYPE_ACTIVE, 160, 80}, // 400ms 20ms : 640, 32 100ms 50ms : 160, 80
.coded_cfg = {BLE_SCAN_TYPE_ACTIVE, 40, 40},
};
3.扫描接口使用esp_ble_gap_start_ext_scan(EXT_SCAN_DURATION, EXT_SCAN_PERIOD); // 蓝牙开启扫描
4.设置参数为 #define EXT_SCAN_DURATION 1000 // 扫描持续时间 #define EXT_SCAN_PERIOD 1000 // 扫描周期
5.实测一直没有触发ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件,也没有触发ESP_GAP_SEARCH_INQ_CMPL_EVT事件,测试若使用esp_ble_gap_start_scanning接口来扫描,超过设定时间后,会触发ESP_GAP_SEARCH_INQ_CMPL_EVT事件,但我需要使用esp_ble_gap_start_ext_scan接口
6.调用esp_ble_gap_start_ext_scan来扫描,会触发ESP_GAP_BLE_EXT_SCAN_START_COMPLETE_EVT事件,但为什么不能触发ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件,按道理我设置1s的扫描时间,超过1s会触发此事件
7.如何才能触发ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件?
【已解决】ESP32-S3蓝牙扫描修改了蓝牙扫描参数为1s,但为什么触发不了ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件
【已解决】ESP32-S3蓝牙扫描修改了蓝牙扫描参数为1s,但为什么触发不了ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件
Last edited by llzzdd on Tue Nov 05, 2024 5:34 am, edited 1 time in total.
Re: 【求助】ESP32-S3蓝牙扫描修改了蓝牙扫描参数为1s,但为什么触发不了ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件
乐鑫工作人员是否可以关注下,这个ESP_GAP_BLE_SCAN_TIMEOUT_EVT标志位如何才能触发,我现在只能通过定时器来触发,但感觉这个事件标志位不能是摆设吧
-
- Posts: 42
- Joined: Thu May 04, 2023 3:49 am
Re: 【求助】ESP32-S3蓝牙扫描修改了蓝牙扫描参数为1s,但为什么触发不了ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件
1- ESP_GAP_BLE_SCAN_TIMEOUT_EVT 是由下面事件触发的
Subevent_Code: HCI_LE_Scan_Timeout
The HCI_LE_Scan_Timeout event indicates that scanning has ended because
the duration has expired.
see:
BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 4, Part E page 2274
2- Duration 和 Period 的单位
Duration:
Time = N × 10 ms
Time Range: 10 ms to 655.35 s
Period:
Time = N × 1.28 sec
Time Range: 1.28 s to 83,884.8 s
3-
如果你想 1s 后停止扫描,你可以将
Duration 设置为 100
Period 设置 0
1s 后,ESP_GAP_BLE_SCAN_TIMEOUT_EVT 会上来。
see:
BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 4, Part E page 2486
Subevent_Code: HCI_LE_Scan_Timeout
The HCI_LE_Scan_Timeout event indicates that scanning has ended because
the duration has expired.
see:
BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 4, Part E page 2274
2- Duration 和 Period 的单位
Duration:
Time = N × 10 ms
Time Range: 10 ms to 655.35 s
Period:
Time = N × 1.28 sec
Time Range: 1.28 s to 83,884.8 s
3-
如果你想 1s 后停止扫描,你可以将
Duration 设置为 100
Period 设置 0
1s 后,ESP_GAP_BLE_SCAN_TIMEOUT_EVT 会上来。
see:
BLUETOOTH CORE SPECIFICATION Version 5.4 | Vol 4, Part E page 2486
Re: 【已解决】ESP32-S3蓝牙扫描修改了蓝牙扫描参数为1s,但为什么触发不了ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件
llzzdd wrote: ↑Mon Oct 28, 2024 7:24 am1.ESP32-S3蓝牙扫描修改了蓝牙扫描参数为1s,但为什么触发不了ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件
2.已修改扫描参数为BLE_50的参数
esp_ble_gap_prefer_ext_connect_params_set(param->ext_adv_report.params.addr,
ESP_BLE_GAP_PHY_1M_PREF_MASK,
&phy_1m_conn_params, NULL, NULL);
static esp_ble_ext_scan_params_t ext_scan_params = {
.own_addr_type = BLE_ADDR_TYPE_PUBLIC,
.filter_policy = BLE_SCAN_FILTER_ALLOW_ALL,
.scan_duplicate = BLE_SCAN_DUPLICATE_DISABLE,
.cfg_mask = ESP_BLE_GAP_EXT_SCAN_CFG_UNCODE_MASK,
.uncoded_cfg = {BLE_SCAN_TYPE_ACTIVE, 160, 80}, // 400ms 20ms : 640, 32 100ms 50ms : 160, 80
.coded_cfg = {BLE_SCAN_TYPE_ACTIVE, 40, 40},
};
3.扫描接口使用esp_ble_gap_start_ext_scan(EXT_SCAN_DURATION, EXT_SCAN_PERIOD); // 蓝牙开启扫描
4.设置参数为 #define EXT_SCAN_DURATION 1000 // 扫描持续时间 #define EXT_SCAN_PERIOD 1000 // 扫描周期
5.实测一直没有触发ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件,也没有触发ESP_GAP_SEARCH_INQ_CMPL_EVT事件,测试若使用esp_ble_gap_start_scanning接口来扫描,超过设定时间后,会触发ESP_GAP_SEARCH_INQ_CMPL_EVT事件,但我需要使用esp_ble_gap_start_ext_scan接口
6.调用esp_ble_gap_start_ext_scan来扫描,会触发ESP_GAP_BLE_EXT_SCAN_START_COMPLETE_EVT事件,但为什么不能触发ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件,按道理我设置1s的扫描时间,超过1s会触发此事件
7.如何才能触发ESP_GAP_BLE_SCAN_TIMEOUT_EVT事件?
Who is online
Users browsing this forum: No registered users and 10 guests