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

BLE Central: Unable to discover 128 bit UUID service having two characteristics with completely different 128 bit UUID.

Hi Nordic Team,

My dev environment is as follow:

nRF52832 (Central) + S132+ SES 

At Peripheral side, I am using nRF connect app to advertise the service I want to discover.

The service I want to discover has 128 bit UUID. The two characteristics of that service have completely different 128 bit UUID.

Ambient Service UUID: 503d7513-99c6-f504-f3ea-7d2aa80cb92b

Ambient Light Characteristic UUID: c613cb6c-cd08-64b2-9b6a-8d6e6665f74e

Configuration Characteristic UUID: d502c51c-2f55-9e34-bfbc-e4fbf3e2ae70

I am trying to discover this service and its characteristics but I am unable to do so. 

I have added Ambient Light service UUID and both of the characteristics UUID to Attribute Table using sd_ble_uuid_vs_add() and have tried everything from various posts on this topic .

uint32_t ble_als_c_init(ble_als_c_t * p_ble_als_c, ble_als_c_init_t * p_ble_als_c_init)
{
    uint32_t      err_code;
    ble_uuid_t    uart_uuid;
    ble_uuid_t    uart_al_uuid;
    ble_uuid_t    uart_config_uuid;
    ble_uuid128_t als_base_uuid = ALS_BASE_UUID;
    ble_uuid128_t als_al_char_uuid = ALS_AL_CHARACTERISTIC_UUID;
    ble_uuid128_t als_config_char_uuid = ALS_CONFIG_CHARACTERISTIC_UUID;
    //ble_uuid128_t nus_base_uuid = NUS_SERVICE_BASE_UUID;
   

    VERIFY_PARAM_NOT_NULL(p_ble_als_c);
    VERIFY_PARAM_NOT_NULL(p_ble_als_c_init);
    VERIFY_PARAM_NOT_NULL(p_ble_als_c_init->p_gatt_queue);

  

    err_code = sd_ble_uuid_vs_add(&als_base_uuid, &p_ble_als_c->uuid_type);

    if (err_code != NRF_SUCCESS)
    {
    return err_code;
    }
    VERIFY_SUCCESS(err_code);

     err_code = sd_ble_uuid_vs_add(&als_al_char_uuid, &p_ble_als_c->uuid_type_al_char);

   if (err_code != NRF_SUCCESS)
    {
    return err_code;
    }

    VERIFY_SUCCESS(err_code);

     err_code = sd_ble_uuid_vs_add(&als_config_char_uuid, &p_ble_als_c->uuid_type_config_char);

   if (err_code != NRF_SUCCESS)
    {
    return err_code;
    }

    VERIFY_SUCCESS(err_code);

    uart_uuid.type = p_ble_als_c->uuid_type;
    uart_uuid.uuid = BLE_UUID_ALS_SERVICE ;

    uart_al_uuid.type = p_ble_als_c->uuid_type_al_char;
    uart_al_uuid.uuid = BLE_UUID_ALS_AL_CHARACTERISTIC;

    uart_config_uuid.type = p_ble_als_c->uuid_type_config_char;
    uart_config_uuid.uuid = BLE_UUID_ALS_CONFIG_CHARACTERISTIC;

    p_ble_als_c->conn_handle           = BLE_CONN_HANDLE_INVALID;
    p_ble_als_c->evt_handler           = p_ble_als_c_init->evt_handler;
    p_ble_als_c->error_handler         = p_ble_als_c_init->error_handler;
    p_ble_als_c->handles.als_al_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_als_c->handles.als_config_handle = BLE_GATT_HANDLE_INVALID;
    p_ble_als_c->p_gatt_queue          = p_ble_als_c_init->p_gatt_queue;

    return ble_db_discovery_evt_register(&uart_uuid);
  
}

Parents Reply Children
  • Hi,

    This segment of code belongs to central. Actually for peripheral I am using Nrf connect app to advertise. 

    I have went through NUS central. But NUS service 128 bit uuid and its characteristics 128 bit uuid is not completely different. Even I had implemented based on NUS central example. But fortunately I was able to solve this issue. I just used bas central example (sdk 17.0) and specifically used 

    ble_bas_on_db_disc_evt() 

    portion of code and changed things according to what I needed and it worked. 

    The only thing that was important was while registering through sd_ble_uuid_vs_add() use 128 bit uuid of both service and characteristics but while registering for discovery only 16 bit uuid for both service and characteristics. 

    Thank you for your reply! 

Related