Repository navigation
Conversation
donavanbecker
pushed a commit
that referenced
this pull request
Oct 25, 2026
BLEConnection logged "Unexpected disconnect" for every disconnect it started itself (the idle timer after each command, disconnectAll, a failed connection), because nothing marked them as expected. Meanwhile a disconnect started by the device (out of range, powered off) was never noticed: the dead peripheral stayed in the connection map and the next command reused it. - disconnect() is always intentional: it logs at debug level. - A 'disconnect' listener on the peripheral drops the connection state (characteristics, encryption, pending reply) and warns only when the device dropped the link; markExpectedDisconnect() silences that warning. - The characteristic-discovery failure path uses disconnect(). Supersedes #348. Co-authored-by: dnicolson <dnicolson@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TYWa2RXoWsaUTWh76oNv8s
donavanbecker
pushed a commit
that referenced
this pull request
Oct 25, 2026
BLEConnection logged "Unexpected disconnect" for every disconnect it started itself (the idle timer after each command, disconnectAll, a failed connection), because nothing marked them as expected. Meanwhile a disconnect started by the device (out of range, powered off) was never noticed: the dead peripheral stayed in the connection map and the next command reused it. - disconnect() is always intentional: it logs at debug level. - A 'disconnect' listener on the peripheral drops the connection state (characteristics, encryption, pending reply) and warns only when the device dropped the link; markExpectedDisconnect() silences that warning. - The characteristic-discovery failure path uses disconnect(). Supersedes #348. Co-authored-by: dnicolson <dnicolson@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TYWa2RXoWsaUTWh76oNv8s
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.
♻️ Current situation
After BLE operations, "Unexpected disconnect" is logged:
💡 Proposed solution
Fix logging.