Skip to content

Commit 69d121d

Browse files
bluetooth: ble_scan: clarify scan timing in adv report handling
Expand the comment around the match_all cache logic to explain the on-air ADV → SCAN_REQ → SCAN_RSP exchange and why the paired SCAN_RSP is guaranteed to arrive before an ADV from another device. Also clarify the purpose of the buffer swap. No functional changes. Signed-off-by: Martynas Smilingis <martynas.smilingis@nordicsemi.no>
1 parent 2cc9c74 commit 69d121d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/bluetooth/ble_scan/ble_scan.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,12 @@ static void ble_scan_on_adv_report(struct ble_scan *scan,
683683
LOG_INF("Incomplete, expecting more data!");
684684
}
685685

686-
/* If active scanning where we need to match all we need the scan response for the same
687-
* address before processing the filters.
686+
/* Active scanning with match_all mode: filter data may be split between the ADV packet and
687+
* the SCAN_RSP packet, so we need both before evaluating filters.
688+
*
689+
* Cache this ADV and swap scan buffers so the next report the SoftDevice delivers
690+
* (the SCAN_RSP) is written into a different buffer, leaving adv_data valid until we can
691+
* evaluate the filters.
688692
*/
689693
if (active_match_all && !adv_report->type.scan_response) {
690694
/* Store what we have as advertising data and continue for the scan response. */

0 commit comments

Comments
 (0)