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

New scanning module: How can I know the length of advertisements?

Hi all,

I'm working with nRF52840 PDK and I'm using the last SDK and SoftDevice version: SDK v15.2.0 and SoftDevice v6.1.

I'm using the scanning module introduced in this new release in order to scan BLE advertisements.

But I can't find the easy way of know the size of every read advertisement. Are there any function or parameter with this value?

I was trying with m_scan.scan_buffer.len, but this show the size of the buffer (255 bytes in my case) and not the size of the advertisement.

Any help?

Manuel Montenegro

Parents
  • I was able to read the data field by executing the following steps:

    • Start with the ble_app_uart central example
    • Copy the lines below into scan_evt_handler(..)

        NRF_LOG_INFO("Received data (length): %d ",p_scan_evt->params.p_whitelist_adv_report->data.len);
        NRF_LOG_INFO("Received data (length): %d ",p_scan_evt->params.p_not_found->data.len);

    • Build and flash the application
    • Build and flash the ble_app_uart peripheral application onto another chip

    Then, I was able to read the length of the received data in the central example.

    Let me explain. In the central example when, scanning is initialized, a scanning event handler is provided, which will be called when receiving an advertisement packet. When this function is called, a scan event is provided. As seen in the example above, this struct contains an advertising report (p_whitelist_adv_report or p_not_found), which contains information about the size of the data field in the received advertisement packet.

    Best, regards Simon

  • Hello Simon,

    That was exactly what I needed. Thank you.

    I'm finishing a Bluetooth 5 advertisements scanner for extended advertisements that can be run in nRF52840 PDK and nRF52840 dongle.

    I think this can be useful because currently nRF52840 dongle isn't able to read extended advertisements using nRF Connect Desktop application.

    Do you know where can I publish my code (it's on GitHub actually).

    Manuel

Reply
  • Hello Simon,

    That was exactly what I needed. Thank you.

    I'm finishing a Bluetooth 5 advertisements scanner for extended advertisements that can be run in nRF52840 PDK and nRF52840 dongle.

    I think this can be useful because currently nRF52840 dongle isn't able to read extended advertisements using nRF Connect Desktop application.

    Do you know where can I publish my code (it's on GitHub actually).

    Manuel

Children
No Data
Related