0

I am working on a simple web application that sends commands to an HC-06 Bluetooth module using Web Bluetooth API. So far, I have successfully connected the device to the browser and gained access to the server, service, and characteristics. The problem starts when I try to do anything after that point. Reading or writing to the HC-06 throws DOMException: GATT operation not permitted.

I logged characteristic.properties (in the fourth promise chain) and seem to have found the problem. BluetoothCharacteristicProperties is the following object:

{
  authenticatedSignedWrites: false
  broadcast: false
  indicate: false
  notify: true
  read: false
  reliableWrite: false
  writableAuxiliaries: false
  write: false
  writeWithoutResponse: false
}

So, it makes sense that I can not perform any operations on the module. What I don't understand is why the permissions are set to false. I already have a working Python application that perfectly communicates with the same HC-06 - and I can send commands to it through an Android terminal. This leads me to believe there is some misconfiguration I've overlooked in the web app implementation. Is there a way to change these permissions through the Web Bluetooth API? Or perhaps through AT commands to the module itself? Or maybe the API simply won't work with this model? Any help would be appreciated!

  • **Bluetooth classic** and **Bluetooth LE** are incompatible. While **Web Bluetooth** targets **Bluetooth LE** technology, the HC-06 is a **Bluetooth classic** device. This cannot work. – Risto Jun 03 '22 at 13:44
  • Yeah, this doesn't work with Web Bluetooth because HC-06 is a Bluetooth classic device. Try Web Serial, it should work as long as the OS recognizes the connected HC-06 as a serial port. – nondebug Jun 03 '22 at 22:52
  • @nondebug Okay, thank you! I will look into Web Serial, it might be what I need for this app – Michael Kerr Jun 05 '22 at 03:55

2 Answers2

0

Thanks to @nondebug for the help! Turns out there is a lot of distinction between Bluetooth modules. The HC-06 that I'm using for this project is running Bluetooth 2.0, and the Web Bluetooth API requires Bluetooth 4.0 and above. I was able to write some Javascript using the Web Serial API instead, and can make a connection to my device using a desktop browser. Unfortunately, mobile browsers do not seem to support Web Serial API. Time to get started on a native app I guess!

0

You are writing to the wrong GATT service characteristic.
Notify and read on characteristic 0xFFE1.
Writing on characteristic 0xFFE2.

Got it working: ble on HC-06.
Its a strang chinese clone.

I used Bluetooth LE Explorer.
Installed from the MS Store.

Connect TX and RX together.
Set "Notify" and "Use Windows Notifications" on for characteristic 0xFFE1
Write value (UTF8) for characteristic 0xFFE2

Data you write show-up in the Windows Notification window.