- From: Zhangrui via GitHub <sysbot+gh@w3.org>
- Date: Thu, 27 Jul 2017 08:01:56 +0000
- To: public-web-bluetooth-log@w3.org
NotSupportedError: GATT operation failed for unknown reason.
https://github.com/a-kitchen/a-kitchen.github.io/commits/master
let chosenHeartRateService = null;
function search(){
document.getElementById("demo").innerHTML="My First JavaScript";
let options = {
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 => {
return server.getPrimaryService('00000000-0000-1000-8000-00805f9b34fb');
}).then(service => {
chosenHeartRateService = service;
return Promise.all([
service.getCharacteristic('00000002-0000-1000-8000-00805f9b34fb').then(Notifications),
service. getCharacteristic('00000002-0000-1000-8000-00805f9b34fb').then(Notifications),
service.getCharacteristic('00000001-0000-1000-8000-00805f9b34fb').then(w),
service.getCharacteristic('00000003-0000-1000-8000-00805f9b34fb').then(read)
]);
}).catch(error => {
document.getElementById("demo").innerHTML=error;
});
}
function Notifications(characteristic){
characteristic.startNotifications();
}
function read(characteristic){
return characteristic.readValue().then(sensorLocationData => {
if(sensorLocationData.zIndex >1){
let sensorLocation = sensorLocationData.getUint8(1);
document.getElementById("data").innerHTML="sensorLocation"+sensorLocation;
}
});
}
function w(characteristic){
let resetEnergyExpended = new Uint8Array([34,8,35,7]);
characteristic.writeValue(resetEnergyExpended);
document.getElementById("w").innerHTML="write";
}
------------------ Original ------------------
From: "François Beaufort"<notifications@github.com>;
Date: Wed, Jul 19, 2017 05:08 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)
optionalServices should only include service UUIDs not characteristic UUIDs.
—
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-318289230 using your GitHub account
Received on Thursday, 27 July 2017 08:01:59 UTC