webbluetooth icon indicating copy to clipboard operation
webbluetooth copied to clipboard

getDevices() does not resolve device names when called with allowAllDevices: true

Open chdh opened this issue 9 months ago • 4 comments

When I call bluetooth.getDevices() with options.allowAllDevices: true, the device names are not retrieved:

Found device: Unknown or Unsupported Device (7f:6c:f3:b7:88:e9)
Found device: Unknown or Unsupported Device (7a:25:30:8c:e2:71)
Found device: Unknown or Unsupported Device (56:eb:35:12:42:40)
Found device: Unknown or Unsupported Device (cb:51:ab:53:8d:fa)
Found device: Unknown or Unsupported Device (d2:00:05:0c:f2:1c)

When I setallowAllDevices to false, getDevices() does not return any devices because the allowedDevices set is empty in bluetooth.ts. The only place where allowedDevices is filled is in the promise completion routine of requestDevice(). (This explains #242)

But when I first call requestDevice({acceptAllDevices: true}) before calling bluetooth.getDevices() with options.allowAllDevices: true, the name of the device that was previously returned by requestDevice() is retrieved in the list returned by bluetooth.getDevices().

testCase.zip

chdh avatar May 15 '25 01:05 chdh