move private fun at the end
This commit is contained in:
parent
432e06adaa
commit
d392caa6e9
1 changed files with 31 additions and 29 deletions
|
@ -315,12 +315,14 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
aapsLogger.info(LTag.PUMP, "No temporary basal to cancel")
|
aapsLogger.info(LTag.PUMP, "No temporary basal to cancel")
|
||||||
Completable.complete()
|
Completable.complete()
|
||||||
}
|
}
|
||||||
|
|
||||||
!enforeNew ->
|
!enforeNew ->
|
||||||
Completable.error(
|
Completable.error(
|
||||||
IllegalStateException(
|
IllegalStateException(
|
||||||
"Temporary basal already active and enforeNew is not set."
|
"Temporary basal already active and enforeNew is not set."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
// enforceNew == true
|
// enforceNew == true
|
||||||
aapsLogger.info(LTag.PUMP, "Canceling existing temp basal")
|
aapsLogger.info(LTag.PUMP, "Canceling existing temp basal")
|
||||||
|
@ -378,35 +380,6 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
.blockingGet()
|
.blockingGet()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleCommandConfirmation(confirmation: CommandConfirmed) {
|
|
||||||
val historyEntry = history.getById(confirmation.historyId)
|
|
||||||
when (historyEntry.commandType) {
|
|
||||||
OmnipodCommandType.CANCEL_TEMPORARY_BASAL ->
|
|
||||||
// We can't invalidate this command,
|
|
||||||
// and this is why it is pumpSync-ed at this point
|
|
||||||
if (confirmation.success) {
|
|
||||||
pumpSync.syncStopTemporaryBasalWithPumpId(
|
|
||||||
historyEntry.createdAt,
|
|
||||||
historyEntry.pumpId(),
|
|
||||||
PumpType.OMNIPOD_DASH,
|
|
||||||
serialNumber()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
OmnipodCommandType.SET_TEMPORARY_BASAL ->
|
|
||||||
// This treatment was synced before sending the command
|
|
||||||
if (!confirmation.success) {
|
|
||||||
pumpSync.invalidateTemporaryBasal(historyEntry.pumpId())
|
|
||||||
}
|
|
||||||
|
|
||||||
else ->
|
|
||||||
aapsLogger.warn(
|
|
||||||
LTag.PUMP,
|
|
||||||
"Will not sync confirmed command of type: $historyEntry and " +
|
|
||||||
"succes: ${confirmation.success}"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun cancelExtendedBolus(): PumpEnactResult {
|
override fun cancelExtendedBolus(): PumpEnactResult {
|
||||||
// TODO i18n
|
// TODO i18n
|
||||||
return PumpEnactResult(injector).success(false).enacted(false)
|
return PumpEnactResult(injector).success(false).enacted(false)
|
||||||
|
@ -605,4 +578,33 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun handleCommandConfirmation(confirmation: CommandConfirmed) {
|
||||||
|
val historyEntry = history.getById(confirmation.historyId)
|
||||||
|
when (historyEntry.commandType) {
|
||||||
|
OmnipodCommandType.CANCEL_TEMPORARY_BASAL ->
|
||||||
|
// We can't invalidate this command,
|
||||||
|
// and this is why it is pumpSync-ed at this point
|
||||||
|
if (confirmation.success) {
|
||||||
|
pumpSync.syncStopTemporaryBasalWithPumpId(
|
||||||
|
historyEntry.createdAt,
|
||||||
|
historyEntry.pumpId(),
|
||||||
|
PumpType.OMNIPOD_DASH,
|
||||||
|
serialNumber()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
OmnipodCommandType.SET_TEMPORARY_BASAL ->
|
||||||
|
// This treatment was synced before sending the command
|
||||||
|
if (!confirmation.success) {
|
||||||
|
pumpSync.invalidateTemporaryBasal(historyEntry.pumpId())
|
||||||
|
}
|
||||||
|
|
||||||
|
else ->
|
||||||
|
aapsLogger.warn(
|
||||||
|
LTag.PUMP,
|
||||||
|
"Will not sync confirmed command of type: $historyEntry and " +
|
||||||
|
"succes: ${confirmation.success}"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue