dash: address feedback
This commit is contained in:
parent
14af90e9e3
commit
c1426941cf
|
@ -144,25 +144,16 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
}.blockingGet()
|
}.blockingGet()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isThisProfileSet(profile: Profile): Boolean {
|
override fun isThisProfileSet(profile: Profile): Boolean = podStateManager.basalProgram?.let {
|
||||||
if (podStateManager.basalProgram == null) {
|
it == mapProfileToBasalProgram(profile)
|
||||||
// We don't have an active Pod. Return true here because the next Pod will use the currently active profile
|
} ?: true
|
||||||
return true
|
|
||||||
}
|
|
||||||
return podStateManager.basalProgram!! == mapProfileToBasalProgram(profile)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun lastDataTime(): Long {
|
override fun lastDataTime(): Long {
|
||||||
return podStateManager.lastConnection
|
return podStateManager.lastConnection
|
||||||
}
|
}
|
||||||
|
|
||||||
override val baseBasalRate: Double
|
override val baseBasalRate: Double
|
||||||
get() {
|
get() = podStateManager.basalProgram?.rateAt(Date()) ?: 0.0
|
||||||
if (podStateManager.basalProgram == null) {
|
|
||||||
return 0.0
|
|
||||||
}
|
|
||||||
return podStateManager.basalProgram!!.rateAt(Date())
|
|
||||||
}
|
|
||||||
|
|
||||||
override val reservoirLevel: Double
|
override val reservoirLevel: Double
|
||||||
get() {
|
get() {
|
||||||
|
@ -369,36 +360,32 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun executeCustomCommand(customCommand: CustomCommand): PumpEnactResult? {
|
override fun executeCustomCommand(customCommand: CustomCommand): PumpEnactResult? {
|
||||||
if (customCommand is CommandSilenceAlerts) {
|
return when (customCommand) {
|
||||||
return silenceAlerts()
|
is CommandSilenceAlerts ->
|
||||||
}
|
silenceAlerts()
|
||||||
if (customCommand is CommandSuspendDelivery) {
|
is CommandSuspendDelivery ->
|
||||||
return suspendDelivery()
|
suspendDelivery()
|
||||||
}
|
is CommandResumeDelivery ->
|
||||||
if (customCommand is CommandResumeDelivery) {
|
resumeDelivery()
|
||||||
return resumeDelivery()
|
is CommandDeactivatePod ->
|
||||||
}
|
deactivatePod()
|
||||||
if (customCommand is CommandDeactivatePod) {
|
is CommandHandleTimeChange ->
|
||||||
return deactivatePod()
|
handleTimeChange()
|
||||||
}
|
is CommandUpdateAlertConfiguration ->
|
||||||
if (customCommand is CommandHandleTimeChange) {
|
updateAlertConfiguration()
|
||||||
return handleTimeChange()
|
is CommandPlayTestBeep ->
|
||||||
}
|
playTestBeep()
|
||||||
if (customCommand is CommandUpdateAlertConfiguration) {
|
|
||||||
return updateAlertConfiguration()
|
|
||||||
}
|
|
||||||
if (customCommand is CommandPlayTestBeep) {
|
|
||||||
return playTestBeep()
|
|
||||||
}
|
|
||||||
|
|
||||||
aapsLogger.warn(LTag.PUMP, "Unsupported custom command: " + customCommand.javaClass.name)
|
else -> {
|
||||||
|
aapsLogger.warn(LTag.PUMP, "Unsupported custom command: " + customCommand.javaClass.name)
|
||||||
return PumpEnactResult(injector).success(false).enacted(false).comment(
|
PumpEnactResult(injector).success(false).enacted(false).comment(
|
||||||
resourceHelper.gs(
|
resourceHelper.gs(
|
||||||
R.string.omnipod_common_error_unsupported_custom_command,
|
R.string.omnipod_common_error_unsupported_custom_command,
|
||||||
customCommand.javaClass.name
|
customCommand.javaClass.name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun silenceAlerts(): PumpEnactResult {
|
private fun silenceAlerts(): PumpEnactResult {
|
||||||
|
|
Loading…
Reference in a new issue