Skip to content

Commit 82eb1be

Browse files
committed
Jira 896, merged to 01org/master
Commit error: Committed files contained code mods for another ticket in addition to the those for Jira 896.
1 parent 98c1746 commit 82eb1be

File tree

4 files changed

+54
-75
lines changed

4 files changed

+54
-75
lines changed

libraries/CurieBLE/src/BLEDevice.cpp

+1-17
Original file line numberDiff line numberDiff line change
@@ -247,38 +247,22 @@ bool BLEDevice::startScan(bool withDuplicates)
247247
}
248248
else
249249
{
250-
return BLEDeviceManager::instance()->startScanning();
250+
return BLEDeviceManager::instance()->startScanningNewPeripherals();
251251
}
252252
}
253253

254-
255-
void BLEDevice::scan()
256-
{
257-
scan(false);
258-
}
259-
260254
void BLEDevice::scan(bool withDuplicates)
261255
{
262256
BLEDeviceManager::instance()->clearAdvertiseCritical();
263257
startScan(withDuplicates);
264258
}
265259

266-
void BLEDevice::scanForName(String name)
267-
{
268-
scanForName(name, false);
269-
}
270-
271260
void BLEDevice::scanForName(String name, bool withDuplicates)
272261
{
273262
BLEDeviceManager::instance()->setAdvertiseCritical(name);
274263
startScan(withDuplicates);
275264
}
276265

277-
void BLEDevice::scanForUuid(String uuid)
278-
{
279-
scanForUuid(uuid, false);
280-
}
281-
282266
void BLEDevice::scanForUuid(String uuid, bool withDuplicates)
283267
{
284268
BLEService service_temp(uuid.c_str());

libraries/CurieBLE/src/BLEDevice.h

+48-53
Original file line numberDiff line numberDiff line change
@@ -361,83 +361,78 @@ class BLEDevice
361361
//void scanForAddress(String address); // Not include in baseline. Add here as feature for feature release.
362362

363363
/**
364-
* @brief Start scanning for peripherals without filter
364+
* @brief Start scanning for peripherals with the option of accepting all detectable
365+
* Peripherals or just the newly detected.
365366
*
366-
* @param none
367-
*
368-
* @return none
369-
*
370-
* @note none
371-
*/
372-
void scan();
373-
374-
/**
375-
* @brief Start scanning for peripherals with filter
376-
*
377-
* @param[in] withDuplicates true - with duplicate filter
378-
* false- without duplicate filter
379-
*
380-
* @return none
381-
*
382-
* @note option to filter out duplicate addresses for Arduino.
383-
* The current only support fileter duplicate mode.
384-
*/
385-
void scan(bool withDuplicates);
386-
387-
/**
388-
* @brief Start scanning for peripherals and filter by device name in ADV
389-
*
390-
* @param name The device's local name.
367+
* @param[in] withDuplicates true - return all detectable Peripherals.
368+
* false- return a detected Peripheral only once.
391369
*
392370
* @return none
393371
*
394-
* @note option to filter out duplicate addresses for Arduino.
395-
* The current only support fileter duplicate mode.
372+
* @note When, withDuplicates = true, accept all detectable Peripherals.
373+
* No Peripheral filtering process applied to the scan result.
374+
* By default, withDuplicates = false, a detected Peripheral is
375+
* reported once.
396376
*/
397-
void scanForName(String name);
377+
void scan(bool withDuplicates = false);
398378

399379
/**
400-
* @brief Start scanning for peripherals and filter by device name in ADV
380+
* @brief Start scanning for peripherals and filter by device name in ADV and
381+
* the option of accepting all detectable Peripherals or just the
382+
* newly detected.
401383
*
402384
* @param[in] name The device's local name.
403385
*
404-
* @param[in] withDuplicates true - with duplicate filter
405-
* false- without duplicate filter
386+
* @param[in] withDuplicates true - return all detectable Peripherals.
387+
* false- return a detected Peripheral only once.
406388
*
407389
* @return none
408390
*
409-
* @note option to filter out duplicate addresses for Arduino.
410-
* The current only support fileter duplicate mode.
391+
* @note When, withDuplicates = true, accept all detectable Peripherals.
392+
* No Peripheral filtering process applied to the scan result.
393+
* By default, withDuplicates = false, a detected Peripheral is
394+
* reported once.
411395
*/
412-
void scanForName(String name, bool withDuplicates);
396+
void scanForName(String name, bool withDuplicates = false);
413397

414398
/**
415-
* @brief Start scanning for peripherals and filter by service in ADV
399+
* @brief Start scanning for peripherals and filter by service in ADV and
400+
* the option of accepting all detectable Peripherals or just the
401+
* newly detected.
416402
*
417-
* @param service The service
403+
* @param[in] service The service
404+
*
405+
* @param[in] withDuplicates true - return all detectable Peripherals.
406+
* false- return a detected Peripheral only once.
418407
*
419408
* @return none
420409
*
421-
* @note none
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.
422414
*/
423-
void scanForUuid(String uuid);
415+
void scanForUuid(String uuid, bool withDuplicates = false);
424416

425417
/**
426-
* @brief Start scanning for peripherals and filter by service in ADV
418+
* @brief Start scanning for peripherals and filter by MAC address and
419+
* the option of accepting all detectable Peripherals or just the
420+
* newly detected.
427421
*
428-
* @param[in] service The service
422+
* @param[in] macaddr The Peripheral MAC address
429423
*
430-
* @param[in] withDuplicates true - with duplicate filter
431-
* false- without duplicate filter
424+
* @param[in] withDuplicates true - return all detectable Peripherals.
425+
* false- return a detected Peripheral only once.
432426
*
433427
* @return none
434428
*
435-
* @note option to filter out duplicate addresses for Arduino.
436-
* The current only support fileter duplicate mode.
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.
437433
*/
438-
void scanForUuid(String uuid, bool withDuplicates);
439-
440-
void scanForAddress(String macaddr, bool withDuplicates = true);
434+
void scanForAddress(String macaddr, bool withDuplicates = false);
435+
441436
/**
442437
* @brief Stop scanning for peripherals
443438
*
@@ -679,15 +674,15 @@ class BLEDevice
679674
void preCheckProfile();
680675

681676
/**
682-
* @brief Start scanning for peripherals with/without duplicate filter
677+
* @brief Start scanning for peripherals with the option of accepting all
678+
* detectable Peripherals or just the newly detected.
683679
*
684-
* @param[in] withDuplicates true - with duplicate filter
685-
* false- without duplicate filter
680+
* @param[in] withDuplicates true - return all detectable Peripherals.
681+
* false- return a detected Peripheral only once.
686682
*
687683
* @return none
688684
*
689-
* @note option to filter out duplicate addresses for Arduino.
690-
* The current only support fileter duplicate mode.
685+
* @note When, withDuplicates = true, accept all detectable Peripherals.
691686
*/
692687
bool startScan(bool withDuplicates);
693688

libraries/CurieBLE/src/internal/BLEDeviceManager.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ void BLEDeviceManager::_clearAdvertiseBuffer()
593593

594594
}
595595

