[web-bluetooth] requestDevice filters to exclude devices. (#599)

scheib has just created a new issue for https://github.com/WebBluetoothCG/web-bluetooth:

== requestDevice filters to exclude devices. ==
Application developers may wish to filter OUT devices they know are not the correct ones.  "I have an array with the names of some devices I don't want to get when I do navigator.bluetooth.requestDevice" - [requested on Stack Overflow](https://stackoverflow.com/questions/75815353).

It would be reasonable to see filters that can exclude, such as by adding an `excludeFilters` the request call:
```
navigator.bluetooth.requestDevice({
  filters: [{services: [A, B]}],
  excludeFilters: [
    {namePrefix: "Unwanted"},
    {name: "Unique Name"},
    {name: "Unique Name2"},
  ]
})
```

Which, given many devices discovered:
| Device | Device Name | Device Services |
|-----------|---------------------|----------------------- |
| D1 | \<none> | A |
| D2 | \<none> | A, B |
| D3 | "Unwanted thing" | A, B |
| D4 | "Unique Name2" | A, B |
| D5 | "Unique Name3" | A, B |

Would present only `D2` and `D5` to the user in the chooser to select.


Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/599 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 23 March 2023 20:25:23 UTC