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

Support for secondary service discovery?

Hidden in the guts of this answer is:

Please be noted that not all central stack have full support to automatically discovery secondary services (e.g S120 stack)

As it happens, I'm trying to discover secondary services from a central device using S120.

Does the above limitation still exist in S120 v2.0.0? (Experimentation suggests it does, but I may not be using it properly.)

Is there a non-automatic process that can be used to discover secondary services using the S120 (either v1 or v2) or another soft-device supporting the central role?

Parents
  • Hi,

    As far as I know, it is mandatory to support the discovery of secondary services, even though they're not widely used. Our SoftDevices should have support for secondary service discovery since the very first versions, but not in an automated fashion like with the sd_ble_gattc_primary_services_discover function.

    To discover secondary services, you will have to replicate some of the behavior that happens in that function, which means finding attributes with UUID 0x2801 ("Secondary Service") and then read their value to find the actual Service UUID. This UUID could be a vendor-specific UUID, and if this is the case there are some functions like sd_ble_uuid_decode that can help you filter your results in a clean way.

    See this table and related pages for the adopted UUIDs.

    If you want to experiment with secondary services, please read the Bluetooth Specification Vol 3, Part G, Chapter 3.1 and 3.2 very carefully. You have to include the secondary service in a primary service to be conformant with the specification.

Reply
  • Hi,

    As far as I know, it is mandatory to support the discovery of secondary services, even though they're not widely used. Our SoftDevices should have support for secondary service discovery since the very first versions, but not in an automated fashion like with the sd_ble_gattc_primary_services_discover function.

    To discover secondary services, you will have to replicate some of the behavior that happens in that function, which means finding attributes with UUID 0x2801 ("Secondary Service") and then read their value to find the actual Service UUID. This UUID could be a vendor-specific UUID, and if this is the case there are some functions like sd_ble_uuid_decode that can help you filter your results in a clean way.

    See this table and related pages for the adopted UUIDs.

    If you want to experiment with secondary services, please read the Bluetooth Specification Vol 3, Part G, Chapter 3.1 and 3.2 very carefully. You have to include the secondary service in a primary service to be conformant with the specification.

Children
  • To expand on this just a little: you can replicate the behavior by iteratively calling sd_ble_gattc_char_value_by_uuid_read looking for attribute 0x2800 (primary) or 0x2801 (secondary) to retrieve the raw service UUIDs.

    If you don't know the vendor UUID to pass to sd_ble_uuid_vs_add then the ble_uuid_t structures from sd_ble_gattc_primary_services_discover have type BLE_UUID_TYPE_UNKNOWN. The above process is how you would find the full UUID if it wasn't provided by an oracle.

Related