Enabling the reading of characteristic descriptors
Describe the bug
I was attempting to read a descriptor of a particular characteristic, but found that there is no way to do so with the current api
Here's an example of a characteristic we were trying to read the descriptor for (obtained using retrieveServices):
{ "descriptors": [{ "value": null, "uuid": "2901" }], "characteristic": "021aff50-0382-4aea-bff4-6b3f1c5adfb4", "properties": { "Write": "Write", "Read": "Read" }, "service": "021a9004-0382-4aea-bff4-6b3f1c5adfb4" }
As you can see, the descriptor UUID is present, but the value is null. Using a bluetooth debugger app on the app store, I found that I needed to fire off an additional read to read the descriptor (and this also confirmed that my bluetooth peripheral was functioning correctly, so it's not the peripheral's issue). I attached screenshots that show the before and after of reading the descriptor on this debugger app
Before read (descriptor value is null):

After read (descriptor value is prov-scan):

This problem was actually previously raised in another issue as well. As I understand, this is because the descriptor needs to be read separately. (I suspect the underlying reason is the same as why characteristic values need to be read separately, after calling the retrieveServices method, but I haven't verified this)
I dug around in the codebase a little, and found that in Peripheral.java, it should be relatively easy to add a new method to retrieve the list of a characteristic's BluetoothGattCharacteristic descriptors, before calling getValue() on the descriptor that is needed. This would allow for retrieval of characteristic descriptors
I have not had time to look into the ios codebase , but I imagine it should be similarly easy
Let me know what you think. Although unlikely, I may also have completely missed something that already allows descriptors to be read, so forgive me if I'm wrong about this
To Reproduce Steps to reproduce the behavior:
- Connect to any peripheral with characteristic descriptors
- Call retrieveServices on the device. Observe that the descriptors are null because they need to be separately retrieved
- Also observe that there is only a method to read a characteristic, but none for reading characteristic descriptors
Expected behavior We should be able to read characteristic descriptors
Smartphone (please complete the following information):
- Device: Haier
- OS: Android 8
- react-native-ble-manager version: 8.0.1
- react-native version: 0.64.3
Additional context Add any other context about the problem here.