Skip to content

bluetooth: ble_scan: add manufacturer data filter support#783

Open
PizzaAllTheWay wants to merge 3 commits into
nrfconnect:mainfrom
PizzaAllTheWay:ble-scan-manufacturer-filter
Open

bluetooth: ble_scan: add manufacturer data filter support#783
PizzaAllTheWay wants to merge 3 commits into
nrfconnect:mainfrom
PizzaAllTheWay:ble-scan-manufacturer-filter

Conversation

@PizzaAllTheWay
Copy link
Copy Markdown
Contributor

Port the manufacturer data scan filter from NCS to Bare Metal.

ble_adv_data: new ble_adv_data_manufacturer_data_find() helper.

ble_scan: new BLE_SCAN_MANUFACTURER_DATA_FILTER filter type with CONFIG_BLE_SCAN_MANUFACTURER_DATA_COUNT and CONFIG_BLE_SCAN_MANUFACTURER_DATA_MAX_LEN Kconfig options. Wired through filter add/enable/disable/remove and the adv report handler.

Unit tests added for the new find helper, filter-add paths and event handler, plus regression guards in existing tests.

Changelog entries added under lib_ble_adv and lib_ble_scan.

Clarified the comment around the match_all ADV/SCAN_RSP cache logic.

Feature verified end-to-end using locally modified ble_hrs and ble_hrs_central samples (peripheral advertising Nordic company ID 0x0059 and central configured with a manufacturer data filter). Sample changes are not included in this PR.

@github-actions github-actions Bot added the doc-required PR must not be merged without tech writer approval. label Apr 28, 2026
@PizzaAllTheWay PizzaAllTheWay force-pushed the ble-scan-manufacturer-filter branch from 71e578f to db6182f Compare April 28, 2026 15:32
@github-actions
Copy link
Copy Markdown

You can find the documentation preview for this PR here.

@PizzaAllTheWay PizzaAllTheWay force-pushed the ble-scan-manufacturer-filter branch from db6182f to 991a6e7 Compare April 28, 2026 15:39
@PizzaAllTheWay PizzaAllTheWay marked this pull request as ready for review April 28, 2026 15:47
@PizzaAllTheWay PizzaAllTheWay requested review from a team as code owners April 28, 2026 15:47
@PizzaAllTheWay PizzaAllTheWay self-assigned this Apr 28, 2026
Comment thread include/bm/bluetooth/ble_adv_data.h Outdated
Comment thread lib/bluetooth/ble_adv/ble_adv_data.c
Comment thread lib/bluetooth/ble_adv/ble_adv_data.c Outdated
Comment thread tests/unit/lib/bluetooth/ble_adv_data/src/unity_test.c
Comment thread tests/unit/lib/bluetooth/ble_adv_data/src/unity_test.c Outdated
Comment thread lib/bluetooth/ble_scan/Kconfig Outdated
Comment thread lib/bluetooth/ble_scan/Kconfig Outdated
Comment thread tests/unit/lib/bluetooth/ble_scan/src/unity_test.c
Comment thread tests/unit/lib/bluetooth/ble_scan/src/unity_test.c
Comment thread tests/unit/lib/bluetooth/ble_scan/src/unity_test.c
@PizzaAllTheWay PizzaAllTheWay force-pushed the ble-scan-manufacturer-filter branch from 991a6e7 to 4dcd5d0 Compare May 4, 2026 16:47
Comment thread doc/nrf-bm/release_notes/release_notes_changelog.rst Outdated
Comment thread doc/nrf-bm/release_notes/release_notes_changelog.rst Outdated
Comment thread include/bm/bluetooth/ble_adv_data.h Outdated
@PizzaAllTheWay PizzaAllTheWay force-pushed the ble-scan-manufacturer-filter branch from 4dcd5d0 to e3f6b95 Compare May 5, 2026 07:14
@PizzaAllTheWay PizzaAllTheWay force-pushed the ble-scan-manufacturer-filter branch from e3f6b95 to 356109f Compare May 5, 2026 08:11
@eivindj-nordic eivindj-nordic added this to the v3.0.0 milestone May 7, 2026
@PizzaAllTheWay PizzaAllTheWay force-pushed the ble-scan-manufacturer-filter branch 2 times, most recently from 5380769 to 4799e8a Compare May 18, 2026 12:06

* Added:

* The :c:struct:`ble_scan_filter_data` structure as input to the :c:func:`ble_scan_filter_add` function.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, this is not part of this PR, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, fixed now.

@eivindj-nordic eivindj-nordic requested a review from anhmolt May 26, 2026 08:30
@PizzaAllTheWay PizzaAllTheWay force-pushed the ble-scan-manufacturer-filter branch from 4799e8a to 7ea2315 Compare June 2, 2026 14:16
Add ble_adv_data_manufacturer_data_find() to locate
manufacturer-specific data in an advertising payload and prefix-match
it against a target value. Follows the pattern of existing _find
helpers for name, uuid and appearance.

Modified unit tests to align with changes.
Added changelog.

Signed-off-by: Martynas Smilingis <martynas.smilingis@nordicsemi.no>
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>
Port the manufacturer data scan filter from NCS to Bare Metal. Adds
BLE_SCAN_MANUFACTURER_DATA_FILTER type, manufacturer_data_filter_match
flag in ble_scan_filter_match, and plumbing through
ble_scan_filter_add, ble_scan_filters_enable, ble_scan_filters_disable,
ble_scan_all_filter_remove and the adv report event handler.

New Kconfig options:
  - CONFIG_BLE_SCAN_MANUFACTURER_DATA_COUNT
  - CONFIG_BLE_SCAN_MANUFACTURER_DATA_MAX_LEN

Modified unit tests to align with changes.
Added changelog.

Signed-off-by: Martynas Smilingis <martynas.smilingis@nordicsemi.no>
@PizzaAllTheWay PizzaAllTheWay force-pushed the ble-scan-manufacturer-filter branch from 7ea2315 to d71f75f Compare June 2, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-required PR must not be merged without tech writer approval.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants