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

Service Discovery SDK15 - List service everytime it discovers one

Hi Nordic,

I am using the example in SDK15, ble_central_and_peripheral -> ble_app_interactive. After being connected to a device, and after pairing. I am trying to make a service discovery, but what i can make of it, is that it only writes out all the services at once. I want it to instead write out, each time it receives a response with a gatt service. Is this possible?

I have search my way through the SDK, and have found:

SVCALL(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, uint32_t, sd_ble_gattc_primary_services_discover(uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const *p_srvc_uuid));

Which I believe is the one that makes the service discovery. But can i make it print out everytime it receives a service, instead of writing them out all at once?

Regards Andreas

  • Hi,

    But can i make it print out everytime it receives a service, instead of writing them out all at once?

    What do you mean receives a service?

    After the service discovery, it will print the services as this:

    You can then discover service characteristics like this:

    And enable notification for the characteristic like this:

    All the commands are listed here.

  • The reason I ask, is that I am working on a project, where I try to get all services on a peripheral, but I have encountered a problem. I have made another post on DevZone, https://devzone.nordicsemi.com/f/nordic-q-a/40124/service-discovery---att-read-transaction-0-invalid-handle, but I am still waiting on a reply, so I have tried to follow up myself.

    The problem I have, is that i can't make a Service Discovery on the peripheral. I have explained why, on the other post.
    For trying to solve it myself, I wanted to see what happened between each service discovery.

    On the picture, I make it write out when it starts on the GATT Services. Then I make it print out, p_prim_serv->count, and I print out, p_prim_serv->services[count - 1].handle_range.end_handle. And this is where my scenario is, it discovers service 0, I think it discovers an unidentified UUID, and can't handle it. I have tried to remove the return statement, and see what it prints out, and this it what it finds:

    It finds the first identified UUID, but then it comes to an unidentified UUID, and it breaks. And this is where it leads me back to my question in this post, I want to see what happens in between the UUID discovery, what makes it break? It can find UUID, 1800, 1801, 180A and 180F, but then it breaks.

    I don't really now how to proceed from here on, that is why i asked you for help. Hope you can see what I mean by all this.

    Best regards Andreas

  • Hi,

    I see that you resolved the issue in your other post here. Does this mean that this case here is also resolved?

Related