Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

How to get data from Unknown Service

Hello. I am trying to get data from BLE sensors. Sensors work like Nordic uart service. Main problem is that every BLE sensor has different 128-bit UUID of that service. If i use central nus example from nRF5 SDK and change NUS_BASE_UUID to  128-bit UUID of one sensor - it works well. But if take another sensor it doesnot work, because it has another 128 bit UUID. How can i handle that case if i dont know 128-bit UUID of the service?

Parents
  • Hello Dima,

    You can add this new functionality (sd_ble_opt_set(BLE_GATTC_OPT_UUID_DISC, &(ble_opt_t){.gattc_opt.uuid_disc.auto_add_vs_enable = 1});) which is described in the migration document

    in the ble_app_uart example after iniitalization of soft device. 

    static void ble_stack_init(void)

    {

    ret_code_t err_code;

    err_code = nrf_sdh_enable_request();

    APP_ERROR_CHECK(err_code);

    //configure the BLE stack using the default settings. Fetch the start address of the application RAM .

    uint32_t ram_start = 0;

    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);

    APP_ERROR_CHECK(err_code);

    //Enable BLE stack

    err_code = nrf_sdh_ble_enable(&ram_start);

    APP_ERROR_CHECK(err_code);

    //Register a handler for BLE events

    NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);

    err_code = sd_ble_opt_set(BLE_GATTC_OPT_UUID_DISC, &(ble_opt_t){.gattc_opt.uuid_disc.auto_add_vs_enable = 1}); // (this line is from the migration document-improved functionality)

    APP_ERROR_CHECK(err_code);

    }

    Could you please try and see what is the consequence. Please let us know.

    Best Regards 

    Kazi Afroza Sultana

Reply
  • Hello Dima,

    You can add this new functionality (sd_ble_opt_set(BLE_GATTC_OPT_UUID_DISC, &(ble_opt_t){.gattc_opt.uuid_disc.auto_add_vs_enable = 1});) which is described in the migration document

    in the ble_app_uart example after iniitalization of soft device. 

    static void ble_stack_init(void)

    {

    ret_code_t err_code;

    err_code = nrf_sdh_enable_request();

    APP_ERROR_CHECK(err_code);

    //configure the BLE stack using the default settings. Fetch the start address of the application RAM .

    uint32_t ram_start = 0;

    err_code = nrf_sdh_ble_default_cfg_set(APP_BLE_CONN_CFG_TAG, &ram_start);

    APP_ERROR_CHECK(err_code);

    //Enable BLE stack

    err_code = nrf_sdh_ble_enable(&ram_start);

    APP_ERROR_CHECK(err_code);

    //Register a handler for BLE events

    NRF_SDH_BLE_OBSERVER(m_ble_observer, APP_BLE_OBSERVER_PRIO, ble_evt_handler, NULL);

    err_code = sd_ble_opt_set(BLE_GATTC_OPT_UUID_DISC, &(ble_opt_t){.gattc_opt.uuid_disc.auto_add_vs_enable = 1}); // (this line is from the migration document-improved functionality)

    APP_ERROR_CHECK(err_code);

    }

    Could you please try and see what is the consequence. Please let us know.

    Best Regards 

    Kazi Afroza Sultana

Children
Related