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

Receiving Scan Response Packet

Hi All!

I'm working a few weeks now with the NRF52 DK and having loads of fun!

Today I tried to make a central/scanner that scans for packages from a broadcaster. To make the broadcaster I followed the tutorial provided by Nordic ( devzone.nordicsemi.com/.../). This all seems to work fine: I can receive all packets, including the Scan Response Packet on my phone.

So with the advertiser working, I started working on the scanner side. I added a " case BLE_GAP_EVT_ADV_REPORT" inside on_ble_evt() and this works all fine.


    case BLE_GAP_EVT_ADV_REPORT:
    {	//
        if (strlen(m_target_periph_name) != 0)
        {
            if (find_adv_name(&p_gap_evt->params.adv_report, m_target_periph_name))
            {
            	NRF_LOG_INFO("Packet from device\r\n");
            	print_adv_data(&p_gap_evt->params.adv_report);
            }
        }
        else
        {
        	NRF_LOG_INFO("not from device\r \n");
        }
    }break;// BLE_GAP_ADV_REPORT

However, I want to be able to transmit more data, so I would like to process the Scan Response Packets as well. I think that I have to handle this with a case BLE_GAP_EVT_SCAN_REQ_REPORT. However, If I make a NRF_LOG_INFO() call inside that case statement, nothing happens. This gives me the idea that this is not the way to go.

I checked the scanner settings: m_scan_param.active = 1; m_scan_param.interval = SCAN_INTERVAL; m_scan_param.window = SCAN_WINDOW;

I hope some of you can help me a little further!

Cheers Rob

Parents
  • Hi! Thanks, it's working now.

    I checked if the packet was from a device that I was interested in. However, I did this on name, which is not there anymore in a Scan Response Packet. So just:

    case BLE_GAP_EVT_ADV_REPORT:
    {   
           print_adv_data(&p_gap_evt->params.adv_report);
    }break;// BLE_GAP_ADV_REPORT
    

    works fine. I'm working on filtering now, but that's another question (whitelisting on advertisements etc).

Reply
  • Hi! Thanks, it's working now.

    I checked if the packet was from a device that I was interested in. However, I did this on name, which is not there anymore in a Scan Response Packet. So just:

    case BLE_GAP_EVT_ADV_REPORT:
    {   
           print_adv_data(&p_gap_evt->params.adv_report);
    }break;// BLE_GAP_ADV_REPORT
    

    works fine. I'm working on filtering now, but that's another question (whitelisting on advertisements etc).

Children
No Data
Related