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

gatt service inquiry

Hi,

In addition to listening the advertiser's and beacon data we also need to offer the master application - which is connected to BLE-module via UART - the possibility to connect to peripheral and get information of available GATT-services. For this we need to be able to inquire service uuids from the connected peripheral.

I've been browsing through the examples but not been able to find out the solution for this. There are samples for listening the defined services, but not one for getting the information of all the available services.

Could anyone please guide me to the correct example, or give me some step-by-step information for building such an application.

Devkit used is nRF52840-DK, SDK revision is nRF5_SDK_16.0.0_98a08e2

Regards, Jukka

  • Hi Jukka

    Glad we were able to get to the bottom of this! I'm sorry I didn't realize what you were looking for earlier though, and that you didn't get exactly what you wanted out of the discovery module.

    Best of luck and regards,

    Simon

  • One more thing, Simon

    We were just thinking, how does the Nordic's Android app get all the known and unknown service informations from the connected device? Is there after all some way to collect them, other than discovery module?

    BR: Jukka

  • Hi Jukka

    This is done similarly in the Android app as well. It does a service discovery (including registering the UUIDs from the peripheral) and then does a service discovery to find all services, both known and unknown.

    Best regards,

    Simon

  • ok Simon,

    It seems that I haven't been able to express our problem clearly enough.

    Lets go step by step:

    1. we listen to beacons and find a peripheral with UUID 0x7571823740D8 as shown in the above conversation

    2. we make a connection to the peripheral

    3. we know absolutely nothing about the services the peripheral is offering

    4. how do we make an application, which after making a connection can find that e.g. service with uuid 0x180F is found on the peripheral, without us knowing it in advance? So that we can make a similar list that the Android app is showing.

    The modification I made using ble_db_discovery_evt_register() above made an assumption that I knew the services registered are available, which I actually don't know in the real world.

    I think that we now need some code examples showing step-by-step the operation needed.

    BR Jukka

  • Hi Jukka

    Thank you for the explanation. It seems like you look for something like the sd_ble_gattc_primary_services_discover() function instead of the discovery module. I'm sorry I didn't realize that earlier, but this function didn't come to mind initially. The sd_ble_gattc_primary_services_discover() function should be able to find all 128-bit UUIDs and support the ones in the table provided to ble_vs_uuids_assign. You should not have to know the list of service UUIDs in order to discover them using this function.

    Best regards,

    Simon

Related