This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to use GATT API to discover handle to client characteristic config



I have used DiscCharByUUID to determine the start handle for a characteristic, but I need to modify the client characterist config value.  How do I use existing GATT API's to write the value?

GATT_WriteCharValue requires the handle...I have not found a good way to discover the handle

GATT_DiscAllCharDescs requires an end handle but I don't have one since DiscCharByUUID only provides the start handle and the value.

It seems like I need to do:

GATT_DiscAllPrimaryServices and filter to get the start and end handle for the specific service

GATT_DiscAllChars and filter to get the start and end handle for the specific characteristics

GATT_DiscAllCharDescs and filter to match the client characterist config

Would this work?

Is there an easier way?

  • That is the correct way of getting the handle.

    If you want a quicker way, I think you can use the GATT_DiscAllCharDescs function immediately after GATT_DiscCharsByUUID.  In calling the GATT_DiscAllCharDescs, just add 1 to the start handle and just specify a very big number for the end handle.  You should then receive Gatt messages with the handle of the descriptor  that you want to write to.  Haven't tried this method, so I'm not sure if it should work.