mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2026-01-11 18:54:27 +01:00
Use wait for bonding properly
This commit is contained in:
@@ -170,13 +170,13 @@ internal class GLSViewModel @Inject constructor(
|
||||
.onEach { unlockUiIfDisconnected(it, device) }
|
||||
.launchIn(viewModelScope)
|
||||
|
||||
client.waitForBonding()
|
||||
|
||||
if (!client.isConnected) {
|
||||
_state.value = _state.value.copy(deviceName = device.name)
|
||||
return@launch
|
||||
}
|
||||
|
||||
client.waitForBonding()
|
||||
|
||||
client.discoverServices()
|
||||
.filterNotNull()
|
||||
.onEach { configureGatt(it, device) }
|
||||
|
||||
@@ -107,6 +107,8 @@ internal class HRSService : NotificationService() {
|
||||
.onEach { unlockUiIfDisconnected(it, device) }
|
||||
.launchIn(lifecycleScope)
|
||||
|
||||
client.waitForBonding()
|
||||
|
||||
if (!client.isConnected) {
|
||||
hasBeenInitialized = true
|
||||
repository.onInitComplete(device)
|
||||
|
||||
Reference in New Issue
Block a user