Skip to content

BLE advertising improvements#723

Merged
ArekBalysNordic merged 2 commits into
nrfconnect:masterfrom
adigie:check-identity
May 28, 2026
Merged

BLE advertising improvements#723
ArekBalysNordic merged 2 commits into
nrfconnect:masterfrom
adigie:check-identity

Conversation

@adigie
Copy link
Copy Markdown
Member

@adigie adigie commented May 27, 2026

Summary

This PR adds multi BT indentity support and fixes advertising restart when multiple identities share the connection pool.

  • Add CHIP_BLE_MULTI_IDENTITY_SUPPORT Kconfig option that guards code for handling multiple BT identities.
  • Restrict BLE manager and advertising arbiter to the Matter BLE identity (kMatterBleIdentity).
  • Replace the advertising restart flag with an atomic flag and retry restart when bt_le_adv_start() fails due to lack of available connection object.

Testing

Tested with a second BT identity used by Aliro.

adigie added 2 commits May 27, 2026 10:05
Add `CHIP_BLE_MULTI_IDENTITY_SUPPORT` Kconfig option. Filter Matter BLE
manager and advertising arbiter callbacks to only handle connections on
the Matter BLE identity.

Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no>
Replace the sWasDisconnection flag with an atomic restart flag so
advertising can be retried when bt_le_adv_start() fails due to lack
of available connection object.

With CONFIG_CHIP_BLE_MULTI_IDENTITY_SUPPORT, disconnect and recycled
callbacks can arrive in an order where a restart attempt runs before
all connection slots are available. Re-arm the flag on failure so a
subsequent recycled callback schedules another restart attempt.

Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves Zephyr BLE advertising behavior when multiple Bluetooth identities exist, adding a Kconfig gate for multi-identity handling, filtering Matter BLE traffic to the Matter identity, and making advertising restart more robust when connection objects are temporarily unavailable.

Changes:

  • Add CHIP_BLE_MULTI_IDENTITY_SUPPORT Kconfig option to enable multi-identity filtering behavior.
  • Filter Matter BLE GATT/connection callbacks to only handle the Matter identity (kMatterBleIdentity).
  • Replace the previous restart boolean with an atomic restart flag and retry logic tied to connection object recycling.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/platform/Zephyr/BLEManagerImpl.cpp Filters Matter BLE handlers to only accept connections on the Matter BLE identity.
src/platform/Zephyr/BLEAdvertisingArbiter.cpp Uses an atomic restart flag and retries connectable advertising after recycled callbacks.
config/nrfconnect/chip-module/Kconfig Introduces CHIP_BLE_MULTI_IDENTITY_SUPPORT configuration option.

Comment thread src/platform/Zephyr/BLEAdvertisingArbiter.cpp
Comment thread src/platform/Zephyr/BLEManagerImpl.cpp

#ifdef CONFIG_CHIP_BLE_MULTI_IDENTITY_SUPPORT

bool IsMatterIdentity(const bt_conn * conn)
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.

Consider defining it always, but simply return true for !CONFIG_CHIP_BLE_MULTI_IDENTITY_SUPPORT. This will reduce the number of ifdefs in the code.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think that could be confusing, maybe it would be better to define something like ShouldProcessConnection and use IsMatterIdentity inside. Let's keep it as is for now.

Comment thread src/platform/Zephyr/BLEAdvertisingArbiter.cpp
@ArekBalysNordic ArekBalysNordic merged commit 6d8ea97 into nrfconnect:master May 28, 2026
12 of 18 checks passed
@adigie adigie deleted the check-identity branch May 28, 2026 10:05
NordicBuilder added a commit to NordicBuilder/sdk-nrf that referenced this pull request May 28, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-connectedhomeip#723

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
nordicjm pushed a commit to nrfconnect/sdk-nrf that referenced this pull request May 28, 2026
Automatically created by action-manifest-pr GH action from PR:
nrfconnect/sdk-connectedhomeip#723

Signed-off-by: Nordic Builder <pylon@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants