Refactored fixed pump unreachable alerts into separate 'fixed pump unreachable alert' and 'custom pump unreachable alert check'
This commit is contained in:
parent
2c8c0e705d
commit
fcc37eb688
|
@ -56,6 +56,7 @@ public class PumpDescription {
|
||||||
public boolean needsManualTDDLoad;
|
public boolean needsManualTDDLoad;
|
||||||
|
|
||||||
public boolean hasFixedUnreachableAlert;
|
public boolean hasFixedUnreachableAlert;
|
||||||
|
public boolean hasCustomUnreachableAlertCheck;
|
||||||
|
|
||||||
public void resetSettings() {
|
public void resetSettings() {
|
||||||
isBolusCapable = true;
|
isBolusCapable = true;
|
||||||
|
@ -90,6 +91,7 @@ public class PumpDescription {
|
||||||
needsManualTDDLoad = true;
|
needsManualTDDLoad = true;
|
||||||
|
|
||||||
hasFixedUnreachableAlert = false;
|
hasFixedUnreachableAlert = false;
|
||||||
|
hasCustomUnreachableAlertCheck = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPumpDescription(PumpType pumpType) {
|
public void setPumpDescription(PumpType pumpType) {
|
||||||
|
@ -139,6 +141,7 @@ public class PumpDescription {
|
||||||
is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min);
|
is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min);
|
||||||
|
|
||||||
hasFixedUnreachableAlert = pumpType.getHasFixedUnreachableAlert();
|
hasFixedUnreachableAlert = pumpType.getHasFixedUnreachableAlert();
|
||||||
|
hasCustomUnreachableAlertCheck = pumpType.getHasCustomUnreachableAlertCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,8 +101,8 @@ public interface PumpInterface {
|
||||||
*/
|
*/
|
||||||
void timezoneOrDSTChanged(TimeChangeType timeChangeType);
|
void timezoneOrDSTChanged(TimeChangeType timeChangeType);
|
||||||
|
|
||||||
/* Only used for pump types where hasFixedUnreachableAlert=true */
|
/* Only used for pump types where hasCustomUnreachableAlertCheck=true */
|
||||||
default boolean isFixedUnreachableAlertTimeoutExceeded(long alertTimeoutMilliseconds) {
|
default boolean isUnreachableAlertTimeoutExceeded(long alertTimeoutMilliseconds) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ public enum PumpType {
|
||||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Percent, //
|
PumpTempBasalType.Percent, //
|
||||||
new DoseSettings(10, 30, 24 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
new DoseSettings(10, 30, 24 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||||
0.01d, 0.01d, null, PumpCapability.VirtualPumpCapabilities, false), //
|
0.01d, 0.01d, null, PumpCapability.VirtualPumpCapabilities, false, false), //
|
||||||
|
|
||||||
// Cellnovo
|
// Cellnovo
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ public enum PumpType {
|
||||||
new DoseSettings(0.05d, 30, 24 * 60, 1d, null),
|
new DoseSettings(0.05d, 30, 24 * 60, 1d, null),
|
||||||
PumpTempBasalType.Percent,
|
PumpTempBasalType.Percent,
|
||||||
new DoseSettings(5, 30, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration30minAllowed, //
|
new DoseSettings(5, 30, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||||
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities, false), //
|
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities, false, false), //
|
||||||
|
|
||||||
// Accu-Chek
|
// Accu-Chek
|
||||||
|
|
||||||
|
@ -39,32 +39,32 @@ public enum PumpType {
|
||||||
new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
|
new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
|
||||||
PumpTempBasalType.Percent,
|
PumpTempBasalType.Percent,
|
||||||
new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||||
0.01d, 0.01d, DoseStepSize.ComboBasal, PumpCapability.ComboCapabilities, false), //
|
0.01d, 0.01d, DoseStepSize.ComboBasal, PumpCapability.ComboCapabilities, false, false), //
|
||||||
|
|
||||||
AccuChekSpirit("Accu-Chek Spirit", ManufacturerType.Roche, "Spirit", 0.1d, null, //
|
AccuChekSpirit("Accu-Chek Spirit", ManufacturerType.Roche, "Spirit", 0.1d, null, //
|
||||||
new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
|
new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
|
||||||
PumpTempBasalType.Percent,
|
PumpTempBasalType.Percent,
|
||||||
new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||||
0.01d, 0.1d, null, PumpCapability.VirtualPumpCapabilities, false), //
|
0.01d, 0.1d, null, PumpCapability.VirtualPumpCapabilities, false, false), //
|
||||||
|
|
||||||
AccuChekInsight("Accu-Chek Insight", ManufacturerType.Roche, "Insight", 0.05d, DoseStepSize.InsightBolus, //
|
AccuChekInsight("Accu-Chek Insight", ManufacturerType.Roche, "Insight", 0.05d, DoseStepSize.InsightBolus, //
|
||||||
new DoseSettings(0.05d, 15, 24 * 60, 0.05d), //
|
new DoseSettings(0.05d, 15, 24 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Percent,
|
PumpTempBasalType.Percent,
|
||||||
new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||||
0.02d, 0.01d, null, PumpCapability.InsightCapabilities, false), //
|
0.02d, 0.01d, null, PumpCapability.InsightCapabilities, false, false), //
|
||||||
|
|
||||||
AccuChekInsightBluetooth("Accu-Chek Insight", ManufacturerType.Roche, "Insight", 0.01d, null, //
|
AccuChekInsightBluetooth("Accu-Chek Insight", ManufacturerType.Roche, "Insight", 0.01d, null, //
|
||||||
new DoseSettings(0.01d, 15, 24 * 60, 0.05d), //
|
new DoseSettings(0.01d, 15, 24 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Percent,
|
PumpTempBasalType.Percent,
|
||||||
new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||||
0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities, false), //
|
0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities, false, false), //
|
||||||
|
|
||||||
// Animas
|
// Animas
|
||||||
AnimasVibe("Animas Vibe", ManufacturerType.Animas, "Vibe", 0.05d, null, // AnimasBolus?
|
AnimasVibe("Animas Vibe", ManufacturerType.Animas, "Vibe", 0.05d, null, // AnimasBolus?
|
||||||
new DoseSettings(0.05d, 30, 12 * 60, 0.05d), //
|
new DoseSettings(0.05d, 30, 12 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Percent, //
|
PumpTempBasalType.Percent, //
|
||||||
new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, //
|
new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||||
0.025d, 5d, 0d, null, PumpCapability.VirtualPumpCapabilities, false), //
|
0.025d, 5d, 0d, null, PumpCapability.VirtualPumpCapabilities, false, false), //
|
||||||
|
|
||||||
AnimasPing("Animas Ping", "Ping", AnimasVibe),
|
AnimasPing("Animas Ping", "Ping", AnimasVibe),
|
||||||
|
|
||||||
|
@ -73,42 +73,41 @@ public enum PumpType {
|
||||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Percent, //
|
PumpTempBasalType.Percent, //
|
||||||
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
|
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
|
||||||
0.04d, 0.01d, null, PumpCapability.DanaCapabilities, false),
|
0.04d, 0.01d, null, PumpCapability.DanaCapabilities, false, false),
|
||||||
|
|
||||||
DanaRKorean("DanaR Korean", ManufacturerType.Sooil, "DanaRKorean", 0.05d, null, //
|
DanaRKorean("DanaR Korean", ManufacturerType.Sooil, "DanaRKorean", 0.05d, null, //
|
||||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Percent, //
|
PumpTempBasalType.Percent, //
|
||||||
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
|
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
|
||||||
0.1d, 0.01d, null, PumpCapability.DanaCapabilities, false),
|
0.1d, 0.01d, null, PumpCapability.DanaCapabilities, false, false),
|
||||||
|
|
||||||
DanaRS("DanaRS", ManufacturerType.Sooil, "DanaRS", 0.05d, null, //
|
DanaRS("DanaRS", ManufacturerType.Sooil, "DanaRS", 0.05d, null, //
|
||||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Percent, //
|
PumpTempBasalType.Percent, //
|
||||||
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||||
0.04d, 0.01d, null, PumpCapability.DanaWithHistoryCapabilities, false),
|
0.04d, 0.01d, null, PumpCapability.DanaWithHistoryCapabilities, false, false),
|
||||||
|
|
||||||
DanaRv2("DanaRv2", "DanaRv2", DanaRS),
|
DanaRv2("DanaRv2", "DanaRv2", DanaRS),
|
||||||
|
|
||||||
|
|
||||||
// Insulet
|
// Insulet
|
||||||
Insulet_Omnipod("Insulet Omnipod", ManufacturerType.Insulet, "Omnipod (Eros)", 0.05d, null, //
|
Insulet_Omnipod("Insulet Omnipod", ManufacturerType.Insulet, "Omnipod (Eros)", 0.05d, null, //
|
||||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Absolute, //
|
PumpTempBasalType.Absolute, //
|
||||||
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, //
|
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||||
0.05d, 0.05d, null, PumpCapability.OmnipodCapabilities, true),
|
0.05d, 0.05d, null, PumpCapability.OmnipodCapabilities, true, true),
|
||||||
|
|
||||||
Insulet_Omnipod_Dash("Insulet Omnipod Dash", ManufacturerType.Insulet, "Omnipod Dash", 0.05d, null, //
|
Insulet_Omnipod_Dash("Insulet Omnipod Dash", ManufacturerType.Insulet, "Omnipod Dash", 0.05d, null, //
|
||||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Absolute, //
|
PumpTempBasalType.Absolute, //
|
||||||
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, //
|
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||||
0.05d, 0.05d, null, PumpCapability.OmnipodCapabilities, true), // TODO just copied OmniPod for now
|
0.05d, 0.05d, null, PumpCapability.OmnipodCapabilities, true, true), // TODO just copied OmniPod for now
|
||||||
|
|
||||||
// Medtronic
|
// Medtronic
|
||||||
Medtronic_512_712("Medtronic 512/712", ManufacturerType.Medtronic, "512/712", 0.1d, null, //
|
Medtronic_512_712("Medtronic 512/712", ManufacturerType.Medtronic, "512/712", 0.1d, null, //
|
||||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Absolute, //
|
PumpTempBasalType.Absolute, //
|
||||||
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
|
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||||
0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities, false), //
|
0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities, false, false), //
|
||||||
|
|
||||||
Medtronic_515_715("Medtronic 515/715", "515/715", Medtronic_512_712),
|
Medtronic_515_715("Medtronic 515/715", "515/715", Medtronic_512_712),
|
||||||
Medtronic_522_722("Medtronic 522/722", "522/722", Medtronic_512_712),
|
Medtronic_522_722("Medtronic 522/722", "522/722", Medtronic_512_712),
|
||||||
|
@ -117,7 +116,7 @@ public enum PumpType {
|
||||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Absolute, //
|
PumpTempBasalType.Absolute, //
|
||||||
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
|
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||||
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities, false), //
|
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities, false, false), //
|
||||||
|
|
||||||
Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", "554/754 (Veo)", Medtronic_523_723_Revel), // TODO
|
Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", "554/754 (Veo)", Medtronic_523_723_Revel), // TODO
|
||||||
|
|
||||||
|
@ -125,14 +124,14 @@ public enum PumpType {
|
||||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||||
PumpTempBasalType.Absolute, //
|
PumpTempBasalType.Absolute, //
|
||||||
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
|
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||||
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities, false), //
|
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities, false, false), //
|
||||||
|
|
||||||
// Tandem
|
// Tandem
|
||||||
TandemTSlim("Tandem t:slim", ManufacturerType.Tandem, "t:slim", 0.01d, null, //
|
TandemTSlim("Tandem t:slim", ManufacturerType.Tandem, "t:slim", 0.01d, null, //
|
||||||
new DoseSettings(0.01d, 15, 8 * 60, 0.4d),
|
new DoseSettings(0.01d, 15, 8 * 60, 0.4d),
|
||||||
PumpTempBasalType.Percent,
|
PumpTempBasalType.Percent,
|
||||||
new DoseSettings(1, 15, 8 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
new DoseSettings(1, 15, 8 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||||
0.1d, 0.001d, null, PumpCapability.VirtualPumpCapabilities, false),
|
0.1d, 0.001d, null, PumpCapability.VirtualPumpCapabilities, false, false),
|
||||||
|
|
||||||
TandemTFlex("Tandem t:flex", "t:flex", TandemTSlim), //
|
TandemTFlex("Tandem t:flex", "t:flex", TandemTSlim), //
|
||||||
TandemTSlimG4("Tandem t:slim G4", "t:slim G4", TandemTSlim), //
|
TandemTSlimG4("Tandem t:slim G4", "t:slim G4", TandemTSlim), //
|
||||||
|
@ -141,7 +140,6 @@ public enum PumpType {
|
||||||
// MDI
|
// MDI
|
||||||
MDI("MDI", ManufacturerType.AndroidAPS, "MDI");
|
MDI("MDI", ManufacturerType.AndroidAPS, "MDI");
|
||||||
|
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
private ManufacturerType manufacturer;
|
private ManufacturerType manufacturer;
|
||||||
private String model;
|
private String model;
|
||||||
|
@ -157,6 +155,7 @@ public enum PumpType {
|
||||||
private DoseStepSize baseBasalSpecialSteps; //
|
private DoseStepSize baseBasalSpecialSteps; //
|
||||||
private PumpCapability pumpCapability;
|
private PumpCapability pumpCapability;
|
||||||
private boolean hasFixedUnreachableAlert;
|
private boolean hasFixedUnreachableAlert;
|
||||||
|
private boolean hasCustomUnreachableAlertCheck;
|
||||||
|
|
||||||
private PumpType parent;
|
private PumpType parent;
|
||||||
private static Map<String, PumpType> mapByDescription;
|
private static Map<String, PumpType> mapByDescription;
|
||||||
|
@ -194,15 +193,15 @@ public enum PumpType {
|
||||||
PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, //
|
PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, //
|
||||||
DoseSettings extendedBolusSettings, //
|
DoseSettings extendedBolusSettings, //
|
||||||
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
|
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
|
||||||
double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability, boolean hasFixedUnreachableAlert) {
|
double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability, boolean hasFixedUnreachableAlert, boolean hasCustomUnreachableAlertCheck) {
|
||||||
this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability, hasFixedUnreachableAlert);
|
this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability, hasFixedUnreachableAlert, hasCustomUnreachableAlertCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, //
|
PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, //
|
||||||
DoseSettings extendedBolusSettings, //
|
DoseSettings extendedBolusSettings, //
|
||||||
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
|
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
|
||||||
double baseBasalMinValue, Double baseBasalMaxValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, //
|
double baseBasalMinValue, Double baseBasalMaxValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, //
|
||||||
PumpCapability pumpCapability, boolean hasFixedUnreachableAlert) {
|
PumpCapability pumpCapability, boolean hasFixedUnreachableAlert, boolean hasCustomUnreachableAlertCheck) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.manufacturer = manufacturer;
|
this.manufacturer = manufacturer;
|
||||||
this.model = model;
|
this.model = model;
|
||||||
|
@ -218,11 +217,17 @@ public enum PumpType {
|
||||||
this.baseBasalSpecialSteps = baseBasalSpecialSteps;
|
this.baseBasalSpecialSteps = baseBasalSpecialSteps;
|
||||||
this.pumpCapability = pumpCapability;
|
this.pumpCapability = pumpCapability;
|
||||||
this.hasFixedUnreachableAlert = hasFixedUnreachableAlert;
|
this.hasFixedUnreachableAlert = hasFixedUnreachableAlert;
|
||||||
|
this.hasCustomUnreachableAlertCheck = hasCustomUnreachableAlertCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getHasFixedUnreachableAlert() {
|
public boolean getHasFixedUnreachableAlert() {
|
||||||
return hasFixedUnreachableAlert;
|
return hasFixedUnreachableAlert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getHasCustomUnreachableAlertCheck() {
|
||||||
|
return hasFixedUnreachableAlert;
|
||||||
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
|
@ -980,7 +980,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFixedUnreachableAlertTimeoutExceeded(long unreachableTimeoutMilliseconds) {
|
public boolean isUnreachableAlertTimeoutExceeded(long unreachableTimeoutMilliseconds) {
|
||||||
getPodPumpStatusObject();
|
getPodPumpStatusObject();
|
||||||
|
|
||||||
if (pumpStatusLocal.lastConnection != 0 || pumpStatusLocal.lastErrorConnection != 0) {
|
if (pumpStatusLocal.lastConnection != 0 || pumpStatusLocal.lastErrorConnection != 0) {
|
||||||
|
|
|
@ -36,41 +36,38 @@ public class LocalAlertUtils {
|
||||||
|
|
||||||
public static void checkPumpUnreachableAlarm(long lastConnection, boolean isStatusOutdated) {
|
public static void checkPumpUnreachableAlarm(long lastConnection, boolean isStatusOutdated) {
|
||||||
PumpInterface activePump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
PumpInterface activePump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (activePump != null && activePump.getPumpDescription().hasFixedUnreachableAlert) {
|
|
||||||
checkPumpUnreachableAlarmStatic(activePump);
|
boolean alertsEnabled = Config.APS && //
|
||||||
} else {
|
((activePump != null && activePump.getPumpDescription().hasFixedUnreachableAlert) //
|
||||||
checkPumpUnreachableAlarmConfigured(lastConnection, isStatusOutdated);
|
|| SP.getBoolean(MainApp.gs(R.string.key_enable_pump_unreachable_alert), true));
|
||||||
|
|
||||||
|
if (alertsEnabled) {
|
||||||
|
boolean isUnreachable;
|
||||||
|
|
||||||
|
if (activePump != null && activePump.getPumpDescription().hasCustomUnreachableAlertCheck) {
|
||||||
|
isUnreachable = checkCustomPumpUnreachableAlarm(activePump);
|
||||||
|
} else {
|
||||||
|
isUnreachable = checkDefaultPumpUnreachableAlarm(lastConnection, isStatusOutdated);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isUnreachable) {
|
||||||
|
log.debug("Generating pump unreachable alarm.");
|
||||||
|
showUnreachableNotification(pumpUnreachableThreshold());
|
||||||
|
} else {
|
||||||
|
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PUMP_UNREACHABLE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkPumpUnreachableAlarmStatic(PumpInterface pump) {
|
private static boolean checkCustomPumpUnreachableAlarm(PumpInterface pump) {
|
||||||
if (pump == null) {
|
return pump != null && pump.isUnreachableAlertTimeoutExceeded(pumpUnreachableThreshold());
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
long pumpUnreachableThresholdMilliseconds = pumpUnreachableThreshold();
|
|
||||||
|
|
||||||
if (pump.isFixedUnreachableAlertTimeoutExceeded(pumpUnreachableThresholdMilliseconds)) {
|
|
||||||
log.debug("Generating static pump unreachable alarm.");
|
|
||||||
|
|
||||||
showUnreachableNotification(pumpUnreachableThresholdMilliseconds);
|
|
||||||
} else {
|
|
||||||
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PUMP_UNREACHABLE));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkPumpUnreachableAlarmConfigured(long lastConnection, boolean isStatusOutdated) {
|
private static boolean checkDefaultPumpUnreachableAlarm(long lastConnection, boolean isStatusOutdated) {
|
||||||
boolean alarmTimeoutExpired = lastConnection + pumpUnreachableThreshold() < System.currentTimeMillis();
|
boolean alarmTimeoutExpired = lastConnection + pumpUnreachableThreshold() < System.currentTimeMillis();
|
||||||
boolean nextAlarmOccurrenceReached = SP.getLong("nextPumpDisconnectedAlarm", 0L) < System.currentTimeMillis();
|
boolean nextAlarmOccurrenceReached = SP.getLong("nextPumpDisconnectedAlarm", 0L) < System.currentTimeMillis();
|
||||||
|
|
||||||
if (Config.APS && SP.getBoolean(MainApp.gs(R.string.key_enable_pump_unreachable_alert), true)
|
return isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !LoopPlugin.getPlugin().isDisconnected();
|
||||||
&& isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !LoopPlugin.getPlugin().isDisconnected()) {
|
|
||||||
log.debug("Generating configured pump unreachable alarm. lastConnection: " + DateUtil.dateAndTimeString(lastConnection) + " isStatusOutdated: " + isStatusOutdated);
|
|
||||||
|
|
||||||
showUnreachableNotification(pumpUnreachableThreshold());
|
|
||||||
}
|
|
||||||
if (!isStatusOutdated && !alarmTimeoutExpired)
|
|
||||||
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PUMP_UNREACHABLE));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void showUnreachableNotification(long nextAlarmTimeoutMillis) {
|
private static void showUnreachableNotification(long nextAlarmTimeoutMillis) {
|
||||||
|
|
Loading…
Reference in a new issue