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

Find short name in advertising packet using ble_advdata_short_name_find(...) getting always false?

Hello to all,

I am using nRF52832 sdk15.0 version with SES IDE. I want to find adverting with short for e.g.--->

we have BLE app_uart peripherals and one multilink central.

ble peripheral adverting with name of "Nordic-XXXXXX" where x is BLE 48 bit mac address. In central i want to scan ble peripheral device as short Name set is "Nordic-".

for achieving above i am using program like this:

 if (ble_advdata_short_name_find(p_adv_report->data.p_data,
                                    p_adv_report->data.len,
                                    SCAN_DEVICE_NAME,sizeof(SCAN_DEVICE_NAME)))
    {
        // Name is a match, initiate connection.
        NRF_LOG_INFO("Short name found");
        err_code = sd_ble_gap_connect(&p_adv_report->peer_addr,
                                      &m_scan_params,
                                      &m_connection_param,
                                      APP_BLE_CONN_CFG_TAG);
        if (err_code != NRF_SUCCESS)
        {
            NRF_LOG_ERROR("Connection Request Failed, reason %d", err_code);
        }
    }

where SCAN_DEVICE_NAME = "Nordic-"

If i use ble_advdata_name_find with full advertising name working well. But why short name find is not working please any one tell me what is proper way for finding short name in whole adverting name.
Whats wrong in my program.... When i debugging so getting in ble_advdata.c data_offset is NULL always. 

Please suggest me better way or any changes in my program..

Thanks..

  • Thanks for fast response..!!!

    Yes, sorry i forget to told you modified like this:

    if (ble_advdata_name_find_test(p_adv_report->data.p_data,
    p_adv_report->data.len,
    m_target_periph_name[0])

    Defined whole function in main exact above of the call function.

    we have also other problem as per the bellow:

    1. In sdk15.0 How i can change adverting timeout duration?

    #define APP_ADV_DURATION                18000    //180 second

    i want to change this for 5min(300 second) but when i changed it to 30000 got following error.

    ERROR 7 [NRF_ERROR_INVALID_PARAM] line no 895 means

    uint32_t err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);

    In this sdk how i can increase advertising time?

    Thanks..

  • I tested this with ble_app_blinky peripheral and central, by changing the name to "Nordic-01" in peripheral, and added my code to ble_advdata.c/.h plus changed m_target_periph_name to "Nordic-" in central application. This works as expected, and the central connects to the peripheral. If it does not work in you application, you must have made some other changes that cause it to not work.

Related