596-
bool BLEDeviceManager::startScanning()
596+
bool BLEDeviceManager::startScanningWithDuplicates()
597597
{
598598
_adv_duplicate_filter_enabled = false;
599599
_scan_param.filter_dup = BT_HCI_LE_SCAN_FILTER_DUP_ENABLE;
@@ -609,7 +609,7 @@ bool BLEDeviceManager::startScanning()
609609
return true;
610610
}
611611

612-
bool BLEDeviceManager::startScanningWithDuplicates()
612+
bool BLEDeviceManager::startScanningNewPeripherals()
613613
{
614614
_adv_duplicate_filter_enabled = true;
615615
memset(_peer_duplicate_address_buffer, 0, sizeof(_peer_duplicate_address_buffer));
@@ -1096,8 +1096,8 @@ bool BLEDeviceManager::connect(BLEDevice &device)
10961096
_wait_for_connect_peripheral_adv_data_len = _available_for_connect_peripheral_adv_data_len;
10971097
_wait_for_connect_peripheral_scan_rsp_data_len = _available_for_connect_peripheral_scan_rsp_data_len;
10981098
_wait_for_connect_peripheral_adv_rssi = _available_for_connect_peripheral_adv_rssi;
1099-
1100-
startScanning();
1099+
1100+
startScanningWithDuplicates();
11011101

11021102
pr_debug(LOG_MODULE_BLE, "%s-%d", __FUNCTION__, __LINE__);
11031103
// Wait for the connection

libraries/CurieBLE/src/internal/BLEDeviceManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ class BLEDeviceManager
310310
void setAdvertiseCritical(String name);
311311
void setAdvertiseCritical(BLEService& service);
312312
void setAdvertiseCritical(const char* macaddress);
313-
bool startScanning(); // start scanning for peripherals
313+
bool startScanningNewPeripherals(); // start scanning for new peripherals, don't report the detected ones
314314
bool startScanningWithDuplicates(); // start scanning for peripherals, and report all duplicates
315315
bool stopScanning(); // stop scanning for peripherals
316316

0 commit comments

Comments
 (0)