runCatchingOnConnection

protected suspend fun runCatchingOnConnection(block: suspend () -> Unit): Boolean

Executes the given block when the peripheral is connected.

This method ignores exceptions thrown by block, so that connection could finish, except a lost link, reported as false, and cancellation of the calling coroutine, also by a timeout of an outer withTimeout, which is rethrown.

Return

false if the link was lost; true otherwise.