New discoveryServices() method

This commit is contained in:
Sylwester Zielinski
2023-04-24 11:58:28 +02:00
parent 27a5601d2a
commit 878d36aff4
9 changed files with 14 additions and 10 deletions

View File

@@ -130,7 +130,7 @@ internal class BPSViewModel @Inject constructor(
.onEach { logAnalytics(it.state) }
.launchIn(viewModelScope)
client.services
client.discoverServices()
.filterNotNull()
.onEach { configureGatt(it) }
.launchIn(viewModelScope)

View File

@@ -146,7 +146,7 @@ internal class CGMService : NotificationService() {
.onEach { stopIfDisconnected(it) }
.launchIn(lifecycleScope)
client.services
client.discoverServices()
.filterNotNull()
.onEach { configureGatt(it) }
.launchIn(lifecycleScope)

View File

@@ -102,7 +102,7 @@ internal class CSCService : NotificationService() {
.onEach { stopIfDisconnected(it) }
.launchIn(lifecycleScope)
client.services
client.discoverServices()
.filterNotNull()
.onEach { configureGatt(it, device) }
.launchIn(lifecycleScope)

View File

@@ -168,7 +168,7 @@ internal class GLSViewModel @Inject constructor(
.onEach { logAnalytics(it) }
.launchIn(viewModelScope)
client.services
client.discoverServices()
.filterNotNull()
.onEach { configureGatt(it, device) }
.launchIn(viewModelScope)

View File

@@ -104,7 +104,7 @@ internal class HRSService : NotificationService() {
.onEach { stopIfDisconnected(it) }
.launchIn(lifecycleScope)
client.services
client.discoverServices()
.filterNotNull()
.onEach { configureGatt(it, device) }
.launchIn(lifecycleScope)

View File

@@ -102,7 +102,7 @@ internal class HTSService : NotificationService() {
.onEach { stopIfDisconnected(it) }
.launchIn(lifecycleScope)
client.services
client.discoverServices()
.filterNotNull()
.onEach { configureGatt(it, device) }
.launchIn(lifecycleScope)

View File

@@ -172,7 +172,7 @@ internal class PRXService : NotificationService() {
.onEach { stopIfDisconnected(it.state, it.status) }
.launchIn(lifecycleScope)
client.services
client.discoverServices()
.filterNotNull()
.onEach { configureGatt(it, device) }
.launchIn(lifecycleScope)

View File

@@ -102,7 +102,7 @@ internal class RSCSService : NotificationService() {
.onEach { stopIfDisconnected(it) }
.launchIn(lifecycleScope)
client.services
client.discoverServices()
.filterNotNull()
.onEach { configureGatt(it, device) }
.launchIn(lifecycleScope)

View File

@@ -97,6 +97,10 @@ internal class UARTService : NotificationService() {
client = device.connect(this@UARTService, logger = logger)
Log.d("AAATESTAAA","connect finish")
client.requestMtu(Mtu.max)
repository.loggerEvent
.onEach { logger.launch() }
.launchIn(lifecycleScope)
@@ -107,7 +111,7 @@ internal class UARTService : NotificationService() {
.onEach { stopIfDisconnected(it) }
.launchIn(lifecycleScope)
client.services
client.discoverServices()
.filterNotNull()
.onEach { configureGatt(it, device, logger) }
.launchIn(lifecycleScope)
@@ -136,7 +140,7 @@ internal class UARTService : NotificationService() {
.onEach { logger.log(10, "Sent: $it") }
.launchIn(lifecycleScope)
client.requestMtu(Mtu.max)
repository.onInitComplete(device)
}