Skip to content

Jira 896, BLE scan withDuplicates logic inversion, git 476 #491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2017

Conversation

SidLeung
Copy link
Contributor

Bug fixed:
This feature was implemented in PR #457, merged, and released
in Deneb.RC1. However, it was discovered that the logic was
inverted and was report as Git issue #476. BLE scan() and
input parameter withDuplicates is true means reporting all
Peripherals detected regardless how many times it was reported.

Code mods:

  1. libraries/CurieBLE/src/BLEDevice.cpp:
    • In startScan, calls the correct routine to scan for all
      Peripherals if withDuplicates is true. Otherwise,
      just scan for new ones.
  2. libraries/CurieBLE/src/BLEDevice.h:
    • Prototyping.
  3. libraries/CurieBLE/src/internal/BLEDeviceManager.h,
    libraries/CurieBLE/src/internal/BLEDeviceManager.cpp
    • Modified header comment to reflect the input parameter
      withDuplictes correct meaning.
    • Default the input parameter, withDupilcates, as true.
    • And, consequently, eliminated some redundant methods.

@SidLeung SidLeung self-assigned this Mar 22, 2017
@SidLeung SidLeung added this to the Deneb milestone Mar 22, 2017
@SidLeung
Copy link
Contributor Author

@sgbihu @bigdinotech @eriknyquist , please review the code change.

@russmcinnis @noelpaz , please perform system testing.

@@ -576,10 +574,32 @@ BLEDevice BLEDeviceManager::peripheral()
return temp;
}

bool BLEDeviceManager::startScanning()
void BLEDeviceManager::_clearAdvertiseBuffer()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BLEDeviceManager.* doesn't need change. Those changes are for scan response. Jira876.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how this get in here... Need to investigate my source...

@SidLeung
Copy link
Contributor Author

@sgbihu @bigdinotech @eriknyquist @russmcinnis @noelpaz

The initial commit was done incorrectly. The committed code contained mods for another ticket (Jira 876). The issue was corrected. Please use the latest commit, 6b64ce3, for code review and system testing.

*/
void scanForName(String name);
void scan(bool withDuplicates = true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SidLeung could we please change the withDuplicates default arg to false here.

Remember the overall goal is to have something similar to the Apple CoreBluetooth API: https://developer.apple.com/reference/corebluetooth/cbcentralmanager/1518986-scanforperipherals

which by default doesn't allow duplicates: https://developer.apple.com/reference/corebluetooth/cbcentralmanagerscanoptionallowduplicateskey

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I read the apple's parameter description, I found the duplicated object is ADV packets. Our implementation is duplicate filter. So I suggest rename the withDuplicates as allowDuplicatePackets to make the parameter easy to be understood.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @SidLeung,
What's your idea?

*/
void scanForName(String name, bool withDuplicates);
void scanForName(String name, bool withDuplicates = true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, please change the default value for withDuplicates to false.

*/
void scanForUuid(String uuid);
void scanForUuid(String uuid, bool withDuplicates = true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, please change the default value for withDuplicates to false.

*/
void scanForUuid(String uuid, bool withDuplicates);

void scanForAddress(String macaddr, bool withDuplicates = true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, please change the default value for withDuplicates to false.

@SidLeung
Copy link
Contributor Author

Made the default behavior of scan() to report a detected Peripheral once.

@sandeepmistry @sgbihu @eriknyquist @bigdinotech

Please review the latest code change, 5242153.

@russmcinnis @noelpaz , please make sure the above commit is used for system testing.

Thanks.

Copy link
Contributor

@bigdinotech bigdinotech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Commit error:
  Committed files contained code mods for another ticket in
addition to the those for Jira 896.
@SidLeung SidLeung merged commit 82eb1be into arduino:master Mar 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants