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

How to find 128 bit uuid services with sd_ble_gattc_primary_services_discover

I am using the heart_rate_collector example code as a base of understanding of the Nordic stack. I have a device I am trying to connect to and the primary service I want to use is marked as an unknown service with a 128 bit uuid. It is the fourth service in the list when I connect to the device with the nordic phone app.

I figured out that passing a NULL to the last parameter of sd_ble_gattc_primary_service_discover tells it to report all services for the device (at least I think so). The BLE_GATTC_EVT_PRIM_SRVC_DESC_RSP event report 3 services and indeed the uuids match the uuids of the first 3 services. They are all known uuid values.

I also noticed the event returned after the sd_ble_gattc_characteristics_discover call also returns 3 characteristics available although there are 5. I did some trying and found out that I can change the value to the start_handle and it will start higher in the sequence and return the other characteristics.

Is there a maximum number of values can be returned at a time and it is 3?

I tried changing the start handle argument to sd_ble_gattc_primary_services_discover from 1 to 2 and now it returns 2 services with the first one missing. So the limit of 3 does not seem to be the answer.

How do I get it to discover the 128bit uuid service?

Thanks in advance for any help,

Johnnie

Parents
  • there are 2 important thing to discover 128bit or vendor specified UUIDs. first we should add the uuid by the sd_ble_uuid_vs_add function to discover them as known 128bit uuid. second is we should track found uuid end service handler value and use next number to start discovery again until reahing to 0xffff value. discovery can be done in several steps. in order to read complete 128bit uuid i'm still working on it i guess we should read data from gat or something.


         int cnt=p_prim_srvc_disc_rsp_evt->count;
    
        uint16_t      ServiceStartHandle = p_prim_srvc_disc_rsp_evt->services[cnt-1].handle_range.end_handle;
    if (cnt> 0 && ServiceStartHandle != 0xffff)
    {
    
    StartDiscovery(ServiceStartHandle + 1);
    Log("Continue Discovery from service handle 0x%04X.....", ServiceStartHandle);
    }
    else
    {
    Log("Discovery Finished ------------------------------");
    }

Reply
  • there are 2 important thing to discover 128bit or vendor specified UUIDs. first we should add the uuid by the sd_ble_uuid_vs_add function to discover them as known 128bit uuid. second is we should track found uuid end service handler value and use next number to start discovery again until reahing to 0xffff value. discovery can be done in several steps. in order to read complete 128bit uuid i'm still working on it i guess we should read data from gat or something.


         int cnt=p_prim_srvc_disc_rsp_evt->count;
    
        uint16_t      ServiceStartHandle = p_prim_srvc_disc_rsp_evt->services[cnt-1].handle_range.end_handle;
    if (cnt> 0 && ServiceStartHandle != 0xffff)
    {
    
    StartDiscovery(ServiceStartHandle + 1);
    Log("Continue Discovery from service handle 0x%04X.....", ServiceStartHandle);
    }
    else
    {
    Log("Discovery Finished ------------------------------");
    }

Children
No Data
Related