5

I have been working with web-bluetooth for the past several months on iOS and ChromeOS without any problems. But today, I tried to run some of my examples on Windows for the first time, and to my surprise, most of the things I had implemented didn't work with Windows. I am able to successfully connect to my peripheral, but whenever I try reading or writing anything to a custom service with a custom characteristic, I get the error "GATT operation not authorized". I have tried looking around but there is no information anywhere about this.

I am including below the simplest example I have which is just for turning the LEDs on / off on an nrf52832 board. There is only one custom service and one custom characteristic implemented, the value of which controls the states of the LEDs. This works without any problems on Chromebooks and Macs but does not work on Windows. Here is the link to this simple project including the embedded code and the web-app. https://github.com/shtarbanov/WebBluetooth-Feather-nRF52832/tree/master/LED%20Control

I have made two implementations of the same thing, one based on promises and another based on async-await located in the folders "WebApp (Async)" and "WebApp (Promises)", respectively. Both of those implementations work fine on Mac and Cromebook, but not on Windows.

Albert
  • 131
  • 7
  • Does you characteristic require authorization? If so - try removing it and try again. BTW - the repo is missing the embedded code, so I couldn't see for myself. – bavaza Jun 14 '20 at 08:53
  • The embedded code is in the other folder that you see when you open the link. I was able to solve this by changing the permission in my embedded code from SECMODE_ENC_NO_MITM to SECMODE_OPEN. However, I still don't understand why this problem happening only on Windows? Are Mac and Linux simply ignoring this setting? I also haven't found any explanation about what BLE permissions are, and how are they used by the protocol under the hood. – Albert Jun 15 '20 at 09:11
  • I suspect ChromeOs and iOS automatically pair with the device (i.e. encrypt the connection and exchange keys), whereas Windows requires you to explicitly do so. Not sure that this is the case, but it would explain what you are seeing. Nordic have a nice tutorial re CCCD: https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial – bavaza Jun 15 '20 at 15:08

2 Answers2

1

It is a known issue that secure characteristics are not accessible using Web Bluetooth on Windows. On other platforms the pairing occurs automatically, but not on Windows. There is an issue tracking this:

https://bugs.chromium.org/p/chromium/issues/detail?id=960258

Reilly Grant
  • 5,590
  • 1
  • 13
  • 23
  • I think more may be going on. That bug may be related, but is not quite the same thing. That particular bug is for secure charactersistics that expect a PIN response. I am seeing something similar to the problem description, and this may be a totally new bug that needs to be reported to the chromium folks. – spekary Jun 16 '20 at 17:04
  • If you can file an issue on crbug.com then that would be very helpful for us, especially if you include code for the nRF board which reproduces the issue. I know we have a few of these in the office (currently closed due to COVID-19 which will slow things down). – Reilly Grant Jun 16 '20 at 18:10
0

Stuck with this also and as for workaround i can recommend for windows platform to pair device firstly using windows itself and than to pair it via browser(as a workaround). Not much but hope this helps, at list a little. P.S. it should be paired via windows only once, so PC will remember device, and than you can pair via browser as long as PC remembers device.

  • I tried that, but could not see our BLE device using the windows Bluetooth scanner, though it shows up in the Chrome scanner. – spekary Jun 17 '20 at 19:19