Skip to content

Commit fa3c692

Browse files
committed
fix(bluedroid): Restore ExtScan functions
1 parent 8b36322 commit fa3c692

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

libraries/BLE/src/BLEScan.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ void BLEScan::clearResults() {
207207
#if defined(CONFIG_BLUEDROID_ENABLED)
208208

209209
#if defined(SOC_BLE_50_SUPPORTED)
210+
210211
void BLEScan::setExtendedScanCallback(BLEExtAdvertisingCallbacks *cb) {
211212
m_pExtendedScanCb = cb;
212213
}
@@ -241,6 +242,48 @@ void BLEScan::setPeriodicScanCallback(BLEPeriodicScanCallbacks *cb) {
241242
m_pPeriodicScanCb = cb;
242243
}
243244

245+
/**
246+
* @brief This function is used to set the extended scan parameters to be used on the advertising channels.
247+
*
248+
*
249+
* @return - ESP_OK : success
250+
* - other : failed
251+
*
252+
*/
253+
esp_err_t BLEScan::setExtScanParams() {
254+
esp_ble_ext_scan_params_t ext_scan_params = {
255+
.own_addr_type = BLE_ADDR_TYPE_PUBLIC,
256+
.filter_policy = BLE_SCAN_FILTER_ALLOW_ALL,
257+
.scan_duplicate = BLE_SCAN_DUPLICATE_DISABLE,
258+
.cfg_mask = ESP_BLE_GAP_EXT_SCAN_CFG_UNCODE_MASK | ESP_BLE_GAP_EXT_SCAN_CFG_CODE_MASK,
259+
.uncoded_cfg = {BLE_SCAN_TYPE_ACTIVE, 40, 40},
260+
.coded_cfg = {BLE_SCAN_TYPE_ACTIVE, 40, 40},
261+
};
262+
263+
esp_err_t rc = esp_ble_gap_set_ext_scan_params(&ext_scan_params);
264+
if (rc) {
265+
log_e("set extend scan params error, error code = %x", rc);
266+
}
267+
return rc;
268+
}
269+
270+
/**
271+
* @brief This function is used to set the extended scan parameters to be used on the advertising channels.
272+
*
273+
* @param[in] params : scan parameters
274+
*
275+
* @return - ESP_OK : success
276+
* - other : failed
277+
*
278+
*/
279+
esp_err_t BLEScan::setExtScanParams(esp_ble_ext_scan_params_t *ext_scan_params) {
280+
esp_err_t rc = esp_ble_gap_set_ext_scan_params(ext_scan_params);
281+
if (rc) {
282+
log_e("set extend scan params error, error code = %x", rc);
283+
}
284+
return rc;
285+
}
286+
244287
#endif // SOC_BLE_50_SUPPORTED
245288

246289
/**

0 commit comments

Comments
 (0)