Skip to content

Commit

Permalink
changed filter
Browse files Browse the repository at this point in the history
  • Loading branch information
puttley committed Apr 11, 2024
1 parent 3b5dab7 commit 7c3b067
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bt.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ function onDevice() {
});
}

// Array of names to filter for
var namesToFilterFor = ['SEEKER', 'ESP32', 'MPY'];
// Create an array of filters for each name
var filterr = namesToFilterFor.map(name => ({ namePrefix: name }));

async function connect() {
if (device && device.gatt.connected) {
Expand All @@ -126,9 +130,9 @@ async function connect() {
}
navigator.bluetooth.requestDevice({

//filters:[{namePrefix: [DEVICE_BT_NAME_PREFIX]},],
filters: filterr,

acceptAllDevices:true,
// acceptAllDevices:true,
optionalServices: [NUS_SERVICE_UUID]

}).then(onScanResult).catch(function(e) {
Expand Down

0 comments on commit 7c3b067

Please sign in to comment.