cleanup
This commit is contained in:
parent
c4fc95768e
commit
4fc0a34785
4 changed files with 5 additions and 7 deletions
|
@ -99,7 +99,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
statusChecker = Runnable {
|
||||
refreshStatusOnUnacknowledgedCommands()
|
||||
updatePodWarnings()
|
||||
createFakeTBRWhenNoActivePod()
|
||||
// createFakeTBRWhenNoActivePod()
|
||||
// TODO: this is called from the main thread
|
||||
handler.postDelayed(statusChecker, STATUS_CHECK_INTERVAL_MS)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -186,7 +186,6 @@ class OmnipodDashBleManagerImpl @Inject constructor(
|
|||
throw BusyException()
|
||||
}
|
||||
try {
|
||||
|
||||
if (podState.ltk != null) {
|
||||
emitter.onNext(PodEvent.AlreadyPaired)
|
||||
emitter.onComplete()
|
||||
|
@ -222,7 +221,6 @@ class OmnipodDashBleManagerImpl @Inject constructor(
|
|||
if (BuildConfig.DEBUG) {
|
||||
aapsLogger.info(LTag.PUMPCOMM, "Got LTK: ${pairResult.ltk.toHex()}")
|
||||
}
|
||||
|
||||
emitter.onNext(PodEvent.EstablishingSession)
|
||||
establishSession(pairResult.msgSeq)
|
||||
emitter.onNext(PodEvent.Connected)
|
||||
|
@ -241,8 +239,6 @@ class OmnipodDashBleManagerImpl @Inject constructor(
|
|||
}
|
||||
|
||||
companion object {
|
||||
const val MAX_NUMBER_OF_CONNECTION_ATTEMPTS = 2
|
||||
const val CONTROLLER_ID = 4242 // TODO read from preferences or somewhere else.
|
||||
private const val CONNECT_TIMEOUT_MULTIPLIER = 4
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class ServiceDiscoverer(
|
|||
bleCallbacks.waitForServiceDiscovery(it)
|
||||
}
|
||||
connectionWaitCond.stopConnection?.let {
|
||||
while (!bleCallbacks.waitForConnection(STOP_CONNECTING_CHECK_INTERVAL_MS)) {
|
||||
while (!bleCallbacks.waitForServiceDiscovery(STOP_CONNECTING_CHECK_INTERVAL_MS)) {
|
||||
if (it.count == 0L) {
|
||||
throw ConnectException("stopConnecting called")
|
||||
}
|
||||
|
|
|
@ -66,12 +66,13 @@ class BleCommCallbacks(
|
|||
serviceDiscoveryComplete = CountDownLatch(1)
|
||||
}
|
||||
|
||||
fun waitForServiceDiscovery(timeoutMs: Long) {
|
||||
fun waitForServiceDiscovery(timeoutMs: Long): Boolean {
|
||||
try {
|
||||
serviceDiscoveryComplete.await(timeoutMs, TimeUnit.MILLISECONDS)
|
||||
} catch (e: InterruptedException) {
|
||||
aapsLogger.warn(LTag.PUMPBTCOMM, "Interrupted while waiting for ServiceDiscovery")
|
||||
}
|
||||
return serviceDiscoveryComplete.count == 0L
|
||||
}
|
||||
|
||||
fun confirmWrite(expectedPayload: ByteArray, expectedUUID: String, timeoutMs: Long): WriteConfirmation {
|
||||
|
|
Loading…
Reference in a new issue