Viewing contents of advertising packet

Hi everyone, 

Is there a way of being able to view the contents of the advertising packets (advertising and scan response) without using a bluetooth sniffer? Is it possible to print the contents of the packet locally though the NRF_LOG before it is sent? (Or even inspect a location in memory with the encoded advertising data ready to be sent?)

I can't use nRF connect as I only have one nrf52-DK, and don't have bluetooth on my laptop.

Thanks.

  • Hi, 

    Most of the examples run a static configuration of the advertising payload (and scan response payload as well if you are using scan response). In the nRF5 SDK you use the advertising module. You can read the advertising raw data after running ble_advertising_init:

    err_code = ble_advertising_init(&m_advertising, &init);
    APP_ERROR_CHECK(err_code);
    
    
    
    // Write the raw adv and scan response data to local variables
    
    uint8_t *adv_data_ptr = m_advertising.adv_data.adv_data.p_data;
    uint16_t adv_data_len = m_advertising.adv_data.adv_data.len;
    uint8_t *sr_data_ptr = m_advertising.adv_data.scan_rsp_data.p_data;
    uint16_t sr_data_len = m_advertising.adv_data.scan_rsp_data.len;

    Best regards,

    Marjeris

Related