Skip to content

Add descriptor read and write API - #279

Merged
fotiDim merged 7 commits into
mainfrom
add-descriptor-read-and-write-api
Aug 12, 2026
Merged

Add descriptor read and write API#279
fotiDim merged 7 commits into
mainfrom
add-descriptor-read-and-write-api

Conversation

@rohitsangwan01

@rohitsangwan01 rohitsangwan01 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Resolves: #250

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-level UniversalBle.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.

Comment thread windows/src/universal_ble_plugin.cpp Outdated
Comment thread darwin/universal_ble/Sources/universal_ble/UniversalBlePlugin.swift
@rohitsangwan01
rohitsangwan01 requested a review from fotiDim August 11, 2026 14:30
@fotiDim
fotiDim force-pushed the add-descriptor-read-and-write-api branch from 84fa80f to 13743a2 Compare August 11, 2026 15:26
Comment thread README.md Outdated
@fotiDim fotiDim changed the title Add descriptor read and write api Add descriptor read and write API Aug 12, 2026
@fotiDim
fotiDim merged commit 6973691 into main Aug 12, 2026
2 checks passed
@fotiDim
fotiDim deleted the add-descriptor-read-and-write-api branch August 12, 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.

Read a GATT Characteristic Descriptor

3 participants