Skip to content

Commit 5242153

Browse files
committed
Make scan() default behavior similar to Apple CoreBluetooth API.
Change request: Sandeep/Arduino requires the scan() method to have similar behavior as the Apple CoreBluetooth API. Cod mods: 1. libraries/CurieBLE/src/BLEDevice.h: - Default the scan() to filter out redundent Peripherals.
1 parent 6b64ce3 commit 5242153

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

libraries/CurieBLE/src/BLEDevice.h

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,16 @@ class BLEDevice
365365
* Peripherals or just the newly detected.
366366
*
367367
* @param[in] withDuplicates true - return all detectable Peripherals.
368-
* false- return only new Peripherals.
368+
* false- return a detected Peripheral only once.
369369
*
370370
* @return none
371371
*
372-
* @note When, withDuplicates = true (default), accept all detectable Peripherals.
372+
* @note When, withDuplicates = true, accept all detectable Peripherals.
373373
* No Peripheral filtering process applied to the scan result.
374+
* By default, withDuplicates = false, a detected Peripheral is
375+
* reported once.
374376
*/
375-
void scan(bool withDuplicates = true);
377+
void scan(bool withDuplicates = false);
376378

377379
/**
378380
* @brief Start scanning for peripherals and filter by device name in ADV and
@@ -382,14 +384,16 @@ class BLEDevice
382384
* @param[in] name The device's local name.
383385
*
384386
* @param[in] withDuplicates true - return all detectable Peripherals.
385-
* false- return only new Peripherals.
387+
* false- return a detected Peripheral only once.
386388
*
387389
* @return none
388390
*
389-
* @note When, withDuplicates = true (default), accept all detectable Peripherals.
391+
* @note When, withDuplicates = true, accept all detectable Peripherals.
390392
* No Peripheral filtering process applied to the scan result.
393+
* By default, withDuplicates = false, a detected Peripheral is
394+
* reported once.
391395
*/
392-
void scanForName(String name, bool withDuplicates = true);
396+
void scanForName(String name, bool withDuplicates = false);
393397

394398
/**
395399
* @brief Start scanning for peripherals and filter by service in ADV and
@@ -399,14 +403,16 @@ class BLEDevice
399403
* @param[in] service The service
400404
*
401405
* @param[in] withDuplicates true - return all detectable Peripherals.
402-
* false- return only new Peripherals.
406+
* false- return a detected Peripheral only once.
403407
*
404408
* @return none
405409
*
406-
* @note When, withDuplicates = true (default), accept all detectable Peripherals.
407-
* No Peripheral filtering process applied to the scan result.
410+
* @note When, withDuplicates = true, accept all detectable Peripherals.
411+
* No Peripheral filtering process applied to the scan result.
412+
* By default, withDuplicates = false, a detected Peripheral is
413+
* reported once.
408414
*/
409-
void scanForUuid(String uuid, bool withDuplicates = true);
415+
void scanForUuid(String uuid, bool withDuplicates = false);
410416

411417
/**
412418
* @brief Start scanning for peripherals and filter by MAC address and
@@ -416,14 +422,16 @@ class BLEDevice
416422
* @param[in] macaddr The Peripheral MAC address
417423
*
418424
* @param[in] withDuplicates true - return all detectable Peripherals.
419-
* false- return only new Peripherals.
425+
* false- return a detected Peripheral only once.
420426
*
421427
* @return none
422428
*
423-
* @note When, withDuplicates = true (default), accept all detectable Peripherals.
424-
* No Peripheral filtering process applied to the scan result.
429+
* @note When, withDuplicates = true, accept all detectable Peripherals.
430+
* No Peripheral filtering process applied to the scan result.
431+
* By default, withDuplicates = false, a detected Peripheral is
432+
* reported once.
425433
*/
426-
void scanForAddress(String macaddr, bool withDuplicates = true);
434+
void scanForAddress(String macaddr, bool withDuplicates = false);
427435

428436
/**
429437
* @brief Stop scanning for peripherals
@@ -669,12 +677,12 @@ class BLEDevice
669677
* @brief Start scanning for peripherals with the option of accepting all
670678
* detectable Peripherals or just the newly detected.
671679
*
672-
* @param[in] withDuplicates true - with duplicate filter
673-
* false- without duplicate filter
680+
* @param[in] withDuplicates true - return all detectable Peripherals.
681+
* false- return a detected Peripheral only once.
674682
*
675683
* @return none
676684
*
677-
* @note When, withDuplicates = true (default), accept all detectable Peripherals.
685+
* @note When, withDuplicates = true, accept all detectable Peripherals.
678686
*/
679687
bool startScan(bool withDuplicates);
680688

0 commit comments

Comments
 (0)