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?
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?
Hi Suiji Biwa,
The Scan response is sent by the advertiser only after receiving Scan request, which the scanner sends only after receiving the ADV_SCAN_IND from the advertiser.

OK.Thanks.
Additional comments,
DeviceB and DeviceD is running by Active Scan.
Figure.1
(A) Will adv_report never be notified ?
Figure.2
(B) Will adv_report never be notified ?
(When the BDADDR is the same, or not same, DeviceA and DeviceC)

Hi,
Sorry for the late response.
When the scanner sends a scan request, it will accept scan response from only that advertiser to which it has sent scan request to. The link layer in the softdevice will verify the BDADDR of scan request and scan response are the same. So it is not possible for the scanner to process the scan response data of any advertisement for which it has not sent a scan request.
OK Thanks.
And, once more.
ADV_SCAN_IND Message Sequence Charts,
ADV_REPORT is notified only once.
However, in reality, ADV_REPORT is notified twice (ADV_SCAN_IND, SCAN_RSP). I think the chart is wrong, please tell me the correct time chart.
Advertiser sends SCAN_RSP only if it receives a SCAN_REQ from the scanner. The scanner does not send SCAN_REQ if it is not doing an active scanning and hence the top layer of the MSC only shows passive scanning, where the scanner does not send the scan request and the advertiser does not send the scan response.
The Variant #1 of the chart shows the active scanning where the scanner sends the SCAN_REQ and only after receiving this packet the advertiser will send the SCAN_RSP.
The chart seems correct.
In the figure below, which is correct, the red case or the green case?

None of them is correct.

None of them is correct.

Does it mean that the app will not receive ADV_REPORT (SCAN_RSP) if the app cannot set a new buffer by scan_start () between the time the app receives ADV_REPORT (ADV_SCAN_IND) and the time SoftDevice receives SCAN_RSP?
SCAN_RSP will only be sent everytime by the advertiser when it receives SCN_REQ from the scanner.
In the previous figure, we want to allocate adv_report_buffer1 by malloc.
Shouldn't I free adv_report_buffer1 until I receive the SCAN_RSP?
Please look at the documentation for the API before using it. In the documentation for sd_ble_gap_scan_start, it is clearly mentioned for p_adv_report_buffer, the buffer used to store incoming advertising data should be kept alive until the scanning is stopped. So if you allocated memory using malloc, you cannot free the memory while scanner is running.
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?