Skip to content
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

AllowDuplicates option in scan function #460

Merged

Conversation

ezamagni
Copy link
Contributor

@ezamagni ezamagni commented Dec 3, 2019

This PR implements a new flag allowDuplicates in FlutterBlue.scan method.
The flag allows to specify whether or not the scan stream should continuously emit devices that were previously discovered.
This is equivalent to set the CBCentralManagerScanOptionAllowDuplicatesKey flag in iOS CBCentralManager and it is useful in those scenarios where you want to keep monitoring RSSI values during the scan phase.
This would also solve #35

An example of the intended use would be:

var _fblue = FlutterBlue.instance;
_fblue.scan(
  allowDuplicates: false,
  withServices: [
    Guid("00001826-0000-1000-8000-00805f9b34fb")
  ]
).listen((scanResult) {
  // ...
});

Please note that the default value of the flag is set to false, which is the most common use case of a BT scan procedure.

@pauldemarco pauldemarco self-assigned this Dec 3, 2019
Co-Authored-By: Maurits van Beusekom <maurits@baseflow.com>
@jasaw
Copy link

jasaw commented Feb 12, 2020

I've been running my app with this PR on multiple Android and iOS phones for 1 month now. Works great. Hope this gets merged in soon.

@ezamagni
Copy link
Contributor Author

I manually solved the conflicts in flutterblue.pb.dart but I suggest to rerun the protobuf generation process before merging this.
Unfortunately I don't have all the protobuf stuff set up in my machine.

@pauldemarco pauldemarco merged commit 453dc5a into pauldemarco:master Apr 20, 2020
@ezamagni ezamagni deleted the feature-scan-allow_duplicates branch April 20, 2020 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants