BLE finding correct handle ID

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BLE finding correct handle ID

978 Views
arpad_toth
Contributor II

Using QN908x BLE SDK.

How can I find the handle_id for given attribute the simplest way on the connected BLE device?

Something like get_handle id for: service_hex/attribute_hex path

Or can I hard code handle ID, is it same for a BLE profile across iphone/android? 

The longest and only way I found was:

gatt discover 0 -all   // uses GattClient_DiscoverAllPrimaryServices
--> Discovered primary services: 3


--> Generic Attribute Start Handle: 1 End Handle: 5
  - Service Changed Value Handle: 3


--> Generic Access Start Handle: 20 End Handle: 28
  - Device Name Value Handle: 22
  - Appearance Value Handle: 24
  - Central Address Resolution Value Handle: 26


--> User Data Start Handle: 40 End Handle: 65535
  - Serial Number String Value Handle: 42      <---- I'm looking for this number      

gatt discover 0 -service service_hex  

--> Discovered primary services: 1

--> User Data Start Handle: 40 End Handle: 65535   ---> misses 42

Can I use the absolute address of uuid to read out its value (with GattClient_ReadCharacteristicValue)?

What's the point of the uuid if not?

Tags (2)
0 Kudos
1 Reply

924 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi,

I hope you are doing great.

The Attribute Protocol allows devices to identify attribute types using UUIDs regardless of the local handle used to identify them in a read or write request.

The client must use GattClient_DiscoverAllPrimaryServices to obtain the handles of the attributes it is interested in.

The handle id could be assigned in a different order.

A client may send Attribute protocol requests to a server, and the server shall respond to all requests that it receives.

Regards,

Mario

0 Kudos