Thanks for the link to the issue tracker. So to summarize, reconnecting to already paired devices should be supported in Chrome when using chrome://flags/#enable-web-bluetooth-new-permissions-backend and chrome://flags/#enable-experimental-web-platform-features and this code:
async function getPermittedBluetoothDevices() {
let devices = await navigator.bluetooth.getDevices();
for (let device of devices) {
// Start a scan for each device before connecting to check that they're in
// range.
let abortController = new AbortController();
await device.watchAdvertisements({signal: abortController.signal});
device.addEventListener('advertisementreceived', async (evt) => {
// Stop the scan to conserve power on mobile devices.
abortController.abort();
// At this point, we know that the device is in range, and we can attempt
// to connect to it.
await evt.device.gatt.connect();
});
}
}
However, at least on Linux and macOS, the event advertisementreceived is never triggered. Is that an issue with Chrome, the OS or the device? Looks like .watchAdvertisement is supposed to trigger advertisement packages but it doesn't on Linux/macOS?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks for the link to the issue tracker. So to summarize, reconnecting to already paired devices should be supported in Chrome when using
chrome://flags/#enable-web-bluetooth-new-permissions-backend
andchrome://flags/#enable-experimental-web-platform-features
and this code:However, at least on Linux and macOS, the event
advertisementreceived
is never triggered. Is that an issue with Chrome, the OS or the device? Looks like.watchAdvertisement
is supposed to trigger advertisement packages but it doesn't on Linux/macOS?