Merge branch 'omnipod_eros' of https://github.com/AAPS-Omnipod/AndroidAPS into omnipod_eros
This commit is contained in:
commit
18145d91d9
|
@ -55,6 +55,7 @@ public class PumpDescription {
|
|||
public boolean supportsTDDs;
|
||||
public boolean needsManualTDDLoad;
|
||||
|
||||
public boolean hasFixedUnreachableAlert;
|
||||
|
||||
public void resetSettings() {
|
||||
isBolusCapable = true;
|
||||
|
@ -87,6 +88,8 @@ public class PumpDescription {
|
|||
|
||||
supportsTDDs = false;
|
||||
needsManualTDDLoad = true;
|
||||
|
||||
hasFixedUnreachableAlert = false;
|
||||
}
|
||||
|
||||
public void setPumpDescription(PumpType pumpType) {
|
||||
|
@ -134,6 +137,8 @@ public class PumpDescription {
|
|||
needsManualTDDLoad = pumpCapability.hasCapability(PumpCapability.ManualTDDLoad);
|
||||
|
||||
is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min);
|
||||
|
||||
hasFixedUnreachableAlert = pumpType.getHasFixedUnreachableAlert();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -99,4 +99,9 @@ public interface PumpInterface {
|
|||
*/
|
||||
void timeDateOrTimeZoneChanged();
|
||||
|
||||
/* Only used for pump types where hasFixedUnreachableAlert=true */
|
||||
default boolean isFixedUnreachableAlertTimeoutExceeded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public enum PumpType {
|
|||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||
PumpTempBasalType.Percent, //
|
||||
new DoseSettings(10, 30, 24 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||
0.01d, 0.01d, null, PumpCapability.VirtualPumpCapabilities), //
|
||||
0.01d, 0.01d, null, PumpCapability.VirtualPumpCapabilities, false), //
|
||||
|
||||
// Cellnovo
|
||||
|
||||
|
@ -31,7 +31,7 @@ public enum PumpType {
|
|||
new DoseSettings(0.05d, 30, 24 * 60, 1d, null),
|
||||
PumpTempBasalType.Percent,
|
||||
new DoseSettings(5, 30, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities), //
|
||||
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities, false), //
|
||||
|
||||
// Accu-Chek
|
||||
|
||||
|
@ -39,32 +39,32 @@ public enum PumpType {
|
|||
new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
|
||||
PumpTempBasalType.Percent,
|
||||
new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||
0.01d, 0.01d, DoseStepSize.ComboBasal, PumpCapability.ComboCapabilities), //
|
||||
0.01d, 0.01d, DoseStepSize.ComboBasal, PumpCapability.ComboCapabilities, false), //
|
||||
|
||||
AccuChekSpirit("Accu-Chek Spirit", ManufacturerType.Roche, "Spirit", 0.1d, null, //
|
||||
new DoseSettings(0.1d, 15, 12 * 60, 0.1d), //
|
||||
PumpTempBasalType.Percent,
|
||||
new DoseSettings(10, 15, 12 * 60, 0d, 500d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||
0.01d, 0.1d, null, PumpCapability.VirtualPumpCapabilities), //
|
||||
0.01d, 0.1d, null, PumpCapability.VirtualPumpCapabilities, false), //
|
||||
|
||||
AccuChekInsight("Accu-Chek Insight", ManufacturerType.Roche, "Insight", 0.05d, DoseStepSize.InsightBolus, //
|
||||
new DoseSettings(0.05d, 15, 24 * 60, 0.05d), //
|
||||
PumpTempBasalType.Percent,
|
||||
new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||
0.02d, 0.01d, null, PumpCapability.InsightCapabilities), //
|
||||
0.02d, 0.01d, null, PumpCapability.InsightCapabilities, false), //
|
||||
|
||||
AccuChekInsightBluetooth("Accu-Chek Insight", ManufacturerType.Roche, "Insight", 0.01d, null, //
|
||||
new DoseSettings(0.01d, 15, 24 * 60, 0.05d), //
|
||||
PumpTempBasalType.Percent,
|
||||
new DoseSettings(10, 15, 24 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||
0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), //
|
||||
0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities, false), //
|
||||
|
||||
// Animas
|
||||
AnimasVibe("Animas Vibe", ManufacturerType.Animas, "Vibe", 0.05d, null, // AnimasBolus?
|
||||
new DoseSettings(0.05d, 30, 12 * 60, 0.05d), //
|
||||
PumpTempBasalType.Percent, //
|
||||
new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||
0.025d, 5d, 0d, null, PumpCapability.VirtualPumpCapabilities), //
|
||||
0.025d, 5d, 0d, null, PumpCapability.VirtualPumpCapabilities, false), //
|
||||
|
||||
AnimasPing("Animas Ping", "Ping", AnimasVibe),
|
||||
|
||||
|
@ -73,19 +73,19 @@ public enum PumpType {
|
|||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||
PumpTempBasalType.Percent, //
|
||||
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
|
||||
0.04d, 0.01d, null, PumpCapability.DanaCapabilities),
|
||||
0.04d, 0.01d, null, PumpCapability.DanaCapabilities, false),
|
||||
|
||||
DanaRKorean("DanaR Korean", ManufacturerType.Sooil, "DanaRKorean", 0.05d, null, //
|
||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||
PumpTempBasalType.Percent, //
|
||||
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minNotAllowed, //
|
||||
0.1d, 0.01d, null, PumpCapability.DanaCapabilities),
|
||||
0.1d, 0.01d, null, PumpCapability.DanaCapabilities, false),
|
||||
|
||||
DanaRS("DanaRS", ManufacturerType.Sooil, "DanaRS", 0.05d, null, //
|
||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||
PumpTempBasalType.Percent, //
|
||||
new DoseSettings(10d, 60, 24 * 60, 0d, 200d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||
0.04d, 0.01d, null, PumpCapability.DanaWithHistoryCapabilities),
|
||||
0.04d, 0.01d, null, PumpCapability.DanaWithHistoryCapabilities, false),
|
||||
|
||||
DanaRv2("DanaRv2", "DanaRv2", DanaRS),
|
||||
|
||||
|
@ -94,21 +94,21 @@ public enum PumpType {
|
|||
Insulet_Omnipod("Insulet Omnipod", ManufacturerType.Insulet, "Omnipod (Eros)", 0.05d, null, //
|
||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||
PumpTempBasalType.Absolute, //
|
||||
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max basal rate 30u/hr
|
||||
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities),
|
||||
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities, true),
|
||||
|
||||
Insulet_Omnipod_Dash("Insulet Omnipod Dash", ManufacturerType.Insulet, "Omnipod Dash", 0.05d, null, //
|
||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||
PumpTempBasalType.Absolute, //
|
||||
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, // cannot exceed max basal rate 30u/hr
|
||||
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities), // TODO just copied OmniPod for now
|
||||
new DoseSettings(0.05d, 30, 12 * 60, 0d, 30.0d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||
0.05d, 0.05d, null, PumpCapability.VirtualPumpCapabilities, true), // TODO just copied OmniPod for now
|
||||
|
||||
// Medtronic
|
||||
Medtronic_512_712("Medtronic 512/712", ManufacturerType.Medtronic, "512/712", 0.1d, null, //
|
||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||
PumpTempBasalType.Absolute, //
|
||||
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||
0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities), //
|
||||
0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities, false), //
|
||||
|
||||
Medtronic_515_715("Medtronic 515/715", "515/715", Medtronic_512_712),
|
||||
Medtronic_522_722("Medtronic 522/722", "522/722", Medtronic_512_712),
|
||||
|
@ -117,7 +117,7 @@ public enum PumpType {
|
|||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||
PumpTempBasalType.Absolute, //
|
||||
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities), //
|
||||
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities, false), //
|
||||
|
||||
Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", "554/754 (Veo)", Medtronic_523_723_Revel), // TODO
|
||||
|
||||
|
@ -125,14 +125,14 @@ public enum PumpType {
|
|||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||
PumpTempBasalType.Absolute, //
|
||||
new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
|
||||
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities), //
|
||||
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.VirtualPumpCapabilities, false), //
|
||||
|
||||
// Tandem
|
||||
TandemTSlim("Tandem t:slim", ManufacturerType.Tandem, "t:slim", 0.01d, null, //
|
||||
new DoseSettings(0.01d, 15, 8 * 60, 0.4d),
|
||||
PumpTempBasalType.Percent,
|
||||
new DoseSettings(1, 15, 8 * 60, 0d, 250d), PumpCapability.BasalRate_Duration15and30minAllowed, //
|
||||
0.1d, 0.001d, null, PumpCapability.VirtualPumpCapabilities),
|
||||
0.1d, 0.001d, null, PumpCapability.VirtualPumpCapabilities, false),
|
||||
|
||||
TandemTFlex("Tandem t:flex", "t:flex", TandemTSlim), //
|
||||
TandemTSlimG4("Tandem t:slim G4", "t:slim G4", TandemTSlim), //
|
||||
|
@ -156,6 +156,7 @@ public enum PumpType {
|
|||
private double baseBasalStep; //
|
||||
private DoseStepSize baseBasalSpecialSteps; //
|
||||
private PumpCapability pumpCapability;
|
||||
private boolean hasFixedUnreachableAlert;
|
||||
|
||||
private PumpType parent;
|
||||
private static Map<String, PumpType> mapByDescription;
|
||||
|
@ -193,14 +194,15 @@ public enum PumpType {
|
|||
PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, //
|
||||
DoseSettings extendedBolusSettings, //
|
||||
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
|
||||
double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) {
|
||||
this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability);
|
||||
double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability, boolean hasFixedUnreachableAlert) {
|
||||
this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability, hasFixedUnreachableAlert);
|
||||
}
|
||||
|
||||
PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, //
|
||||
DoseSettings extendedBolusSettings, //
|
||||
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
|
||||
double baseBasalMinValue, Double baseBasalMaxValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) {
|
||||
double baseBasalMinValue, Double baseBasalMaxValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, //
|
||||
PumpCapability pumpCapability, boolean hasFixedUnreachableAlert) {
|
||||
this.description = description;
|
||||
this.manufacturer = manufacturer;
|
||||
this.model = model;
|
||||
|
@ -215,9 +217,12 @@ public enum PumpType {
|
|||
this.baseBasalStep = baseBasalStep;
|
||||
this.baseBasalSpecialSteps = baseBasalSpecialSteps;
|
||||
this.pumpCapability = pumpCapability;
|
||||
this.hasFixedUnreachableAlert = hasFixedUnreachableAlert;
|
||||
}
|
||||
|
||||
|
||||
public boolean getHasFixedUnreachableAlert() {
|
||||
return hasFixedUnreachableAlert;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
|||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy;
|
||||
import info.nightscout.androidaps.utils.SP;
|
||||
import info.nightscout.androidaps.utils.T;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
|
@ -105,7 +106,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
private Profile currentProfile;
|
||||
|
||||
private long nextPodCheck = 0L;
|
||||
|
||||
private static long UNREACHABLE_ALERT_THRESHOLD_MILLIS = T.mins(30).msecs();
|
||||
|
||||
private OmnipodPumpPlugin() {
|
||||
|
||||
|
@ -937,4 +938,27 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isFixedUnreachableAlertTimeoutExceeded() {
|
||||
getPodPumpStatusObject();
|
||||
|
||||
if (pumpStatusLocal.lastConnection != 0 || pumpStatusLocal.lastErrorConnection != 0) {
|
||||
if (pumpStatusLocal.lastConnection + UNREACHABLE_ALERT_THRESHOLD_MILLIS < System.currentTimeMillis()) {
|
||||
if (pumpStatusLocal.lastErrorConnection > pumpStatusLocal.lastConnection) {
|
||||
// We exceeded the alert threshold, and our last connection failed
|
||||
// We should show an alert
|
||||
return true;
|
||||
}
|
||||
|
||||
// Don't trigger an alert when we exceeded the thresholds, but the last communication was successful
|
||||
// This happens when we simply didn't need to send any commands to the pump
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If we have no last connection and error data, don't show any alert
|
||||
// FIXME is this appropriate?
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.TimeZone;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.AcknowledgeAlertsAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.AssignAddressAction;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.BolusAction;
|
||||
|
@ -201,10 +200,10 @@ public class OmnipodManager {
|
|||
}
|
||||
|
||||
// CAUTION: cancels temp basal and then sets new temp basal. An OmnipodException[certainFailure=false] indicates that the pod might have cancelled the previous temp basal, but did not set a new temp basal
|
||||
public synchronized void setTemporaryBasal(TempBasalPair tempBasalPair, boolean acknowledgementBeep, boolean completionBeep) {
|
||||
public synchronized void setTemporaryBasal(double rate, Duration duration, boolean acknowledgementBeep, boolean completionBeep) {
|
||||
assertReadyForDelivery();
|
||||
|
||||
logStartingCommandExecution("setTemporaryBasal [tempBasalPair=" + tempBasalPair + ", acknowledgementBeep=" + acknowledgementBeep + ", completionBeep=" + completionBeep + "]");
|
||||
logStartingCommandExecution("setTemporaryBasal [rate=" + rate + ", duration=" + duration + ", acknowledgementBeep=" + acknowledgementBeep + ", completionBeep=" + completionBeep + "]");
|
||||
|
||||
try {
|
||||
cancelDelivery(EnumSet.of(DeliveryType.TEMP_BASAL), acknowledgementBeep);
|
||||
|
@ -215,7 +214,7 @@ public class OmnipodManager {
|
|||
|
||||
try {
|
||||
executeAndVerify(() -> communicationService.executeAction(new SetTempBasalAction(
|
||||
podState, tempBasalPair.getInsulinRate(), Duration.standardMinutes(tempBasalPair.getDurationMinutes()),
|
||||
podState, rate, duration,
|
||||
acknowledgementBeep, completionBeep)));
|
||||
} catch (OmnipodException ex) {
|
||||
// Treat all exceptions as uncertain failures, because all delivery has been suspended here.
|
||||
|
|
|
@ -9,7 +9,7 @@ public class BasalScheduleEntry {
|
|||
private final Duration startTime;
|
||||
|
||||
public BasalScheduleEntry(double rate, Duration startTime) {
|
||||
if (startTime.isLongerThan(Duration.standardHours(24).minus(Duration.standardSeconds(1))) || startTime.isShorterThan(Duration.ZERO)) {
|
||||
if (startTime.isLongerThan(Duration.standardHours(24).minus(Duration.standardSeconds(1))) || startTime.isShorterThan(Duration.ZERO) || startTime.getStandardSeconds() % 1800 != 0) {
|
||||
throw new IllegalArgumentException("Invalid start time");
|
||||
} else if (rate < 0D) {
|
||||
throw new IllegalArgumentException("Rate should be >= 0");
|
||||
|
|
|
@ -31,6 +31,7 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventOverviewB
|
|||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpStatusType;
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService;
|
||||
|
@ -284,7 +285,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
|
||||
Date bolusStarted;
|
||||
try {
|
||||
bolusCommandResult = delegate.bolus(detailedBolusInfo.insulin, beepsEnabled, beepsEnabled, detailedBolusInfo.isSMB ? null :
|
||||
bolusCommandResult = delegate.bolus(PumpType.Insulet_Omnipod.determineCorrectBolusSize(detailedBolusInfo.insulin), beepsEnabled, beepsEnabled, detailedBolusInfo.isSMB ? null :
|
||||
(estimatedUnitsDelivered, percentage) -> {
|
||||
EventOverviewBolusProgress progressUpdateEvent = EventOverviewBolusProgress.INSTANCE;
|
||||
progressUpdateEvent.setStatus(getStringResource(R.string.bolusdelivering, detailedBolusInfo.insulin));
|
||||
|
@ -355,7 +356,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
boolean beepsEnabled = isTempBasalBeepsEnabled();
|
||||
long time = System.currentTimeMillis();
|
||||
try {
|
||||
delegate.setTemporaryBasal(tempBasalPair, beepsEnabled, beepsEnabled);
|
||||
delegate.setTemporaryBasal(PumpType.Insulet_Omnipod.determineCorrectBasalSize(tempBasalPair.getInsulinRate()), Duration.standardMinutes(tempBasalPair.getDurationMinutes()), beepsEnabled, beepsEnabled);
|
||||
time = System.currentTimeMillis();
|
||||
} catch (Exception ex) {
|
||||
if (ex instanceof PodFaultException) {
|
||||
|
@ -396,10 +397,10 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
long time = System.currentTimeMillis();
|
||||
try {
|
||||
delegate.cancelTemporaryBasal(isTempBasalBeepsEnabled());
|
||||
addSuccessToHistory(time, PodHistoryEntryType.CancelTemporaryBasal, null);
|
||||
addSuccessToHistory(time, PodHistoryEntryType.CancelTemporaryBasalForce, null);
|
||||
} catch (Exception ex) {
|
||||
String comment = handleAndTranslateException(ex);
|
||||
addFailureToHistory(time, PodHistoryEntryType.CancelTemporaryBasal, comment);
|
||||
addFailureToHistory(time, PodHistoryEntryType.CancelTemporaryBasalForce, comment);
|
||||
return new PumpEnactResult().success(false).enacted(false).comment(comment);
|
||||
}
|
||||
|
||||
|
@ -520,7 +521,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
|
||||
long time = System.currentTimeMillis();
|
||||
|
||||
addSuccessToHistory(time, PodHistoryEntryType.CancelTemporaryBasalForce, null);
|
||||
addSuccessToHistory(time, PodHistoryEntryType.CancelTemporaryBasal, null);
|
||||
|
||||
TemporaryBasal temporaryBasal = new TemporaryBasal() //
|
||||
.date(time) //
|
||||
|
@ -723,7 +724,8 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
}
|
||||
List<BasalScheduleEntry> entries = new ArrayList<>();
|
||||
for (Profile.ProfileValue basalValue : basalValues) {
|
||||
entries.add(new BasalScheduleEntry(basalValue.value, Duration.standardSeconds(basalValue.timeAsSeconds)));
|
||||
entries.add(new BasalScheduleEntry(PumpType.Insulet_Omnipod.determineCorrectBasalSize(basalValue.value),
|
||||
Duration.standardSeconds(basalValue.timeAsSeconds)));
|
||||
}
|
||||
|
||||
return new BasalSchedule(entries);
|
||||
|
|
|
@ -35,24 +35,52 @@ public class LocalAlertUtils {
|
|||
}
|
||||
|
||||
public static void checkPumpUnreachableAlarm(long lastConnection, boolean isStatusOutdated) {
|
||||
PumpInterface activePump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||
if(activePump != null && activePump.getPumpDescription().hasFixedUnreachableAlert) {
|
||||
checkPumpUnreachableAlarmStatic(activePump);
|
||||
} else {
|
||||
checkPumpUnreachableAlarmConfigured(lastConnection, isStatusOutdated);
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkPumpUnreachableAlarmStatic(PumpInterface pump) {
|
||||
if(pump == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(pump.isFixedUnreachableAlertTimeoutExceeded()) {
|
||||
log.debug("Generating static pump unreachable alarm.");
|
||||
|
||||
showUnreachableNotification(T.mins(30).msecs());
|
||||
} else {
|
||||
RxBus.INSTANCE.send(new EventDismissNotification(Notification.PUMP_UNREACHABLE));
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkPumpUnreachableAlarmConfigured(long lastConnection, boolean isStatusOutdated) {
|
||||
boolean alarmTimeoutExpired = lastConnection + pumpUnreachableThreshold() < 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)
|
||||
&& isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !LoopPlugin.getPlugin().isDisconnected()) {
|
||||
log.debug("Generating pump unreachable alarm. lastConnection: " + DateUtil.dateAndTimeString(lastConnection) + " isStatusOutdated: " + isStatusOutdated);
|
||||
Notification n = new Notification(Notification.PUMP_UNREACHABLE, MainApp.gs(R.string.pump_unreachable), Notification.URGENT);
|
||||
n.soundId = R.raw.alarm;
|
||||
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold());
|
||||
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
|
||||
NSUpload.uploadError(n.text);
|
||||
}
|
||||
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) {
|
||||
Notification n = new Notification(Notification.PUMP_UNREACHABLE, MainApp.gs(R.string.pump_unreachable), Notification.URGENT);
|
||||
n.soundId = R.raw.alarm;
|
||||
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + nextAlarmTimeoutMillis);
|
||||
RxBus.INSTANCE.send(new EventNewNotification(n));
|
||||
if (SP.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
|
||||
NSUpload.uploadError(n.text);
|
||||
}
|
||||
}
|
||||
|
||||
/*Presnoozes the alarms with 5 minutes if no snooze exists.
|
||||
* Call only at startup!
|
||||
*/
|
||||
|
|
|
@ -1704,8 +1704,8 @@
|
|||
<string name="omnipod_cmd_set_bolus">Set Bolus</string>
|
||||
<string name="omnipod_cmd_cancel_bolus">Cancel Bolus</string>
|
||||
<string name="omnipod_cmd_set_tbr">Set Temporary Basal</string>
|
||||
<string name="omnipod_cmd_cancel_tbr">Cancel Temporary Basal</string>
|
||||
<string name="omnipod_cmd_cancel_tbr_forced">Cancel Temporary Basal (Forced)</string>
|
||||
<string name="omnipod_cmd_cancel_tbr">Cancel Temporary Basal (Internally by driver)</string>
|
||||
<string name="omnipod_cmd_cancel_tbr_forced">Cancel Temporary Basal (Forced by user)</string>
|
||||
<string name="omnipod_cmd_set_basal_schedule">Set Basal Schedule</string>
|
||||
<string name="omnipod_cmd_get_pod_status">Get Pod Status</string>
|
||||
<string name="omnipod_cmd_get_pod_info">Get Pod Info</string>
|
||||
|
@ -1735,7 +1735,7 @@
|
|||
<string name="omnipod_init_pod_wizard_step3_title">Attach the Pod</string>
|
||||
<string name="omnipod_init_pod_wizard_step3_desc">\nPrepare the infusion site. Remove the Pod\'s needle cap and adhesive backing and attach the Pod to the infusion site.\n\nIf the cannula sticks out, please press <b>Cancel</b> and discard your Pod.\n\nPress <b>Next</b> to insert the cannula and begin basal delivery.</string>
|
||||
<string name="omnipod_init_pod_wizard_step4_title">Inserting cannula</string>
|
||||
<string name="omnipod_init_pod_wizard_step4_action_header">Trying to fill cannula and set initial basal schedule.\n\nWhen all items are checked, you can press <b>Next</b>.\n\n<b>Note:</b> please keep the Pod very close to the RileyLink at this time.</string>
|
||||
<string name="omnipod_init_pod_wizard_step4_action_header">Trying to set initial basal schedule and insert the cannula.\n\nWhen all items are checked, you can press <b>Next</b>.</string>
|
||||
|
||||
<string name="omnipod_init_pod_wizard_pod_info_title">Pod Info</string>
|
||||
<string name="omnipod_init_pod_wizard_pod_info_init_pod_description">\nThe Pod is now active.\n\nYour basal schedule has been programmed and the cannula has been inserted.\n\nPlease verify that the cannula has been inserted correctly and replace your Pod if you feel hasn\'t.</string>
|
||||
|
|
Loading…
Reference in a new issue