"GATT Operation not authorized" problem on Windows only

101 views
Skip to first unread message

ali.sht...@gmail.com

unread,
Jun 12, 2020, 8:45:59 PM6/12/20
to web-bluetooth
I have made several web Bluetooth based examples over the past few months, and they work perfectly fine on Mac and Chromebook. However, I have tried recently running them on Windows, and whenever I make an attempt to read from or write to a service with a custom UUID, it get the error "GATT Operation not authorized". 

Here is the code from one of my examples, simplified to its barebones where I am just accessing the value of a characteristic when I click a button named "Get Configuration". I have a device that implements a service and a characteristic with a the UUIDs specified in the code. From Mac and from Android this works fine, but only on Windows I am getting the error. I am using Chrom 83.0.4.


'use strict'

const configServiceUUID = '0b0b0b0b-0b0b-0b0b-0b0b-00000000aa03';
const chrConfigUUID     = '0b0b0b0b-0b0b-0b0b-0b0b-c1000000aa03';

let bleDevice;
let bleServer;
let configService;
let chrConfig;

window.onload = function(){
  document.querySelector('#connect').addEventListener('click', connect);
  document.querySelector('#read').addEventListener('click', getConfiguration);
};

async function connect() {
  try{
    bleDevice = await navigator.bluetooth.requestDevice({
          filters: [{namePrefix: 'nrf52'}],
          optionalServices: [configServiceUUID]
        });
    bleServer = await bleDevice.gatt.connect();
    configService = await bleServer.getPrimaryService(configServiceUUID);
    chrConfig = await configService.getCharacteristic(chrConfigUUID);

    log("Connected");
  }
  catch(error){
    log("Ouch! " + error);
  }
}

async function getConfiguration(){
  let config = await chrConfig.readValue(); //this returns a DataView
}

function log(text) {
    console.log(text);
    document.querySelector('#log').textContent += text + '\n';
}



Reply all
Reply to author
Forward
0 new messages