This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Unable to read the 128 bit uuid with base uuid

Hello Team

I need to scan the peripheral dongle's 128 bit UUID service and its characteristics,my code is based on heart rate collector of pc-ble-driver,before scanning I am registering the uuid with the softdevice as per the suggestions from your forum posts as below, its adding and registering but the problem is its displaying the uuid as all 0's as 0x0000000000000000 ,I am also attaching the screenshots

ble_uuid_t    dfu_uuid;
    uint8_t       uuid_type = BLE_UUID_TYPE_VENDOR_BEGIN;
    
    /*Base UUIDs for DFU service characteristics*/
    ble_uuid128_t dfu_base_uuid = 
    {{0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX}
     };


    dfu_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN;
    dfu_uuid.uuid = BLE_UUID_VALO_SERVICE;

    err_code = sd_ble_uuid_vs_add(m_adapter,&dfu_base_uuid, &uuid_type);
    if(err_code != NRF_SUCCESS)
    {
         printf("custom uuid failed\n");
         fflush(stdout);
    }
    else
    {
        printf("custom uuid added\n");
        fflush(stdout);
    }
     err_code = ble_db_discovery_evt_register(&dfu_uuid);
     if(err_code != NRF_SUCCESS)
    {
         printf("ble_db_discovery_evt_register failed\n");
         fflush(stdout);
    }
    else
    {
        printf("ble_db_discovery_evt_register added\n");
        fflush(stdout);
    }
    // Initiate procedure to find the primary BLE_UUID_MY_SERVICE.
    err_code = sd_ble_gattc_primary_services_discover(m_adapter,
                                                      m_connection_handle, 0x0E,
                                                      &dfu_uuid);
    if (err_code != NRF_SUCCESS)
    {
        printf("Failed to initiate or continue a GATT Primary Service Discovery procedure\n");
        fflush(stdout);
    }
    else
    {
        printf("Initiated or continue a GATT Primary Service Discovery procedure\n");
        fflush(stdout);
    }
    
output:
  • Hi,

    Beulah Preethi Vallur said:
    My actual question is why its printing all 0's instead of my actual 128 bit uuid of the peripheral device.

    Yes, I believe I answered that in this post. You are printing mostly invalid memory. the 128 bit UUID does not exist anywhere you can obtain it to print it. If you want it, you have to calculate it yourself, as described in this post.

    Beulah Preethi Vallur said:
    I want my code to scan the actual uuids from the peripheral device  ,I have referred UART central example from nordic SDK and many examples from your forum and also followed the given procedure to scan the  advertisers corresponding services and characteristics

    Yes, and from what I can see you have done it correctly (after some adjustments), and it seems to work.

    Beulah Preethi Vallur said:
    I am not sure why its printing o's instead of printing the actual 128 bit UUID from the peripheral

    That is as explained before.

  • Hello Eric,I need to edit the values of my characteristics too like the temperature and other values,Can I be able to read and write the characteristics after discovering the service and its characteristics,can I able to view the values of characteristics before and after modifications?

    Because, just  based on specific combination of  uuid.type and uuid.uuid ,if i just hard code the 128 bit UUID,I also need to modify the existing values in characteristics and able to read the values, how come the nordic nrf Connect app can read and modify the peripheral characteristics,all I am trying is to mimic the nordic nrf Connect desktop application,hope you understood what I am trying to do in my current application. Its not just printing but also read and modify my characteristics 

  • Hi,

    I see. This thread has become quite long though, so I suggest creating a new question for the reading and writing part since the original question about the UUID has been resolved.

Related