set initial basalProgram. fix handshaking state
This commit is contained in:
parent
32183aff37
commit
f9aa967b46
3 changed files with 8 additions and 3 deletions
|
@ -200,11 +200,12 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
}
|
||||
|
||||
override fun isConnecting(): Boolean {
|
||||
return stopConnecting != null && podStateManager.bluetoothConnectionState == OmnipodDashPodStateManager.BluetoothConnectionState.CONNECTING
|
||||
return stopConnecting != null
|
||||
}
|
||||
|
||||
override fun isHandshakeInProgress(): Boolean {
|
||||
return stopConnecting != null
|
||||
return stopConnecting != null &&
|
||||
podStateManager.bluetoothConnectionState == OmnipodDashPodStateManager.BluetoothConnectionState.CONNECTED
|
||||
}
|
||||
|
||||
override fun finishHandshaking() {
|
||||
|
@ -212,6 +213,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
|
||||
override fun connect(reason: String) {
|
||||
aapsLogger.info(LTag.PUMP, "connect reason=$reason")
|
||||
podStateManager.bluetoothConnectionState = OmnipodDashPodStateManager.BluetoothConnectionState.CONNECTING
|
||||
thread(
|
||||
start = true,
|
||||
name = "ConnectionThread",
|
||||
|
@ -437,7 +439,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
// TODO: what do we have to answer here if delivery is suspended?
|
||||
val running = podStateManager.basalProgram
|
||||
val equal = (mapProfileToBasalProgram(profile) == running)
|
||||
aapsLogger.info(LTag.PUMP, "isThisProfileSet: $equal")
|
||||
aapsLogger.info(LTag.PUMP, "set: $equal. profile=$profile, running=$running")
|
||||
return equal
|
||||
}
|
||||
|
||||
|
|
|
@ -218,7 +218,9 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
|||
}
|
||||
|
||||
override var bluetoothConnectionState: OmnipodDashPodStateManager.BluetoothConnectionState
|
||||
@Synchronized
|
||||
get() = podState.bluetoothConnectionState
|
||||
@Synchronized
|
||||
set(bluetoothConnectionState) {
|
||||
podState.bluetoothConnectionState = bluetoothConnectionState
|
||||
rxBus.send(EventOmnipodDashPumpValuesChanged())
|
||||
|
|
|
@ -73,6 +73,7 @@ class DashInsertCannulaViewModel @Inject constructor(
|
|||
},
|
||||
onComplete = {
|
||||
logger.debug("Pod activation part 2 completed")
|
||||
podStateManager.basalProgram = basalProgram
|
||||
pumpSync.connectNewPump()
|
||||
pumpSync.insertTherapyEventIfNewWithTimestamp(
|
||||
timestamp = System.currentTimeMillis(),
|
||||
|
|
Loading…
Reference in a new issue