[web-bluetooth] API to lookup known service & GATT descriptions: suggestion #944 (#573)

ariccio has just created a new issue for https://github.com/WebBluetoothCG/web-bluetooth:

== API to lookup known service & GATT descriptions: suggestion #944 ==
"3. Have you found a problem with the way this API is specified or have a feature request? File it here."


I think this would be helpful for others during debugging and development, especially when dealing with devices that don't have much documentation.

I think you should specify a function to retrieve a service name or GATT description from a UUID if it's a known UUID. I have no opinions on how best to specify it... I just found myself doing this while learning the protocol for my Aranet4. It could even just come along with any of the interfaces already specified (`BluetoothRemoteGATTService`, `BluetoothRemoteGATTCharacteristic`, etc...).

No need to be exhaustive either, covering even some of the UUIDs will really make someone else's day a bit easier.

I extracted my own file containing Javascript Maps of as many descriptions that I could compile from around the internet: https://gist.github.com/ariccio/2882a435c79da28ba6035a14c5c65f22

Browser developers should be able to implement this pretty easily. No runtime overhead needed, it can be a constexpr map of the dev's choice, or [as chrome does already, a fancy schmantzy static local](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/bluetooth/bluetooth_uuid.cc;l=73).

In a better world, the Bluetooth consortium might make this more easily retrievable via an API or something. There are a [whole bunch more 16 bit UUIDs listed on the SIG site](https://btprodspecificationrefs.blob.core.windows.net/assigned-values/16-bit%20UUID%20Numbers%20Document.pdf), but I reject the idea of using 16 bit UUIDs for anything on principle.

There are a number of similar things implemented one-off all around the internet, including the [Linux kernel Bluetooth stack](https://linux-bluetooth.vger.kernel.narkive.com/ZBk8FySe/patch-v2-gatt-translate-characteristic-names). I'm going to file similar issues with other BLE toolchains/platforms I've used lately, why has nobody thought of this?

Sidenote: the [links in the chromium source](https://www.bluetooth.com/specifications/gatt/characteristics) that supposedly point to a list of characteristics, largely seem to be dead. Did SIG ever provide a nice list of 128 bit UUIDs?

Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/573 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 10 January 2022 19:39:17 UTC