Skip to content

Commit f4d5470

Browse files
committed
Try to adopt to chromium bug
1 parent 06169b4 commit f4d5470

1 file changed

Lines changed: 12 additions & 34 deletions

File tree

www/ec/code.js

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -513,40 +513,18 @@ Code.connect = function(run) {
513513
Code.server = undefined;
514514
Code.service = undefined;
515515

516-
// this will not find the fischertechnik controllers by name
517-
// see https://stackoverflow.com/questions/72903299/howto-filter-for-uuid-or-name-in-web-bluetooth
518-
let requestParms = { filters: [
519-
{ services: ['0000ffe0-0000-1000-8000-00805f9b34fb' ] },
520-
{ services: ['7b130100-ce8d-45bb-9158-631b769139e9'] },
521-
{ name: 'BT Control Receiver'},
522-
{ name: 'BT Smart Controller'}
523-
] };
524-
525-
if (navigator.userAgentData) {
526-
let vendors = window.navigator.userAgentData.brands;
527-
528-
// let vstr = "";
529-
// for(let i=0;i<vendors.length;i++)
530-
// vstr += String(vendors[i].brand) + ", "
531-
// alert(vstr);
532-
533-
// chromium but neither chrome nor edge -> workaround for name detection
534-
if ((vendors.filter(e => e.brand === 'Chromium').length > 0) &&
535-
(vendors.filter(e => e.brand === 'Google Chrome').length == 0) &&
536-
(vendors.filter(e => e.brand === 'Microsoft Edge').length == 0) ) {
537-
538-
requestParms = { acceptAllDevices: true };
539-
}
540-
}
541-
542-
navigator.bluetooth.requestDevice(
543-
Object.assign({}, requestParms, {
544-
optionalServices: [
545-
'7b130100-ce8d-45bb-9158-631b769139e9', // ft robby
546-
'0000ffe0-0000-1000-8000-00805f9b34fb', // hm-10
547-
'8ae883b4-ad7d-11e6-80f5-76304dec7eb7', // BT Smart Controller
548-
'2e58327e-c5c5-11e6-9d9d-cec0c932ce01' ] // BT Control Receiver
549-
})).then(device => {
516+
navigator.bluetooth.requestDevice( {
517+
filters: [
518+
{ services: ['0000ffe0-0000-1000-8000-00805f9b34fb' ] },
519+
{ services: ['7b130100-ce8d-45bb-9158-631b769139e9'] },
520+
{ name: 'BT Control Receiver'},
521+
{ name: 'BT Smart Controller'} ],
522+
optionalServices: [
523+
'7b130100-ce8d-45bb-9158-631b769139e9', // ft robby
524+
'0000ffe0-0000-1000-8000-00805f9b34fb', // hm-10
525+
'8ae883b4-ad7d-11e6-80f5-76304dec7eb7', // BT Smart Controller
526+
'2e58327e-c5c5-11e6-9d9d-cec0c932ce01' ] // BT Control Receiver
527+
} ).then(device => {
550528
console.log("Device",device, "found. Connecting ...");
551529
Code.device = device;
552530
device.addEventListener('gattserverdisconnected', Code.onDisconnected);

0 commit comments

Comments
 (0)