Skip to content

How to Apply filter to RequestDeviceAsync(new RequestDeviceOptions{...} ) #371

Answered by peterfoot
JimWolfCo asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, the implementation of filters is not fully there yet on all platforms - only Windows processes the filter uuids currently. However the Filters property is read-only because it is a collection which you can add multiple filters to - it's a bit odd looking because each filter can specify a name or name prefix as well as one or more services - it follows the WebBluetooth standard. For a simple required service you would do something like:-

var filter = new BluetoothLEScanFilter();
filter.Services.Add(GattServiceUuids.AlertNotification);
var options = new RequestDeviceOptions();
options.Filters.Add(filter);
var device = await Bluetooth.RequestDeviceAsync(options);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by peterfoot
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants