Add BLE pairing-mode flag and stale bond recovery#105
Merged
zjwhitehead merged 4 commits intoopenppg:masterfrom Mar 27, 2026
Merged
Add BLE pairing-mode flag and stale bond recovery#105zjwhitehead merged 4 commits intoopenppg:masterfrom
zjwhitehead merged 4 commits intoopenppg:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the BLE pairing UX by advertising an explicit “pairing mode” flag for the Flutter app to filter scan results, and by adding recovery behavior for stale iOS bonds during pairing mode.
Changes:
- Add manufacturer data payload (Espressif company ID + pairing-mode flag byte) to both extended and legacy advertising paths.
- During pairing mode, proactively initiate a security exchange on connect to recover from stale iOS bonding state.
- On authentication failure during pairing mode, delete peer bond data and re-initiate pairing instead of immediately disconnecting.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Summary
Details
Manufacturer data format: Espressif company ID (0x02E5 LE) + 1 flag byte
0x01= pairing mode active (controller accepting new bonds)0x00= normal mode (only bonded devices accepted)Stale bond recovery: When iOS caches old encryption keys after a controller bond clear, the connection fails with
rc=19(BLE_ERR_UNSPECIFIED). The firmware now:ble_gap_security_initiate()to request fresh securityNimBLEDevice::deleteBond()for the peer and re-initiates pairingTest plan
🤖 Generated with Claude Code