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

Get data from Advertising packet

Hello,

I would like to get data from the advertising packet.

I think that utilize this function is a good starting point :

uint8_t * complete_local_name_p = ble_advdata_parse(p_adv_report->data.p_data,
                                                    p_adv_report->data.len,
                                                    BLE_GAP_AD_TYPE_COMPLETE_LOCAL_NAME);

Then ... For exemple, what do I need to do to log properly the datas on my terminal ?

Try to put the datas on a vector like this char BLE_data [31], is it a good idea ?

Sincerely,
Sylvain.

  • I would definitely recommend you to take a look at the UART example from the ble_peripheral folder of SDK 15. The nus_data_handler() function shows how the messages are received over BLE & transferred over to UART to your computer's COM Port. See the nus_data_handler() function in main.c for how data received over BLE is handled. The on_write() function in ble_nus.c will pick up the BLE_GATTS_EVT_WRITE event from the softdevice & handle it by setting the event BLE_NUS_EVT_RX_DATA & letting nus_data_handler() handle that event.

Related