MockScanner

typealias MockScanner = () -> Result<Boolean>

A callback used for a mock scanner.

This callback is called when the mock central manager starts a scan for Bluetooth LE devices, which happens each time the flow returned by its scan method is collected.

Return Result.success with true to indicate that the scan was successful and that results will be reported, or false to start the scan but not report any results. This is useful, as some devices don't report scan error in any way, but just don't report any results.

Result.failure with ScanningFailedToStartException exception will be thrown to the collector of that flow, as if ScanCallback.onScanFailed(errorCode) was called.