This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

GATT client (ANCS example) : adding ANCS UUIDs on the client app

Hi,

I'm exploring the ANCS example with SD130 SDK 8.1.0 ...

The application acts as a GATT client to receive notification from GATT server on the iPhone. I see in the service_init function that the code calls 4 times the sd_ble_uuid_vs_add function to add UUID of the ANCS service and all the three characteristics.

I don't understand why the GATT client needs to know (before) the UUID for service and characteristics of the GATT server (on iPhone) ... doesn't the discovery procedure exist for it ?

Thanks, Paolo

  • In order to know which service you are connecting to you will need UUIDs. If you take a look at service_disc_req_send() (in ble_ancs.c) you will see that it uses BLE_UUID_TYPE_VENDOR_BEGIN, which was set by the first sd_ble_uuid_vs_add().

    (I think the dependencies between the main()/driver and the ble_ancs module are a little messy, since the ancs module depends on the main module setting the ANCS UUID before any others. Maybe it would be better if there were a function to add a new UUID and also get its offset. Then modules, like ancs, could add their own vendor UUIDS and know the index of them)

    (an update: I didn't address the last three ble_vs_uuids_assign()s originally)
    Some of the other gattc call backs that are used by ancs (for characteristic discovery & service discovery) will return a type of BLE_UUID_TYPE_UNKNOWN if the corresponding UUIDs don't match anything that's already in ble_vs_uuids_assign(). Although the documentation isn't clear, this probably means that the shortened 16-bit identifier wouldn't be valid, which would prevent the if-statements in the ancs module from correctly identifying the characteristics/services that have been discovered. (Given the way UUIDs are represented in the Nordic implementation, returning "UNKNOWN" this is a reasonable restriction that avoids any ambiguity)

  • @Paolo: Have the answer from ppartierno and endnode answered your question ? If they did, please accept them as answered.

Related