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

How to get the raw advertisement data in nrf52840 ble_app_uart_central?

i am working on ble_app_uart central and peripheral, so basically peripheral will sleep wake up and send advertisement packet to central . Now the issue is if peripheral is in connectable mode then it automatically connect to central so that i made peripheral to non connectable mode and central is not connecting right now. But i want to get the raw advertisement data in central side. i have read the post which tell use BLE_GAP_ADV_REPORT in ble_evt_handler() but i don't have any idea to get the raw advertisement data packet of 31 bytes and which variable holds this advertisement data. i tried printf in ble_evt_handler and it keeps on entering to that and BLE_GAP_ADV_REPORT case.

can anyone help me to get the data whenever advertisement packets are sent from the peripheral? and could you explain after scan starts what is happening in ble_App_uart example?

Parents
  • When you receive the BLE_GAP_EVT_ADV_REPORT event, in order to get the advertising data you have to look at the field &p_ble_evt->evt.gap_evt.params.adv_report.data.This field contains to sub-fields, *p_data and  len, where the former contains a pointer to the data buffer and the second is the length of the data buffer, in bytes.

    Check out this and this link in order to understand the advertising packet better.

    Best regards,

    Simon

Reply
  • When you receive the BLE_GAP_EVT_ADV_REPORT event, in order to get the advertising data you have to look at the field &p_ble_evt->evt.gap_evt.params.adv_report.data.This field contains to sub-fields, *p_data and  len, where the former contains a pointer to the data buffer and the second is the length of the data buffer, in bytes.

    Check out this and this link in order to understand the advertising packet better.

    Best regards,

    Simon

Children
No Data
Related