observe

open override fun observe(characteristic: BleCharacteristic): Flow<ByteArray>(source)


open override fun observe(characteristic: BleCharacteristic, onSubscription: suspend () -> Unit): Flow<ByteArray>(source)

Overrides the 2-arg observe to prevent false subscriptionReady when testing pre-readiness failures.

The default BleService implementation calls observe(characteristic).onStart { onSubscription() }, which would invoke onSubscription BEFORE any pre-collection failure flow throws. This override throws BEFORE invoking onSubscription, correctly simulating "observe failed before CCCD/subscription readiness."

Pre-readiness failures are sourced (in priority order) from:

For characteristics in observeNeverSubscribeCharacteristics, onSubscription is never invoked but notifications are still exposed — the returned flow is the bare SharedFlow with no onStart wrap, so emitNotification still reaches active collectors.