Skip to content

Commit 18947bc

Browse files
authored
Merge pull request #1 from gunnarbeutner/ext-scan-type
Add a parameter to NimBLEScan::start() to specify whether we want to scan using the coded PHY
2 parents bb5c893 + 0ea1e79 commit 18947bc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/NimBLEScan.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ bool NimBLEScan::isScanning() {
307307
* @param [in] is_continue Set to true to save previous scan results, false to clear them.
308308
* @return True if scan started or false if there was an error.
309309
*/
310-
bool NimBLEScan::start(uint32_t duration, void (*scanCompleteCB)(NimBLEScanResults), bool is_continue) {
310+
bool NimBLEScan::start(uint32_t duration, void (*scanCompleteCB)(NimBLEScanResults), bool is_continue, bool uncoded_only) {
311311
NIMBLE_LOGD(LOG_TAG, ">> start: duration=%" PRIu32, duration);
312312

313313
// Save the callback to be invoked when the scan completes.
@@ -335,13 +335,13 @@ bool NimBLEScan::start(uint32_t duration, void (*scanCompleteCB)(NimBLEScanResul
335335
scan_params.itvl = m_scan_params.itvl;
336336
scan_params.window = m_scan_params.window;
337337
int rc = ble_gap_ext_disc(NimBLEDevice::m_own_addr_type,
338-
duration/10,
338+
duration == BLE_HS_FOREVER ? BLE_HS_FOREVER : duration/10,
339339
0,
340340
m_scan_params.filter_duplicates,
341341
m_scan_params.filter_policy,
342342
m_scan_params.limited,
343343
&scan_params,
344-
&scan_params,
344+
uncoded_only ? NULL : &scan_params,
345345
NimBLEScan::handleGapEvent,
346346
NULL);
347347
#else

src/NimBLEScan.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class NimBLEScanResults {
6262
*/
6363
class NimBLEScan {
6464
public:
65-
bool start(uint32_t duration, void (*scanCompleteCB)(NimBLEScanResults), bool is_continue = false);
65+
bool start(uint32_t duration, void (*scanCompleteCB)(NimBLEScanResults), bool is_continue = false, bool uncoded_only = false);
6666
NimBLEScanResults start(uint32_t duration, bool is_continue = false);
6767
bool isScanning();
6868
void setAdvertisedDeviceCallbacks(NimBLEAdvertisedDeviceCallbacks* pAdvertisedDeviceCallbacks, bool wantDuplicates = false);

0 commit comments

Comments
 (0)