- From: Zhangrui via GitHub <sysbot+gh@w3.org>
- Date: Wed, 19 Jul 2017 08:41:33 +0000
- To: public-web-bluetooth-log@w3.org
https://github.com/a-kitchen/a-kitchen.github.io It's been added to 'optionalServices' or it's a mistake let options = { optionalServices:['00000000-0000-1000-8000-00805f9b34fb'], optionalServices:['00000001-0000-1000-8000-00805f9b34fb'], optionalServices:['00000002-0000-1000-8000-00805f9b34fb'], optionalServices:['00000003-0000-1000-8000-00805f9b34fb'], }; ------------------ Original ------------------ From: "François Beaufort"<notifications@github.com>; Date: Wed, Jul 19, 2017 03:37 PM To: "WebBluetoothCG/web-bluetooth"<web-bluetooth@noreply.github.com>; Cc: "Zhangrui"<brave.z@a.kitchen>; "Mention"<mention@noreply.github.com>; Subject: Re: [WebBluetoothCG/web-bluetooth] errorSecurityError: Origin is notallowed to access the service. Tip: Add the service UUID to 'optionalServices'in requestDevice() options. https://goo.gl/HxfxSQ (#370) You had a typo in optionalServices. See below: function search() { document.getElementById("demo").innerHTML = "My First JavaScript"; let options = { - optionalServices: ['00000003-0000-1000-8000-00805f9b34fb'] + optionalServices: ['00000000-0000-1000-8000-00805f9b34fb'] }; let filters = []; let filterName = document.querySelector('#name').value; if (filterName) { filters.push({ name: filterName }); options.filters = filters; } else { options.acceptAllDevices = true; } navigator.bluetooth.requestDevice(options).then(device => { return device.gatt.connect(); }).then(server => { document.getElementById("service").innerHTML = "trurservcice"; return server.getPrimaryService('00000000-0000-1000-8000-00805f9b34fb'); }).then(service => { return Promise.all([ service.getCharacteristic('00000002-0000-1000-8000-00805f9b34fb'), service.getCharacteristic('00000003-0000-1000-8000-00805f9b34fb').then(read) ]); }).catch(error => { document.getElementById("demo").innerHTML = "error" + error; }); } — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread. -- GitHub Notification of comment by brave2016 Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/370#issuecomment-316315386 using your GitHub account
Received on Wednesday, 19 July 2017 08:41:39 UTC