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

Not able to use Short name find function

Hello,

I don't understand why the ble_advdata_short_name_find function never return a true value. I'm sure that I send a short name because I verified this on the nRF connect app and the short name length is 10 so I think that all parameters are good.

When I send a full name the function ble_advdata_name_find works fine.

So, Is the ble_advdata_short_name_find function is well writed ? I don't understand why it doesn't work.

/**@brief Function for handling the advertising report BLE event.
 *
 * @param[in] p_adv_report  Advertising report from the SoftDevice.
 */
static void on_adv_report(ble_gap_evt_adv_report_t const * p_adv_report)
{
    ret_code_t err_code;
      
    NRF_LOG_INFO("Packet received");
      
    if (ble_advdata_short_name_find(p_adv_report->data.p_data,
                                    p_adv_report->data.len,
                                    DEVICE_NAME,5))
    {
        NRF_LOG_INFO("Device short name found");
        
        err_code = sd_ble_gap_scan_start(NULL, &m_scan_buffer);
        APP_ERROR_CHECK(err_code);
    }

    if (ble_advdata_name_find(p_adv_report->data.p_data,
                              p_adv_report->data.len,
                              m_target_periph_name))
    {
        NRF_LOG_INFO("Device name found");
        err_code = sd_ble_gap_scan_start(NULL, &m_scan_buffer);
        APP_ERROR_CHECK(err_code);
    }
    else
    {
        err_code = sd_ble_gap_scan_start(NULL, &m_scan_buffer);
        APP_ERROR_CHECK(err_code);
    }
}

Sincerely,

Sylvain.

Parents Reply Children
No Data
Related