docs: fix KDoc inconsistencies in transport files

- BleReconnectPolicy: clarify maxFailures param documents Int.MAX_VALUE
  disables the give-up path; remove misleading 'give up permanently'
- StreamTransport.onDeviceDisconnect: fix confusing 'wait for it to come
  back' sentence in KDoc summary
- BleRadioTransportTest: import VerifyMode instead of fully-qualifying

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
James Rich 2026-04-20 07:52:35 -05:00
parent 805f9a3cd2
commit f5cbaf8ad6
3 changed files with 7 additions and 5 deletions

View file

@ -26,10 +26,11 @@ import kotlin.time.Duration.Companion.seconds
/**
* Encapsulates the BLE reconnection policy with exponential backoff.
*
* The policy tracks consecutive failures and decides whether to retry, signal a transient disconnect (DeviceSleep), or
* give up permanently.
* The policy tracks consecutive failures and decides whether to retry or signal a transient disconnect (DeviceSleep).
* When [maxFailures] is reached the [execute] loop invokes [execute]'s `onPermanentDisconnect` callback and returns;
* set [maxFailures] to [Int.MAX_VALUE] (as [BleRadioTransport] does) to disable the give-up path entirely.
*
* @param maxFailures maximum consecutive failures before giving up permanently
* @param maxFailures maximum consecutive failures before giving up; use [Int.MAX_VALUE] to retry indefinitely
* @param failureThreshold after this many consecutive failures, signal a transient disconnect
* @param settleDelay delay before each connection attempt to let the BLE stack settle
* @param minStableConnection minimum time a connection must stay up to be considered "stable"

View file

@ -41,7 +41,7 @@ abstract class StreamTransport(protected val callback: RadioTransportCallback, p
}
/**
* Notify the transport callback that our device has gone away, but wait for it to come back.
* Signals the transport callback that the device has disconnected and optionally waits for the transport to stop.
*
* @param waitForStopped if true we should wait for the transport to finish - must be false if called from inside
* transport callbacks

View file

@ -22,6 +22,7 @@ import dev.mokkery.every
import dev.mokkery.matcher.any
import dev.mokkery.mock
import dev.mokkery.verify
import dev.mokkery.verify.VerifyMode
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.advanceTimeBy
@ -165,7 +166,7 @@ class BleRadioTransportTest {
// Transient disconnects (isPermanent = false) are expected once the failure threshold is hit;
// the policy must NEVER signal a permanent disconnect on its own. Only explicit close()
// (verified separately by the service layer) may emit isPermanent = true.
verify(mode = dev.mokkery.verify.VerifyMode.not) {
verify(mode = VerifyMode.not) {
service.onDisconnect(isPermanent = true, errorMessage = any())
}