Breaking: Add bondMode option to ConnectOptions for native BLE#123
Open
microbit-matt-hillsdon wants to merge 1 commit intoappsfrom
Open
Breaking: Add bondMode option to ConnectOptions for native BLE#123microbit-matt-hillsdon wants to merge 1 commit intoappsfrom
microbit-matt-hillsdon wants to merge 1 commit intoappsfrom
Conversation
The native connect() flow previously assumed the caller intended to flash: after a new bond it always reset the device into pairing mode. This is wrong for two other common scenarios: 1. BLE-enabled firmware, interact with services (sensors, UART, LEDs): The device should end up in application mode, not pairing mode. bondMode: "application" handles this — it still bonds if needed (required to get past the firmware whitelist on first connection) but resets to application mode instead of pairing mode. 2. Open-link firmware, no bonding needed: bondMode: "none" skips createBond() on Android and the iOS pairing trigger entirely, avoiding an unnecessary pairing dialog and the 15s post-bond firmware reset. The default for connect() is now "application". flash() explicitly passes bondMode: "pairing" internally, so the flash flow is unchanged. On web, bondMode is ignored — the browser manages pairing transparently via the OS when accessing encrypted characteristics. The demo app gains a Bond mode selector (native Bluetooth only) to exercise all three modes. This is breaking for connect then flash scenarios over unknown firmware which now need to pass bondMode: pairing. Fixes #118
Contributor
Author
|
For discussion/experimentation rather than a quick review + merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The native connect() flow previously assumed the caller intended to flash: after a new bond it always reset the device into pairing mode. This is wrong for two other common scenarios:
BLE-enabled firmware, interact with services (sensors, UART, LEDs): The device should end up in application mode, not pairing mode. bondMode: "application" handles this — it still bonds if needed (required to get past the firmware whitelist on first connection) but resets to application mode instead of pairing mode.
Open-link firmware, no bonding needed: bondMode: "none" skips createBond() on Android and the iOS pairing trigger entirely, avoiding an unnecessary pairing dialog and the 15s post-bond firmware reset.
The default for connect() is now "application". flash() explicitly passes bondMode: "pairing" internally, so the flash flow is unchanged.
On web, bondMode is ignored — the browser manages pairing transparently via the OS when accessing encrypted characteristics (well, so Claude claims, we need more practical experience here). But either way we for sure can't trigger it.
The demo app gains a Bond mode selector (native Bluetooth only) to exercise all three modes.
This is breaking for connect then flash scenarios over unknown firmware which now need to pass
bondMode: "pairing". Folks who just call flash will be OK.Fixes #118