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

Simple central.

Hi! 
I want to implement at BLE switch(PTM215B) to a nRF52 DK, The switch sends advertise messages with switch status data. So i want to create a simple central that scans for the switch. I just copied the ble_blinky central from the SDK V.15 exampels as a start but i dont think i need to use all that code so i need some help to get started. 

Is the ble_blinky central the best example to start from or is it easier to start for scratch? 

Which are most important part to creat a program like this?

Thanks in advance!  

Parents Reply
  • Hi,

    The BLE address and data is part of the advertising packet, and you can access it when you get the event BLE_GAP_EVT_ADV_REPORT. You can print out the BLE address like below after you get the event. Take a look at the function ble_evt_handler in the ble_app_uart_c example.

    NRF_LOG_INFO("Connecting to target %02x%02x%02x%02x%02x%02x",
                         p_adv_report->peer_addr.addr[0],
                         p_adv_report->peer_addr.addr[1],
                         p_adv_report->peer_addr.addr[2],
                         p_adv_report->peer_addr.addr[3],
                         p_adv_report->peer_addr.addr[4],
                         p_adv_report->peer_addr.addr[5]
                         );

    You can store the data and address after getting the BLE_GAP_ADV_REPORT event. Do you want to store it in flash?

Children
Related