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

Reading the device name as central from adv data

Hi,

im running my DK as a central of a BLE connection and i'd like to read the device_name of the peripheral board that im communication with. how do i do this? i cannot find a fieldname in the ble structures that stores it.

thank you :)

Parents Reply
  • First, the central is always the one initiating a connection. The peripheral only advertise its precence and the central is the one to decide if it wants to connect, and initiate the connection. What you are describing is exactly what happens in the examle I linked above:

    1. You get a BLE_GAP_EVT_ADV_REPORT event in the on_ble_evt()handler, and the function on_adv_report() is called.
    2. on_adv_report() checks if the name given in m_target_periph_name is found in the advertising data.
    3. If the name is found, the central connects to the device. If not, the advertising packet is discarded and scanning continues.
Children
No Data
Related