Repository navigation
Conversation
A failed BLE_GAP_EVENT_ENC_CHANGE only ended a numeric-comparison wait, so after a failed pair() the status stayed PAIR_WAITING. pair() then waited until Ctrl-C or a disconnect, and returned without raising. Store the NimBLE status from ENC_CHANGE and end the wait on failure. pair() now raises ConnectionError if the link dropped, and otherwise SecurityError with the same messages as nordic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Diagnosis and code by Claude, reviewed by @dhalbert.
Problem
pair()waited until Ctrl-C or a disconnect, and then returned without raising an exception.BLE_GAP_EVENT_ENC_CHANGEonly ended a numeric-comparison wait, so the status stayedPAIR_WAITING. The failure status was discarded.Fix
BLE_GAP_EVENT_ENC_CHANGEis now stored, and a failure ends the wait.pair()then raises:ConnectionError: Not connectedif the link dropped.SecurityErrorwith the same messages as nordic: "Unspecified issue. The pairing request on the other device may have been declined or ignored." for SM reason 0x08, otherwise "Unknown security error: 0x%04x" with the NimBLE status.Testing
Metro ESP32-S3 with this PR as central:
SecurityError: Unknown security error: 0x0505(peer: Pairing Not Supported)SecurityError: Unknown security error: 0x000d(SM timeout) after 30 sConnectionError: Not connectedReason 0x08 was not tested.