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

Question about secondary GATT services

I know it's not very common to use a secondary service, but I want to use it in one specific scenario. When referring to the documentation for the API sd_ble_gatts_include_add(), I see the following note:

"It is currently only possible to add an include declaration to the last added service (i.e. only sequential population is supported at this time)."

Can someone explain what this note means? For example, if I want to have one secondary service, and then include it in multiple primary services, is that possible with the SDK?

Thanks.

Parents
  • It means that it only possible to add the include declaration of the secondary service to the last service that was added using sd_ble_gatts_service_add().

    So if you want to add a secondary service to multiple services you will have to add the services and secondary services in the following order.

    sd_ble_gatts_service_add(<Service 1>)
    sd_ble_gatts_include_add( Secondary Service)
    sd_ble_gatts_service_add(<Service 2>)
    sd_ble_gatts_include_add(Secondary Service)
    sd_ble_gatts_service_add(<Service 3>)
    sd_ble_gatts_include_add(Secondary Service)
    
Reply
  • It means that it only possible to add the include declaration of the secondary service to the last service that was added using sd_ble_gatts_service_add().

    So if you want to add a secondary service to multiple services you will have to add the services and secondary services in the following order.

    sd_ble_gatts_service_add(<Service 1>)
    sd_ble_gatts_include_add( Secondary Service)
    sd_ble_gatts_service_add(<Service 2>)
    sd_ble_gatts_include_add(Secondary Service)
    sd_ble_gatts_service_add(<Service 3>)
    sd_ble_gatts_include_add(Secondary Service)
    
Children
Related