sync alarm. bugfix on pod deactivation

This commit is contained in:
Andrei Vereha 2021-08-02 22:47:36 +02:00
parent a77a0b21fb
commit 770a58abd2
3 changed files with 23 additions and 2 deletions

View file

@ -328,6 +328,15 @@ class OmnipodDashPumpPlugin @Inject constructor(
Notification.URGENT,
R.raw.boluserror
)
if (!podStateManager.alarmSynced) {
pumpSync.insertAnnouncement(
error = podStateManager.alarmType?.toString() ?: "Unknown pod failure",
pumpId = Random.Default.nextLong(),
pumpType = PumpType.OMNIPOD_DASH,
pumpSerial = serialNumber()
)
podStateManager.alarmSynced = true
}
}
Completable.complete()
}
@ -1068,7 +1077,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
private fun deactivatePod(): PumpEnactResult {
val ret = executeProgrammingCommand(
historyEntry = history.createRecord(OmnipodCommandType.DEACTIVATE_POD),
command = omnipodManager.deactivatePod().ignoreElements()
command = omnipodManager.deactivatePod().ignoreElements(),
checkNoActiveCommand = false,
).doOnComplete {
rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_FAULT))
}.toPumpEnactResult()

View file

@ -41,6 +41,7 @@ interface OmnipodDashPodStateManager {
val time: ZonedDateTime?
val timeDrift: java.time.Duration?
val expiry: ZonedDateTime?
var alarmSynced: Boolean
val messageSequenceNumber: Short
val sequenceNumberOfLastProgrammingCommand: Short?

View file

@ -233,6 +233,13 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
return null
}
override var alarmSynced: Boolean
get() = podState.alarmSynced
set(value) {
podState.alarmSynced = value
store()
}
override var bluetoothConnectionState: OmnipodDashPodStateManager.BluetoothConnectionState
@Synchronized
get() = podState.bluetoothConnectionState
@ -498,8 +505,10 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
podState.lastStatusResponseReceived = 0
}
CommandSendingFailure, NoActiveCommand ->
CommandSendingFailure, NoActiveCommand -> {
podState.activeCommand = null
podState.lastStatusResponseReceived = 0
}
}
}
@ -660,6 +669,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
var eapAkaSequenceNumber: Long = 1
var bolusPulsesRemaining: Short = 0
var timeZone: String = "" // TimeZone ID (e.g. "Europe/Amsterdam")
var alarmSynced: Boolean = false
var bleVersion: SoftwareVersion? = null
var firmwareVersion: SoftwareVersion? = null