Add descriptor read and write API - #279
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds cross-platform support for reading and writing GATT characteristic descriptor values (e.g., 0x2901 / 0x2902) through the existing Universal BLE API surface, addressing Issue #250.
Changes:
- Adds new Pigeon/platform-interface APIs:
readDescriptorValue/writeDescriptorValue, plus high-levelUniversalBle.readDescriptor/UniversalBle.writeDescriptor. - Implements descriptor read/write on Windows, Android, Darwin (iOS/macOS), Linux (BlueZ), and Web.
- Updates examples and tests to exercise descriptor read/write flows.
Reviewed changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| windows/src/universal_ble_plugin.h | Declares Windows plugin descriptor read/write methods. |
| windows/src/universal_ble_plugin.cpp | Implements Windows descriptor read/write via GATT descriptor APIs. |
| windows/src/generated/universal_ble.g.h | Updates generated Windows Pigeon interface with descriptor APIs. |
| windows/src/generated/universal_ble.g.cpp | Wires Windows message channels for descriptor read/write. |
| pigeon/universal_ble.dart | Adds descriptor read/write to the Pigeon definition. |
| lib/src/interfaces/universal_ble_platform_interface.dart | Extends platform interface with descriptor read/write. |
| lib/src/universal_ble.g.dart | Adds Dart-side generated channel calls for descriptor read/write. |
| lib/src/universal_ble_pigeon/universal_ble_pigeon_channel.dart | Implements descriptor APIs for the Pigeon-backed platform implementation. |
| lib/src/universal_ble.dart | Adds public UniversalBle.readDescriptor / writeDescriptor APIs with queueing/UUID parsing. |
| lib/src/universal_ble_web/universal_ble_web.dart | Implements Web descriptor read/write + descriptor lookup helper. |
| lib/src/universal_ble_linux/universal_ble_linux.dart | Implements BlueZ descriptor lookup + read/write. |
| android/src/main/kotlin/com/navideck/universal_ble/UniversalBle.g.kt | Updates generated Android Pigeon bindings for descriptor APIs. |
| android/src/main/kotlin/com/navideck/universal_ble/UniversalBleHelper.kt | Adds Android future types for descriptor read/write completions. |
| android/src/main/kotlin/com/navideck/universal_ble/UniversalBlePlugin.kt | Implements Android descriptor read/write and completion handling. |
| darwin/universal_ble/Sources/universal_ble/UniversalBle.g.swift | Updates generated Swift Pigeon bindings for descriptor APIs. |
| darwin/universal_ble/Sources/universal_ble/UniversalBleHelper.swift | Adds descriptor lookup helper and new “future” structs. |
| darwin/universal_ble/Sources/universal_ble/UniversalBlePlugin.swift | Implements Darwin descriptor read/write, including CCCD special handling. |
| test/universal_ble_test_mock.dart | Extends the platform mock surface with descriptor methods. |
| test/ble_characteristic_test.dart | Adds a test covering write/read descriptor behavior using mocks. |
| example/lib/data/mock_universal_ble.dart | Extends example mock with descriptor read/write. |
| example/lib/peripheral_details/widgets/services_list_widget.dart | Updates UI to surface descriptors and pass selected descriptor on taps. |
| example/lib/peripheral_details/peripheral_detail_page.dart | Adds example read/write descriptor UI and enables descriptor discovery. |
Suppressed comments (1)
windows/src/universal_ble_plugin.cpp:654
- Error message has a typo ("devicesId") which is inconsistent with the rest of the API surface (deviceId) and leaks into user-facing errors.
result(create_flutter_error(UniversalBleErrorCode::kDeviceNotFound,
"Unknown devicesId:" + device_id));
return;
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
fotiDim
force-pushed
the
add-descriptor-read-and-write-api
branch
from
August 11, 2026 15:26
84fa80f to
13743a2
Compare
fotiDim
reviewed
Aug 11, 2026
fotiDim
approved these changes
Aug 12, 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.
Resolves: #250