scan_ble_evt func call

Hi , currently i am using nrf52840 central  ble_app_uart  application with soft device s140  so i need to know from where the function void nrf_ble_scan_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_contex)   has been called in the application is there any callback function ? 

Parents
  • Hello,

    The nrf_ble_scan_on_ble_evt() is called from the SoftDevice. It is registered using the macro:

    #define NRF_BLE_SCAN_DEF(_name)                            \
        static nrf_ble_scan_t _name;                           \
        NRF_SDH_BLE_OBSERVER(_name ## _ble_obs,                \
                             NRF_BLE_SCAN_OBSERVER_PRIO,       \
                             nrf_ble_scan_on_ble_evt, &_name); \

    in nrf_ble_scan.h, (particularly the NRF_SDH_BLE_OBSERVER), and this is triggered every time there is a BLE event, pretty much like the ble_evt_handler() in your main.c file. So if you are looking into parsing the advertisement packets, for example, you can easily add the BLE_GAP_EVT_ADV_REPORT event to your ble_evt_handler() in main.c as well.

    Best regards,

    Edvin

Reply
  • Hello,

    The nrf_ble_scan_on_ble_evt() is called from the SoftDevice. It is registered using the macro:

    #define NRF_BLE_SCAN_DEF(_name)                            \
        static nrf_ble_scan_t _name;                           \
        NRF_SDH_BLE_OBSERVER(_name ## _ble_obs,                \
                             NRF_BLE_SCAN_OBSERVER_PRIO,       \
                             nrf_ble_scan_on_ble_evt, &_name); \

    in nrf_ble_scan.h, (particularly the NRF_SDH_BLE_OBSERVER), and this is triggered every time there is a BLE event, pretty much like the ble_evt_handler() in your main.c file. So if you are looking into parsing the advertisement packets, for example, you can easily add the BLE_GAP_EVT_ADV_REPORT event to your ble_evt_handler() in main.c as well.

    Best regards,

    Edvin

Children
Related