Using bt_gatt_discover() with a non NULL UUID parameter. Still sweeps all handles?

Good day,

When using the bt_gatt_discover() with a NULL UUID parameter, the code sweeps all UUIDs available from the start_handle to the end_handle.
This is verified with the callback being called for all the handles.

When using the bt_gatt_discover() with a non NULL UUID parameter, the callback is only called once for the handle with the corresponding UUID.

My question is if the verification for the UUID is done internally (in the requesting device), or if the response to the request only contains the handle with the corresponding UUID?

The first meaning that the responding device sends all handles like a normal UUID NULL sweep, but internally the callback is only called once for the received handle with the chosen UUID.
And the second, that the responding device does not send all handles but only the handle with the corresponding UUID.

Thank you.

Parents
  • Hi TheLittleFish, 

    My question is if the verification for the UUID is done internally (in the requesting device), or if the response to the request only contains the handle with the corresponding UUID?

    Could you explain what you meant by "verification for the UUID" ? 

    The way the function works, in my understanding, is that when you do bt_gatt_discover() with non NULL UUID, the peer device (the server) will reply the handle of the first service/characteristic that match the UUID. If you want to discover more same UUID service/characteristic in the server, you need to call the function again , and then again until it return negative. 

  • Hello Hung Bui,
    Thank you for the fast reply.

    Could you explain what you meant by "verification for the UUID" ?

    I mean the step of comparing the chosen UUID with the handle UUID.

    The way the function works, in my understanding, is that when you do bt_gatt_discover() with non NULL UUID, the peer device (the server) will reply the handle of the first service/characteristic that match the UUID. If you want to discover more same UUID service/characteristic in the server, you need to call the function again , and then again until it return negative. 

    So the server only answers with 1 handle, the one with the requested UUID, and not the others unless the function is called again.

  • Hi, 

    TheLittleFish said:
    I mean the step of comparing the chosen UUID with the handle UUID

    What do you mean by "handle UUID" ? There is Handle ID of the service with a certain UUID. The server when receive a command, for example Find By Type Value of a certain UUID at a certain range. The server will return the handle ID of the service (attribute) with the exact UUID within the range. If there are multiple of them, it will return the first one and you need to call the function again to get the next one (with the range updated to exclude the first one) . 

    You can take a look here to see how the attribute table looks like: 
    academy.nordicsemi.com/.../

  • Hello,

    The server when receive a command, for example Find By Type Value of a certain UUID at a certain range. The server will return the handle ID of the service (attribute) with the exact UUID within the range.

    This answers my question. I wanted to know if the handle's UUID was identified server side or if the server responded with all the handles and respective UUIDs, in range, and the client did the identification.
    But if the server only returns the handle with the chosen UUID, then it is made server side.

    Thank you for your patience and fast answers.

  • Hi, 
    Yes it's the server check for the UUID and return the first one that matches in the range. I'm happy to help. 

Reply Children
No Data
Related