dotintent / react-native-ble-plx

React Native BLE library
Apache License 2.0
3.05k stars 509 forks source link

Show known service & GATT descriptions: suggestion #944

Closed ariccio closed 11 months ago

ariccio commented 2 years ago

Prerequisites

Please answer the following questions for yourself before submitting an issue.

New behavior

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 write a function to retrieve a service name or GATT description from a UUID if it's a known UUID. You could add another field to Service, or you can add a free function to look it up... it doesn't really matter to me! I just found myself doing this while learning the protocol for my Aranet4. No need to be exhaustive.

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

I'd open a PR, but I'm really not a Java developer, you wouldn't want me touching your codebase :)

In a better world, the Bluetooth consortium might make this more easily retrievable via an API or something. There are a number of similar things implemented one-off all around the internet, including the Linux kernel Bluetooth stack. I'm going to file similar issues with other BLE toolchains/platforms I've used lately, why has nobody thought of this?

Acceptance criteria

Please provide detailed steps to accomplish proposed feature.

  1. Make it easy for devs to find out what services and characteristics they're looking at, without writing our own code.

Breaking changes

None. Might be a few extra KB of overhead.

ariccio commented 2 years ago

(There are a whole bunch more 16 bit UUIDs listed on the SIG site, but I reject the idea of using 16 bit UUIDs for anything on principle: https://btprodspecificationrefs.blob.core.windows.net/assigned-values/16-bit%20UUID%20Numbers%20Document.pdf)

dominik-czupryna-withintent commented 11 months ago

We are trying to make this library generic, we let the dev decide how to handle the device that he is using.