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

Is SCAN_RSP notified only after ADV_SCAN_IND?

Target is nrf52832+SoftDeviceS132

When run ActiveScan,

Is SCAN_RSP advertise_report notified only after ADV_SCAN_IND advertise_report?

If I receive only the SCAN_RSP of the SCAN_REQ performed by another device, will it be notified?

Parents Reply Children
  • written for sd_ble_gap_scan_start()

    The scanner will automatically stop in the following cases:
    sd_ble_gap_scan_stop is called.
    sd_ble_gap_connect is called.
    A BLE_GAP_EVT_TIMEOUT with source set to BLE_GAP_TIMEOUT_SRC_SCAN is received.
    When a BLE_GAP_EVT_ADV_REPORT event is received and ble_gap_adv_report_type_t::status is not set to BLE_GAP_ADV_DATA_STATUS_INCOMPLETE_MORE_DATA. In this case scanning is only paused to let the application access received data. The application must call this function to continue scanning, or call sd_ble_gap_scan_stop to stop scanning.
    -----------------------
    p_adv_report_buffer The memory pointed to should be kept alive until the scanning is stopped.

    Isn't it okay to free the buffer when BLE_GAP_EVT_ADV_REPORT (ADV_SCAN_IND) is returned?
    And shouldn't we set up a new buffer to get the SCAN_RSP?

  • loquat said:
    Isn't it okay to free the buffer when BLE_GAP_EVT_ADV_REPORT (ADV_SCAN_IND) is returned?

     If you want to pause/stop the scanner after this event, then it is ok to free the buffer, but if you intend to make the scanner resume then it is wise to keep this buffer alive.

     

    loquat said:
    And shouldn't we set up a new buffer to get the SCAN_RSP?

    Scan response data is a complete different buffer (p_gap->params.scan_req_report) and complete different event. You need to manage it differently. I am not sure why you need to have a dynamic memory here but if you think you do, then have two different buffers for adv report and scan response data

Related