Skip to content

Commit 6b64ce3

Browse files
committed
Correct previous commit error for Jira 896
Commit error: Committed files contained code mods for another ticket in addition to the those for Jira 896.
1 parent 6b33e73 commit 6b64ce3

File tree

4 files changed

+48
-72
lines changed

4 files changed

+48
-72
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

+37-50
Original file line numberDiff line numberDiff line change
@@ -361,83 +361,70 @@ 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 only new Peripherals.
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 (default), accept all detectable Peripherals.
373+
* No Peripheral filtering process applied to the scan result.
396374
*/
397-
void scanForName(String name);
375+
void scan(bool withDuplicates = true);
398376

399377
/**
400-
* @brief Start scanning for peripherals and filter by device name in ADV
378+
* @brief Start scanning for peripherals and filter by device name in ADV and
379+
* the option of accepting all detectable Peripherals or just the
380+
* newly detected.
401381
*
402382
* @param[in] name The device's local name.
403383
*
404-
* @param[in] withDuplicates true - with duplicate filter
405-
* false- without duplicate filter
384+
* @param[in] withDuplicates true - return all detectable Peripherals.
385+
* false- return only new Peripherals.
406386
*
407387
* @return none
408388
*
409-
* @note option to filter out duplicate addresses for Arduino.
410-
* The current only support fileter duplicate mode.
389+
* @note When, withDuplicates = true (default), accept all detectable Peripherals.
390+
* No Peripheral filtering process applied to the scan result.
411391
*/
412-
void scanForName(String name, bool withDuplicates);
392+
void scanForName(String name, bool withDuplicates = true);
413393

414394
/**
415-
* @brief Start scanning for peripherals and filter by service in ADV
395+
* @brief Start scanning for peripherals and filter by service in ADV and
396+
* the option of accepting all detectable Peripherals or just the
397+
* newly detected.
416398
*
417-
* @param service The service
399+
* @param[in] service The service
400+
*
401+
* @param[in] withDuplicates true - return all detectable Peripherals.
402+
* false- return only new Peripherals.
418403
*
419404
* @return none
420405
*
421-
* @note none
406+
* @note When, withDuplicates = true (default), accept all detectable Peripherals.
407+
* No Peripheral filtering process applied to the scan result.
422408
*/
423-
void scanForUuid(String uuid);
409+
void scanForUuid(String uuid, bool withDuplicates = true);
424410

425411
/**
426-
* @brief Start scanning for peripherals and filter by service in ADV
412+
* @brief Start scanning for peripherals and filter by MAC address and
413+
* the option of accepting all detectable Peripherals or just the
414+
* newly detected.
427415
*
428-
* @param[in] service The service
416+
* @param[in] macaddr The Peripheral MAC address
429417
*
430-
* @param[in] withDuplicates true - with duplicate filter
431-
* false- without duplicate filter
418+
* @param[in] withDuplicates true - return all detectable Peripherals.
419+
* false- return only new Peripherals.
432420
*
433421
* @return none
434422
*
435-
* @note option to filter out duplicate addresses for Arduino.
436-
* The current only support fileter duplicate mode.
423+
* @note When, withDuplicates = true (default), accept all detectable Peripherals.
424+
* No Peripheral filtering process applied to the scan result.
437425
*/
438-
void scanForUuid(String uuid, bool withDuplicates);
439-
440426
void scanForAddress(String macaddr, bool withDuplicates = true);
427+
441428
/**
442429
* @brief Stop scanning for peripherals
443430
*
@@ -679,15 +666,15 @@ class BLEDevice
679666
void preCheckProfile();
680667

681668
/**
682-
* @brief Start scanning for peripherals with/without duplicate filter
669+
* @brief Start scanning for peripherals with the option of accepting all
670+
* detectable Peripherals or just the newly detected.
683671
*
684672
* @param[in] withDuplicates true - with duplicate filter
685673
* false- without duplicate filter
686674
*
687675
* @return none
688676
*
689-
* @note option to filter out duplicate addresses for Arduino.
690-
* The current only support fileter duplicate mode.
677+
* @note When, withDuplicates = true (default), accept all detectable Peripherals.
691678
*/
692679
bool startScan(bool withDuplicates);
693680

libraries/CurieBLE/src/internal/BLEDeviceManager.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,13 @@ BLEDevice BLEDeviceManager::peripheral()
576576
return temp;
577577
}
578578

579-
bool BLEDeviceManager::startScanning()
579+
bool BLEDeviceManager::startScanningWithDuplicates()
580580
{
581581
_adv_duplicate_filter_enabled = false;
582582
_scan_param.filter_dup = BT_HCI_LE_SCAN_FILTER_DUP_ENABLE;
583+
584+
_clearAdvertiseBuffer();
585+
583586
int err = bt_le_scan_start(&_scan_param, ble_central_device_found);
584587
if (err)
585588
{
@@ -589,11 +592,13 @@ bool BLEDeviceManager::startScanning()
589592
return true;
590593
}
591594

592-
bool BLEDeviceManager::startScanningWithDuplicates()
595+
bool BLEDeviceManager::startScanningNewPeripherals()
593596
{
594597
_adv_duplicate_filter_enabled = true;
595598
memset(_peer_duplicate_address_buffer, 0, sizeof(_peer_duplicate_address_buffer));
596599
_duplicate_filter_header = _duplicate_filter_tail = 0;
600+
601+
_clearAdvertiseBuffer();
597602

598603
_scan_param.filter_dup = BT_HCI_LE_SCAN_FILTER_DUP_ENABLE;
599604
int err = bt_le_scan_start(&_scan_param, ble_central_device_found);
@@ -1074,8 +1079,8 @@ bool BLEDeviceManager::connect(BLEDevice &device)
10741079
_wait_for_connect_peripheral_adv_data_len = _available_for_connect_peripheral_adv_data_len;
10751080
_wait_for_connect_peripheral_scan_rsp_data_len = _available_for_connect_peripheral_scan_rsp_data_len;
10761081
_wait_for_connect_peripheral_adv_rssi = _available_for_connect_peripheral_adv_rssi;
1077-
1078-
startScanning();
1082+
1083+
startScanningWithDuplicates();
10791084

10801085
pr_debug(LOG_MODULE_BLE, "%s-%d", __FUNCTION__, __LINE__);
10811086
// 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)