discoverModules

abstract suspend fun discoverModules(timeOut: CmScanDuration = CmScanDuration.MEDIUM): Flow<List<CmModule>>

Discovers available Comodule modules within a specified timeout period.

If needed, can be safely cancelled before the specified timeOut:

val discoverJob = launch {
discoverModules().collect {
// handle discovered modules
}
}
delay(2.seconds)
discoverJob.cancel()

Please note that if any device is already connected to a nearby Comodule module over BLE, it can not be discovered or connected to due to BLE limitations. The other connection needs to be terminated first.

Return

A Flow emitting lists of discovered CmModule instances.

Parameters

timeOut

The duration to perform the scan for discovering modules. Default is CmScanDuration.MEDIUM.

See also