Warm tip: This article is reproduced from serverfault.com, please click

Web Bluetooth API get list of all available device nearby

发布于 2018-06-21 09:25:07

I am looking for an API call that could be used to retrieve all the Bluetooth devices near me. These samples Web Bluetooth talk about getting different characteristics from a single Bluetooth device, however I couldn't find any example which retrieves all the Bluetooth devices(like available bluetooth devices list on windows native Bluetooth app). Is it even supported?

Questioner
raks
Viewed
0
noogui 2018-06-22 16:30:52

I personally haven't experimented with Web Bluetooth API a lot, but I think you're looking for Device Discovery and Request Bluetooth Devices:

This version of the Web Bluetooth API specification allows websites, running in the Central role, to connect to remote GATT Servers over a BLE connection. It supports communication among devices that implement Bluetooth 4.0 or later.

When a website requests access to nearby devices using navigator.bluetooth.requestDevice, Google Chrome will prompt user with a device chooser where they can pick one device or simply cancel the request.

The navigator.bluetooth.requestDevice function takes a mandatory Object that defines filters. These filters are used to return only devices that match some advertised Bluetooth GATT services and/or the device name.

Also, here's the list of GATT Services.