Skip to content

Add QueueType.auto as default queueing - #304

Merged
fotiDim merged 5 commits into
mainfrom
feature/default-platform-queue
Sep 8, 2026
Merged

fotiDim merged 5 commits into
mainfrom
feature/default-platform-queue

Conversation

@fotiDim

@fotiDim fotiDim commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #297

Description

Adds a new QueueType.auto value that automatically selects the best queueing strategy per platform, without changing any native layer.

  • Android → resolves to a per-device queue (its native BLE stack enforces a single-operation state machine via mDeviceBusy, so serialization is required).
  • All other platforms (Apple, Linux, Windows, Web) → resolves to no queueing (none), since they pipeline natively. This eliminates the Dart-level head-of-line blocking that caused the write throughput degradation on Apple (see [Bug]: QueueType global and perDevice degradation on Apple #271).

auto is now the default for both UniversalBle.queueType and UniversalBlePeripheral.queueType, achieving the issue's "zero-configuration concurrency" goal.

Changes

  • lib/src/models/queue_type.dart: added auto enum value
  • lib/src/utils/ble_command_queue.dart: _resolvedQueueType getter maps autoperDevice on Android, none elsewhere; new default
  • lib/src/universal_ble.dart / lib/src/universal_ble_peripheral.dart: updated doc comments
  • example/lib/home/home.dart: default to auto; toggle cycles all four values
  • README.md / CHANGELOG.md: documented the new default and behavior
  • test/ble_command_queue_test.dart: existing default-global tests made explicit; added tests verifying Android queues per-device vs non-Android parallel (via debugDefaultTargetPlatformOverride)

Verification

  • flutter analyze — clean (package and example)
  • flutter test — all 108 tests pass

defaultPlatform resolves to a per-device queue on Android (its native
BLE stack rejects overlapping operations) and to no queueing on all
other platforms, which pipeline natively. It is now the default for
both UniversalBle and UniversalBlePeripheral.
@fotiDim fotiDim changed the title Add QueueType.defaultPlatform to auto-select queueing per platform Add QueueType.defaultPlatform as default queueing (breaking) — v3.0.0 Sep 8, 2026
@fotiDim fotiDim changed the title Add QueueType.defaultPlatform as default queueing (breaking) — v3.0.0 Add QueueType.auto as default queueing (breaking) — v3.0.0 Sep 8, 2026
@fotiDim fotiDim changed the title Add QueueType.auto as default queueing (breaking) — v3.0.0 Add QueueType.auto as default queueing Sep 8, 2026
@fotiDim
fotiDim merged commit f6a4178 into main Sep 8, 2026
3 checks passed
@fotiDim
fotiDim deleted the feature/default-platform-queue branch September 8, 2026 10:51
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.

Move BLE serialization to native layer to fix write throughput degradation

2 participants