Blue-Falcon

Kotlin Multiplatform BLE library for iOS, Android, macos, windows and javascript

View the Project on GitHub Reedyuk/blue-falcon

ADR 0004: Expose Characteristic Notification Events to Consumers and Plugins

Status: Accepted

Date: 2026-04-18

Deciders: Blue Falcon maintainers

Technical Story: Issue: “Expose subscribed characteristic notifications to consumers (Flow / plugin hook / delegate)”

Context

Blue Falcon 3.0 engines received native notification callbacks from BLE stacks, but payloads were not propagated through the 3.0 API surface. This prevented applications and plugins from reliably consuming notification streams for protocols built on indications/notifications.

The legacy wrapper also lacked wiring from engine callback events to BlueFalconDelegate.didCharacteristcValueChanged, so only explicit reads triggered that callback.

Decision

We will expose characteristic notification payloads through two coordinated mechanisms:

  1. Add notifications: SharedFlow<ByteArray> to BluetoothCharacteristic.
  2. Add engine-level notification events (CharacteristicNotification) and dispatch them from core BlueFalcon to plugins via BlueFalconPlugin.onNotificationReceived(peripheral, characteristic, value).

Engine native callback paths now emit both:

Consequences

Positive

Negative

Neutral

Alternatives Considered

Alternative 1: Keep polling characteristic.value

Pros:

Cons:

Why not chosen: Does not provide reliable notification-stream consumption.

Alternative 2: Plugin-only notification hook without characteristic flow

Pros:

Cons:

Why not chosen: We need both app-level reactive consumption and plugin extensibility.

Implementation Notes