execute

suspend fun execute(attempt: suspend () -> BleReconnectPolicy.Outcome, onTransientDisconnect: suspend (Throwable?) -> Unit, onPermanentDisconnect: suspend (Throwable?) -> Unit)(source)

Runs the reconnect loop, calling attempt for each iteration.

The attempt lambda should perform a single connect-and-wait cycle and return the Outcome when the connection drops or an error occurs.

Parameters

attempt

performs a single connection attempt and returns the outcome

onTransientDisconnect

called when the policy decides to signal a transient disconnect

onPermanentDisconnect

called when the policy gives up permanently