From d485ada2a366ba392bf6781edf74632f0216cfc6 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Wed, 16 Oct 2024 11:41:13 +0100 Subject: [PATCH 1/3] Branch with no bluetooth name filter for testing --- lib/bluetooth.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/bluetooth.ts b/lib/bluetooth.ts index 342f20b..6f9b166 100644 --- a/lib/bluetooth.ts +++ b/lib/bluetooth.ts @@ -189,13 +189,7 @@ export class MicrobitWebBluetoothConnection // TODO: give control over this to the caller const result = await Promise.race([ navigator.bluetooth.requestDevice({ - filters: [ - { - namePrefix: this.nameFilter - ? `BBC micro:bit [${this.nameFilter}]` - : "BBC micro:bit", - }, - ], + filters: [], optionalServices: [ profile.accelerometer.id, profile.button.id, From 7959ae239f8d132782b5e21ecdfbd28090be2be9 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Wed, 16 Oct 2024 11:43:17 +0100 Subject: [PATCH 2/3] Lint --- lib/bluetooth.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/bluetooth.ts b/lib/bluetooth.ts index 6f9b166..214ae81 100644 --- a/lib/bluetooth.ts +++ b/lib/bluetooth.ts @@ -56,7 +56,6 @@ export class MicrobitWebBluetoothConnection this.availability = value; }; private availability: boolean | undefined; - private nameFilter: string | undefined; constructor(options: MicrobitWebBluetoothConnectionOptions = {}) { super(); @@ -175,9 +174,7 @@ export class MicrobitWebBluetoothConnection this.setStatus(ConnectionStatus.CONNECTED); } - setNameFilter(name: string) { - this.nameFilter = name; - } + setNameFilter(name: string) {} private async chooseDevice(): Promise { if (this.device) { From 741075082b4fdfea8074a6c7a224d47f27eaaf22 Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Wed, 16 Oct 2024 11:46:33 +0100 Subject: [PATCH 3/3] Try accept all devices --- lib/bluetooth.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bluetooth.ts b/lib/bluetooth.ts index 214ae81..cfced42 100644 --- a/lib/bluetooth.ts +++ b/lib/bluetooth.ts @@ -186,7 +186,7 @@ export class MicrobitWebBluetoothConnection // TODO: give control over this to the caller const result = await Promise.race([ navigator.bluetooth.requestDevice({ - filters: [], + acceptAllDevices: true, optionalServices: [ profile.accelerometer.id, profile.button.id,