From d362a3fb883bf3419d326d4c8c1dc9478e5a7187 Mon Sep 17 00:00:00 2001 From: Vincent Scheib Date: Thu, 12 Jan 2017 11:33:02 -0800 Subject: [PATCH 1/2] Use requestDevice({ acceptAllDevices:true }). The hack 'anyDeviceFilter' is no longer necessary now that request device supports acceptAllDevices. --- bluetooth-rename/index.html | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/bluetooth-rename/index.html b/bluetooth-rename/index.html index bc8a85c..231babe 100644 --- a/bluetooth-rename/index.html +++ b/bluetooth-rename/index.html @@ -144,14 +144,6 @@

Done!

writeNameButton.disabled = false; } - function anyDeviceFilter() { - // This is the closest we can get for now to get all devices. - // https://github.com/WebBluetoothCG/web-bluetooth/issues/234 - return Array.from('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') - .map(c => ({namePrefix: c})) - .concat({name: ''}); - } - connectButton.addEventListener('click', function () { progress.hidden = false; disableInput(); @@ -161,7 +153,7 @@

Done!

throw "No Web Bluetooth support."; return navigator.bluetooth.requestDevice({ - filters: anyDeviceFilter(), + acceptAllDevices:true, optionalServices: ['generic_access'] }) }) From b8abbcb8e4921debe35e9849290f950f388921a2 Mon Sep 17 00:00:00 2001 From: Vincent Scheib Date: Thu, 19 Jan 2017 14:15:42 -0800 Subject: [PATCH 2/2] Comment acceptAllDevices with filters alternative. --- bluetooth-rename/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/bluetooth-rename/index.html b/bluetooth-rename/index.html index 231babe..5cfe535 100644 --- a/bluetooth-rename/index.html +++ b/bluetooth-rename/index.html @@ -153,6 +153,7 @@

Done!

throw "No Web Bluetooth support."; return navigator.bluetooth.requestDevice({ + // filters: [...] <- Prefer filters to save energy & show relevant devices. acceptAllDevices:true, optionalServices: ['generic_access'] })