Move fixed values for expiration alerts to PodConstants

This commit is contained in:
Theo van Elsberg 2021-10-05 00:07:09 +02:00
parent 5ffe61d6c4
commit 30342f2e23
2 changed files with 19 additions and 9 deletions

View file

@ -9,6 +9,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.*
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.GetVersionCommand.Companion.DEFAULT_UNIQUE_ID import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.GetVersionCommand.Companion.DEFAULT_UNIQUE_ID
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.* import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.*
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.MAX_POD_LIFETIME import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.MAX_POD_LIFETIME
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_ALERT_MINUTES_DURATION
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_EMINENT_ALERT_MINUTES
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_ALERT_MINUTES
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.* import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.*
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
import info.nightscout.androidaps.utils.rx.AapsSchedulers import info.nightscout.androidaps.utils.rx.AapsSchedulers
@ -394,11 +397,9 @@ class OmnipodDashManagerImpl @Inject constructor(
AlertConfiguration( AlertConfiguration(
AlertType.EXPIRATION, AlertType.EXPIRATION,
enabled = true, enabled = true,
durationInMinutes = TimeUnit.HOURS.toMinutes(7).toShort(), durationInMinutes = POD_EXPIRATION_ALERT_MINUTES_DURATION.toShort(),
autoOff = false, autoOff = false,
AlertTrigger.TimerTrigger( AlertTrigger.TimerTrigger(POD_EXPIRATION_ALERT_MINUTES.toShort()), // FIXME use activation time
TimeUnit.HOURS.toMinutes(72).toShort()
), // FIXME use activation time
BeepType.FOUR_TIMES_BIP_BEEP, BeepType.FOUR_TIMES_BIP_BEEP,
BeepRepetitionType.XXX3 BeepRepetitionType.XXX3
), ),
@ -407,9 +408,7 @@ class OmnipodDashManagerImpl @Inject constructor(
enabled = true, enabled = true,
durationInMinutes = 0, durationInMinutes = 0,
autoOff = false, autoOff = false,
AlertTrigger.TimerTrigger( AlertTrigger.TimerTrigger(POD_EXPIRATION_EMINENT_ALERT_MINUTES.toShort()), // FIXME use activation time
TimeUnit.HOURS.toMinutes(79).toShort()
), // FIXME use activation time
BeepType.FOUR_TIMES_BIP_BEEP, BeepType.FOUR_TIMES_BIP_BEEP,
BeepRepetitionType.XXX4 BeepRepetitionType.XXX4
) )

View file

@ -1,16 +1,27 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition
import java.time.Duration import java.time.Duration
import java.util.concurrent.TimeUnit
class PodConstants { class PodConstants {
companion object { companion object {
val MAX_POD_LIFETIME : Duration = Duration.ofHours(80) val MAX_POD_LIFETIME : Duration = Duration.ofHours(80)
// Expiration alerts duration in minutes
const val POD_EXPIRATION_ALERT_MINUTES_DURATION = 60 * 7
// Expiration alert time in minutes since activation
const val POD_EXPIRATION_ALERT_MINUTES = 60 * 72
// Expiration eminent alert time in minutes since activation
const val POD_EXPIRATION_EMINENT_ALERT_MINUTES = 60 * 79
// Bolus units
const val POD_PULSE_BOLUS_UNITS = 0.05 const val POD_PULSE_BOLUS_UNITS = 0.05
// Priming
// Priming units
const val POD_PRIMING_BOLUS_UNITS = 0.05 const val POD_PRIMING_BOLUS_UNITS = 0.05
const val POD_CANNULA_INSERTION_BOLUS_UNITS = 0.05 const val POD_CANNULA_INSERTION_BOLUS_UNITS = 0.05
// Reservoir
// Reservoir units alert threshold
const val DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD : Short = 20 const val DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD : Short = 20
} }
} }