Skip to content

fix(windows): retry transient GATT discovery failures - #311

Merged
fotiDim merged 1 commit into
Navideck:mainfrom
usmanmehmood55:fix/windows-scan-fail
Sep 25, 2026
Merged

fotiDim merged 1 commit into
Navideck:mainfrom
usmanmehmood55:fix/windows-scan-fail

Conversation

@usmanmehmood55

Copy link
Copy Markdown
Contributor

Summary

This PR improves Windows BLE connections made immediately after device discovery. Windows can transiently report GATT services as Unreachable while establishing the underlying connection, causing the first attempt to fail even though the device is available.

Changes

  • Retry uncached GATT service discovery when Windows temporarily reports Unreachable.
  • Keep the retry bounded to two additional attempts with a short progressive delay.
  • Retry only transient reachability failures. Authorization and protocol errors still fail immediately.
  • Avoid using cached services as evidence of a live connection.
  • Map native Windows connection failures to the corresponding Dart error codes.
  • Match only exact Windows callback messages to avoid misclassifying unrelated errors.
  • Add unit coverage for unreachable devices, missing devices, access denial, protocol errors, and unrelated messages.
  • Add a Windows HIL scenario covering 20 repeated scan, immediate connection, service-discovery, and GATT-read cycles.
  • Document the behavior change in the changelog.

Validation

  • flutter analyze passed.
  • flutter test passed with 114 tests.
  • Windows release build completed successfully.
  • Hardware-in-loop tests, as well as manual testing

- Retry only Unreachable service discovery results during immediate post-scan connections.
- Keep authorization and protocol failures immediate, with exact Dart error classification.
- Add a repeated cold-connect HIL scenario and document the Windows fix.
@fotiDim
fotiDim merged commit 245195c into Navideck:main Sep 25, 2026
3 checks passed
@usmanmehmood55
usmanmehmood55 deleted the fix/windows-scan-fail branch September 28, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants