1

I am using Web Bluetooth to connect to a device and read the name and battery level. I got it working but the device I want to connect with is "Unknown or unsupported" but I have no idea why. On requestDevice() I only get my Iphone and a lot of unknown devices.

When I check the bluetooth devices on chrome://bluetooth-internals I see a few known devices but not the one I am looking for. I have to guess the right device based on the latest RSSI. This is not user friendly.

Is there a way to fix this? Or can someone explain why almost all the devices are unknown or unsupported.

I am using a Mac. (Incase this matters)

UPDATE @François Beaufort
enter image description here A screenshot of the nRF Connect app. In the app the device has a name. I just saw that the device had a name in bluetooth-internals too, but it seems like it doesn't advertise its name always.

And it says Device type: Google but it isn't a device from Google.

joey
  • 227
  • 3
  • 18
  • If you use a generic Bluetooth Low Energy scanning and exploration tool like [nRF Connect](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Connect-for-mobile) does the device show up? You don't say what the device is you are trying to find. Is it [advertising](https://www.bluetooth.com/specifications/assigned-numbers/generic-access-profile/) its `local name`? Is it a BLE device? – ukBaz May 15 '21 at 05:26
  • @ukBaz It doesn't show up on nRF Connect. I want to connect with Earbuds with BLE. How can I check if it is advertising its local name? I don't think it is adveritsing anything. – joey May 15 '21 at 13:33

1 Answers1

2

The name you're seeing in the bluetooth browser chooser is the human-readable name of the bluetooth device. A bluetooth device may have two different name types: one that the bluetooth device advertises and another that the bluetooth device publishes in its database as its Bluetooth low energy Generic Access Profile (GAP) device name. If a bluetooth device has both types of names, you'll get the GAP device name.

If you're seeing "Unknown or Unsupported Device (12:34:56:78:9A:BC)", it means the bluetooth device didn't advertise its name. In order to reduce the noise in the bluetooth chooser, I'd recommend using other filters such as "services" if you notice your bluetooth device advertises some. See full developer documentation at https://web.dev/bluetooth/#services-filter

navigator.bluetooth.requestDevice({ filters: [{ services: ['battery_service'] }] })
.then(device => { /* … */ })
.catch(error => { console.error(error); });

Update: You can see advertised services at chrome://bluetooth-internals/#devices in the "Services" column in Chrome 93. See https://chromiumdash.appspot.com/commit/49610d372d4d479f43e918d7bbf14537efd2769c

François Beaufort
  • 4,843
  • 3
  • 29
  • 38
  • Thanks! But the column `Services` on the `chrome://bluetooth-internals/#devices` page is empty for all the devices in the list. It is for all `Unknown`. Does that mean the device doesn't advertise any services? When I connect with the device, it has 5 services available. – joey May 18 '21 at 07:27
  • Yes. It means your Bluetooth nearby devices don't advertise services sadly. Can you share a screenshot of the NRFConnect app that scans the Bluetooth device you're interested in? I wonder if there are other filters you could use to get it. See https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp&hl=en – François Beaufort May 18 '21 at 08:00
  • I updated the question with a screenshot. – joey May 18 '21 at 08:26
  • It seems like a service UUID is advertised for this device `0xFE61`. Would `navigator.bluetooth.requestDevice({ filters: [{ services: [0xFE61] }] })` work for you? If not, you may want to use manufacturer data filter (available in Chrome 92 - https://chrome.com/canary) with something like `navigator.bluetooth.requestDevice({ filters: [{ manufacturerData: [{ companyIdentifier: 0x01DA }] }] })`. See https://stackoverflow.com/questions/67020600/web-bluetooth-want-to-filter-on-manufacturer-data-when-using-navigator-bluetoot/67566056#67566056 – François Beaufort May 18 '21 at 08:43
  • The filter on the services works! Thanks! – joey May 18 '21 at 10:54
  • I do think advertised and service UUIDs should be displayed in `about:bluetooth-internals`. They're not today sadly which is a pain as you've seen. You can star https://crbug.com/1210506 to keep track of the progress. – François Beaufort May 18 '21 at 14:53