elizarov
04/19/2017, 1:31 PMwithTimeout
. To reduce the brace level I’d suggest to introduce an auxiliary helper function:
suspend fun findFirstAvailableDevice(bleScanner: BluetoothLeScanner, timeout: Long) = withTimeout(timeout) {
findFirstAvailableDevice(bleScanner)
}