Windows: harden BLE connection and GATT lifetimes - #284
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Hardens Windows BLE asynchronous lifecycles and improves Dart-side value handling.
Changes:
- Adds connection generations, operation leases, shutdown tracking, and GATT refresh handling.
- Strengthens notification subscription and descriptor-operation behavior.
- Normalizes characteristic buffers and returns descriptor values from convenience APIs.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
windows/test/CMakeLists.txt |
Configures the tracker test. |
windows/test/async_operation_tracker_test.cpp |
Tests lease and shutdown behavior. |
windows/src/universal_ble_plugin.h |
Adds lifecycle and GATT state management. |
windows/src/universal_ble_plugin.cpp |
Implements Windows BLE hardening. |
windows/src/ui_thread_handler.hpp |
Coalesces and shuts down UI work. |
windows/src/helper/universal_ble_logger.h |
Makes logger state atomic. |
windows/src/helper/universal_ble_logger.cpp |
Implements atomic level access. |
windows/src/async_operation_tracker.h |
Introduces asynchronous-operation leases. |
windows/CMakeLists.txt |
Includes the tracker header. |
test/device_id_case_insensitivity_test.dart |
Tests buffer normalization. |
test/ble_characteristic_test.dart |
Tests descriptor reads. |
lib/src/interfaces/universal_ble_platform_interface.dart |
Normalizes received byte buffers. |
lib/src/extensions/ble_characteristic_extension.dart |
Returns descriptor read values. |
CHANGELOG.md |
Documents Windows hardening. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
@usmanmehmood55 please check the CoPilot review comments when you get the chance. We plan to make a release within the week. |
Contributor
Author
|
@fotiDim I've applied the changes pointed out by Copilot, waiting to access a Windows machine to run the HIL tests again. I'll push the changes in 2 hours or so. |
Contributor
Author
|
PR comments addressed, with all hardware in loop and fault injection tests passing for Windows. |
fotiDim
approved these changes
Aug 24, 2026
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
This PR hardens the Windows BLE implementation around asynchronous connection, GATT-operation, subscription, and shutdown lifecycles.
Changes
GattServicesChangedby refreshing the GATT map safely and restoring notification handlers for existing subscriptions.value.buffer.BleCharacteristic.readDescriptor().Validation
All current HIL tests were run:
Also manually verified: