Skip to content

feat(transport): use Adapter.Reset() to recover stale BLE handles - #106

Merged
retr0h merged 1 commit into
mainfrom
feat/ble-adapter-reset-recovery
May 18, 2026
Merged

feat(transport): use Adapter.Reset() to recover stale BLE handles#106
retr0h merged 1 commit into
mainfrom
feat/ble-adapter-reset-recovery

Conversation

@retr0h

@retr0h retr0h commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Bumps tinygo.org/x/bluetooth to include tinygo-org/bluetooth#446 which adds Adapter.Reset()
  • Calls Reset() when connectAndWire times out on a stale CBPeripheral handle (post-sleep/wake), tearing down the central manager
  • Calls Enable() after the cached fast path fails, rebuilding fresh CoreBluetooth managers before re-scanning
  • Eliminates the need to restart the process to recover from stale BLE handles

Test plan

  • just ready passes (confirmed locally — 0 lint issues)
  • BLE reconnect after macOS sleep/wake: verify adapter resets and reconnects without process restart
  • Normal BLE disconnect/reconnect cycle still works (non-timeout path unaffected)

🤖 Generated with Claude Code

Bump tinygo.org/x/bluetooth to include tinygo-org/bluetooth#446
which adds Adapter.Reset() for in-process recovery.

When Connect times out on a stale CBPeripheral handle (post-sleep/wake),
call Reset() to tear down the central manager so the next Enable()
rebuilds from scratch. Previously this required a process restart;
now the reconnect loop recovers automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@retr0h
retr0h merged commit 790c650 into main May 18, 2026
7 checks passed
@retr0h
retr0h deleted the feat/ble-adapter-reset-recovery branch May 18, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants