From 4dff0e3a56b289ef138e16ddf76b5c50c7fad1db Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 26 May 2017 15:33:42 +0200 Subject: [PATCH] rename treatment interfaace functions to be more clear --- .../interfaces/TreatmentsInterface.java | 36 ++++----- .../plugins/Actions/ActionsFragment.java | 8 +- .../ConfigBuilder/ConfigBuilderPlugin.java | 74 +++++++++---------- .../IobCobCalculatorPlugin.java | 2 +- .../DetermineBasalAdapterAMAJS.java | 6 +- .../plugins/OpenAPSAMA/OpenAPSAMAPlugin.java | 4 +- .../OpenAPSMA/DetermineBasalAdapterMAJS.java | 4 +- .../plugins/OpenAPSMA/OpenAPSMAPlugin.java | 5 +- .../plugins/Overview/OverviewFragment.java | 8 +- .../PersistentNotificationPlugin.java | 2 +- .../plugins/PumpDanaR/DanaRFragment.java | 8 +- .../plugins/PumpDanaR/DanaRPlugin.java | 38 +++++----- .../comm/MsgStatusBolusExtended.java | 12 +-- .../PumpDanaR/comm/MsgStatusTempBasal.java | 12 +-- .../PumpDanaRKorean/DanaRKoreanFragment.java | 8 +- .../PumpDanaRKorean/DanaRKoreanPlugin.java | 38 +++++----- .../plugins/PumpDanaRv2/DanaRv2Fragment.java | 6 +- .../plugins/PumpDanaRv2/DanaRv2Plugin.java | 17 ++--- .../PumpVirtual/VirtualPumpFragment.java | 6 +- .../PumpVirtual/VirtualPumpPlugin.java | 17 ++--- .../plugins/Treatments/TreatmentsPlugin.java | 48 ++++++------ .../TreatmentsExtendedBolusesFragment.java | 4 +- .../TreatmentsTempTargetFragment.java | 4 +- .../TreatmentsTemporaryBasalsFragment.java | 4 +- .../plugins/Wear/ActionStringHandler.java | 2 +- .../wearintegration/WatchUpdaterService.java | 12 +-- .../XDripStatusline/StatuslinePlugin.java | 2 +- 27 files changed, 192 insertions(+), 195 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java b/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java index 3e2131ce9d..d10a7fb0e8 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java @@ -25,31 +25,31 @@ public interface TreatmentsInterface { MealData getMealData(); - List getTreatments(); - List getTreatments5MinBack(long time); + List getTreatmentsFromHistory(); + List getTreatments5MinBackFromHistory(long time); - // real basals on pump - boolean isRealTempBasalInProgress(); - TemporaryBasal getRealTempBasal (long time); + // real basals (not faked by extended bolus) + boolean isInHistoryRealTempBasalInProgress(); + TemporaryBasal getRealTempBasalFromHistory(long time); - void tempBasalStart(TemporaryBasal tempBasal); - void tempBasalStop(long time); + void addToHistoryTempBasalStart(TemporaryBasal tempBasal); + void addToHistoryTempBasalStop(long time); // basal that can be faked by extended boluses boolean isTempBasalInProgress(); - TemporaryBasal getTempBasal (long time); - double getTempBasalAbsoluteRate(); - double getTempBasalRemainingMinutes(); - OverlappingIntervals getTemporaryBasals(); + TemporaryBasal getTempBasalFromHistory(long time); + double getTempBasalAbsoluteRateHistory(); + double getTempBasalRemainingMinutesFromHistory(); + OverlappingIntervals getTemporaryBasalsFromHistory(); - boolean isExtendedBoluslInProgress(); - ExtendedBolus getExtendedBolus (long time); - void extendedBolusStart(ExtendedBolus extendedBolus); - void extendedBolusStop(long time); - OverlappingIntervals getExtendedBoluses(); + boolean isInHistoryExtendedBoluslInProgress(); + ExtendedBolus getExtendedBolusFromHistory(long time); + void addToHistoryExtendedBolusStart(ExtendedBolus extendedBolus); + void addToHistoryExtendedBolusStop(long time); + OverlappingIntervals getExtendedBolusesFromHistory(); - TempTarget getTempTarget (long time); - OverlappingIntervals getTempTargets(); + TempTarget getTempTargetFromHistory(long time); + OverlappingIntervals getTempTargetsFromHistory(); long oldestDataAvaialable(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java index 4d771ca31d..aee078d5f6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java @@ -133,16 +133,16 @@ public class ActionsFragment extends Fragment implements View.OnClickListener { profileSwitch.setVisibility(View.GONE); else profileSwitch.setVisibility(View.VISIBLE); - if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isExtendedBoluslInProgress()) + if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) extendedBolus.setVisibility(View.GONE); else { extendedBolus.setVisibility(View.VISIBLE); } - if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().isExtendedBoluslInProgress()) + if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) extendedBolusCancel.setVisibility(View.GONE); else { extendedBolusCancel.setVisibility(View.VISIBLE); - ExtendedBolus running = MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()); + ExtendedBolus running = MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()); extendedBolusCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + running.toString()); } if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isTempBasalInProgress()) @@ -186,7 +186,7 @@ public class ActionsFragment extends Fragment implements View.OnClickListener { newExtendedDialog.show(manager, "NewExtendedDialog"); break; case R.id.actions_extendedbolus_cancel: - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress()) { + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { sHandler.post(new Runnable() { @Override public void run() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index 29658084aa..f307d19d60 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -638,10 +638,10 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain if (Config.logCongigBuilderActions) log.debug("applyAPSRequest: Basal set correctly"); } - } else if (isTempBasalInProgress() && Math.abs(request.rate - getTempBasalAbsoluteRate()) < 0.05) { + } else if (isTempBasalInProgress() && Math.abs(request.rate - getTempBasalAbsoluteRateHistory()) < 0.05) { result = new PumpEnactResult(); - result.absolute = getTempBasalAbsoluteRate(); - result.duration = getTempBasal(new Date().getTime()).getPlannedRemainingMinutes(); + result.absolute = getTempBasalAbsoluteRateHistory(); + result.duration = getTempBasalFromHistory(new Date().getTime()).getPlannedRemainingMinutes(); result.enacted = false; result.comment = "Temp basal set correctly"; result.success = true; @@ -852,23 +852,23 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain } @Override - public List getTreatments() { - return activeTreatments.getTreatments(); + public List getTreatmentsFromHistory() { + return activeTreatments.getTreatmentsFromHistory(); } @Override - public List getTreatments5MinBack(long time) { - return activeTreatments.getTreatments5MinBack(time); + public List getTreatments5MinBackFromHistory(long time) { + return activeTreatments.getTreatments5MinBackFromHistory(time); } @Override - public boolean isRealTempBasalInProgress() { - return activeTreatments.isRealTempBasalInProgress(); + public boolean isInHistoryRealTempBasalInProgress() { + return activeTreatments.isInHistoryRealTempBasalInProgress(); } @Override - public TemporaryBasal getRealTempBasal(long time) { - return activeTreatments.getRealTempBasal(time); + public TemporaryBasal getRealTempBasalFromHistory(long time) { + return activeTreatments.getRealTempBasalFromHistory(time); } @Override @@ -877,68 +877,68 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain } @Override - public TemporaryBasal getTempBasal(long time) { - return activeTreatments.getTempBasal(time); + public TemporaryBasal getTempBasalFromHistory(long time) { + return activeTreatments.getTempBasalFromHistory(time); } @Override - public double getTempBasalAbsoluteRate() { - return activeTreatments.getTempBasalAbsoluteRate(); + public double getTempBasalAbsoluteRateHistory() { + return activeTreatments.getTempBasalAbsoluteRateHistory(); } @Override - public double getTempBasalRemainingMinutes() { - return activeTreatments.getTempBasalRemainingMinutes(); + public double getTempBasalRemainingMinutesFromHistory() { + return activeTreatments.getTempBasalRemainingMinutesFromHistory(); } @Override - public OverlappingIntervals getTemporaryBasals() { - return activeTreatments.getTemporaryBasals(); + public OverlappingIntervals getTemporaryBasalsFromHistory() { + return activeTreatments.getTemporaryBasalsFromHistory(); } @Override - public void tempBasalStart(TemporaryBasal tempBasal) { - activeTreatments.tempBasalStart(tempBasal); + public void addToHistoryTempBasalStart(TemporaryBasal tempBasal) { + activeTreatments.addToHistoryTempBasalStart(tempBasal); } @Override - public void tempBasalStop(long time) { - activeTreatments.tempBasalStop(time); + public void addToHistoryTempBasalStop(long time) { + activeTreatments.addToHistoryTempBasalStop(time); } @Override - public boolean isExtendedBoluslInProgress() { - return activeTreatments.isExtendedBoluslInProgress(); + public boolean isInHistoryExtendedBoluslInProgress() { + return activeTreatments.isInHistoryExtendedBoluslInProgress(); } @Override - public ExtendedBolus getExtendedBolus(long time) { - return activeTreatments.getExtendedBolus(time); + public ExtendedBolus getExtendedBolusFromHistory(long time) { + return activeTreatments.getExtendedBolusFromHistory(time); } @Override - public void extendedBolusStart(ExtendedBolus extendedBolus) { - activeTreatments.extendedBolusStart(extendedBolus); + public void addToHistoryExtendedBolusStart(ExtendedBolus extendedBolus) { + activeTreatments.addToHistoryExtendedBolusStart(extendedBolus); } @Override - public void extendedBolusStop(long time) { - activeTreatments.extendedBolusStop(time); + public void addToHistoryExtendedBolusStop(long time) { + activeTreatments.addToHistoryExtendedBolusStop(time); } @Override - public OverlappingIntervals getExtendedBoluses() { - return activeTreatments.getExtendedBoluses(); + public OverlappingIntervals getExtendedBolusesFromHistory() { + return activeTreatments.getExtendedBolusesFromHistory(); } @Override - public TempTarget getTempTarget(long time) { - return activeTreatments.getTempTarget(time); + public TempTarget getTempTargetFromHistory(long time) { + return activeTreatments.getTempTargetFromHistory(time); } @Override - public OverlappingIntervals getTempTargets() { - return activeTreatments.getTempTargets(); + public OverlappingIntervals getTempTargetsFromHistory() { + return activeTreatments.getTempTargetsFromHistory(); } @Override diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java index d21a0ac2cf..1ad6c4121e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/IobCobCalculatorPlugin.java @@ -279,7 +279,7 @@ public class IobCobCalculatorPlugin implements PluginBase { double bgi = -iob.activity * sens * 5; double deviation = delta - bgi; - List recentTreatments = MainApp.getConfigBuilder().getTreatments5MinBack(bgTime); + List recentTreatments = MainApp.getConfigBuilder().getTreatments5MinBackFromHistory(bgTime); for (int ir = 0; ir < recentTreatments.size(); ir++) { autosensData.carbsFromBolus += recentTreatments.get(ir).carbs; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java index 49402da15c..75a839b659 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java @@ -228,11 +228,11 @@ public class DetermineBasalAdapterAMAJS { mCurrentTemp = new V8Object(mV8rt); mCurrentTemp.add("temp", "absolute"); - mCurrentTemp.add("duration", MainApp.getConfigBuilder().getTempBasalRemainingMinutes()); - mCurrentTemp.add("rate", MainApp.getConfigBuilder().getTempBasalAbsoluteRate()); + mCurrentTemp.add("duration", MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()); + mCurrentTemp.add("rate", MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()); // as we have non default temps longer than 30 mintues - TemporaryBasal tempBasal = MainApp.getConfigBuilder().getTempBasal(new Date().getTime()); + TemporaryBasal tempBasal = MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()); if(tempBasal != null){ mCurrentTemp.add("minutesrunning", tempBasal.getRealDuration()); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java index 45f1768ad6..d68ba9d5f8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java @@ -201,7 +201,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface { targetBg = verifyHardLimits(targetBg, "targetBg", Constants.VERY_HARD_LIMIT_TARGET_BG[0], Constants.VERY_HARD_LIMIT_TARGET_BG[1]); boolean isTempTarget = false; - TempTarget tempTarget = MainApp.getConfigBuilder().getTempTarget(new Date().getTime()); + TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(new Date().getTime()); if (tempTarget != null) { isTempTarget = true; minBg = verifyHardLimits(tempTarget.low, "minBg", Constants.VERY_HARD_LIMIT_TEMP_MIN_BG[0], Constants.VERY_HARD_LIMIT_TEMP_MIN_BG[1]); @@ -250,7 +250,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface { determineBasalResultAMA.changeRequested = false; // limit requests on openloop mode if (!MainApp.getConfigBuilder().isClosedModeEnabled()) { - if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultAMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRate()) < 0.1) + if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultAMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) determineBasalResultAMA.changeRequested = false; if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultAMA.rate - MainApp.getConfigBuilder().getBaseBasalRate()) < 0.1) determineBasalResultAMA.changeRequested = false; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalAdapterMAJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalAdapterMAJS.java index 38ce184cad..52ae7ae8c8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalAdapterMAJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalAdapterMAJS.java @@ -242,8 +242,8 @@ public class DetermineBasalAdapterMAJS { mProfile.add("sens", NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()).doubleValue(), units)); mProfile.add("current_basal", pump.getBaseBasalRate()); - mCurrentTemp.add("duration", MainApp.getConfigBuilder().getTempBasalRemainingMinutes()); - mCurrentTemp.add("rate", MainApp.getConfigBuilder().getTempBasalAbsoluteRate()); + mCurrentTemp.add("duration", MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()); + mCurrentTemp.add("rate", MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()); mIobData.add("iob", iobData.iob); //netIob mIobData.add("activity", iobData.activity); //netActivity diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java index d0f030b53f..26eb525b07 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java @@ -18,7 +18,6 @@ import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PumpInterface; -import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.plugins.Loop.APSResult; import info.nightscout.androidaps.plugins.Loop.ScriptReader; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile; @@ -201,7 +200,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface { maxBg = verifyHardLimits(maxBg, "maxBg", Constants.VERY_HARD_LIMIT_MAX_BG[0], Constants.VERY_HARD_LIMIT_MAX_BG[1]); targetBg = verifyHardLimits(targetBg, "targetBg", Constants.VERY_HARD_LIMIT_TARGET_BG[0], Constants.VERY_HARD_LIMIT_TARGET_BG[1]); - TempTarget tempTarget = MainApp.getConfigBuilder().getTempTarget(new Date().getTime()); + TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(new Date().getTime()); if (tempTarget != null) { minBg = verifyHardLimits(tempTarget.low, "minBg", Constants.VERY_HARD_LIMIT_TEMP_MIN_BG[0], Constants.VERY_HARD_LIMIT_TEMP_MIN_BG[1]); maxBg = verifyHardLimits(tempTarget.high, "maxBg", Constants.VERY_HARD_LIMIT_TEMP_MAX_BG[0], Constants.VERY_HARD_LIMIT_TEMP_MAX_BG[1]); @@ -228,7 +227,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface { determineBasalResultMA.changeRequested = false; // limit requests on openloop mode if (!MainApp.getConfigBuilder().isClosedModeEnabled()) { - if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRate()) < 0.1) + if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) determineBasalResultMA.changeRequested = false; if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - MainApp.getConfigBuilder().getBaseBasalRate()) < 0.1) determineBasalResultMA.changeRequested = false; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 95c99f8d25..0227416874 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -896,7 +896,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, // temp target NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile(); - TempTarget tempTarget = MainApp.getConfigBuilder().getTempTarget(new Date().getTime()); + TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(new Date().getTime()); if (tempTarget != null) { tempTargetView.setTextColor(Color.BLACK); tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetBackground)); @@ -936,7 +936,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, calibrationButton.setVisibility(View.GONE); } - TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasal(new Date().getTime()); + TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()); if (MainApp.getConfigBuilder().isTempBasalInProgress()) { cancelTempButton.setVisibility(View.VISIBLE); cancelTempButton.setText(MainApp.instance().getString(R.string.cancel) + "\n" + activeTemp.toStringShort()); @@ -1122,7 +1122,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, double lastBaseBasal = 0; double lastTempBasal = 0; for (long time = fromTime; time < now; time += 1 * 60 * 1000L) { - TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasal(time); + TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasalFromHistory(time); double baseBasalValue = profile.getBasal(NSProfile.secondsFromMidnight(new Date(time))); double baseLineValue = baseBasalValue; double tempBasalValue = 0; @@ -1411,7 +1411,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, // Treatments - List treatments = MainApp.getConfigBuilder().getTreatments(); + List treatments = MainApp.getConfigBuilder().getTreatmentsFromHistory(); List filteredTreatments = new ArrayList(); for (int tx = 0; tx < treatments.size(); tx++) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java index e8a2f9a769..91efde76c7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Persistentnotification/PersistentNotificationPlugin.java @@ -140,7 +140,7 @@ public class PersistentNotificationPlugin implements PluginBase{ PumpInterface pump = MainApp.getConfigBuilder(); if (MainApp.getConfigBuilder().isTempBasalInProgress()) { - TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasal(new Date().getTime()); + TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()); line1 += " " + activeTemp.toStringShort(); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java index fafcb80de8..95032fc052 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java @@ -229,13 +229,13 @@ public class DanaRFragment extends Fragment { dailyUnitsView.setText(DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U"); SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d); basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(getPlugin().getBaseBasalRate()) + " U/h"); - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) { - tempBasalView.setText(MainApp.getConfigBuilder().getRealTempBasal(new Date().getTime()).toString()); + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) { + tempBasalView.setText(MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).toString()); } else { tempBasalView.setText(""); } - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress()) { - extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()).toString()); + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { + extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString()); } else { extendedBolusView.setText(""); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java index e0175d041f..60ab6244aa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java @@ -132,7 +132,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT; - if (useExtendedBoluses != previousValue && MainApp.getConfigBuilder().isExtendedBoluslInProgress()) { + if (useExtendedBoluses != previousValue && MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { sExecutionService.extendedBolusStop(); } } @@ -351,13 +351,13 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf if (doTempOff) { // If extended in progress - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress() && useExtendedBoluses) { + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) { if (Config.logPumpActions) log.debug("setTempBasalAbsolute: Stopping extended bolus (doTempOff)"); return cancelExtendedBolus(); } // If temp in progress - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) { + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) { if (Config.logPumpActions) log.debug("setTempBasalAbsolute: Stopping temp basal (doTempOff)"); return cancelRealTempBasal(); @@ -380,7 +380,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf percentRate = getPumpDescription().maxHighTempPercent; } // If extended in progress - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress() && useExtendedBoluses) { + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) { if (Config.logPumpActions) log.debug("setTempBasalAbsolute: Stopping extended bolus (doLowTemp || doHighTemp)"); result = cancelExtendedBolus(); @@ -390,14 +390,14 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf } } // Check if some temp is already in progress - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) { + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) { // Correct basal already set ? - if (MainApp.getConfigBuilder().getRealTempBasal(new Date().getTime()).percentRate == percentRate) { + if (MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).percentRate == percentRate) { result.success = true; result.percent = percentRate; - result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRate(); + result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory(); result.enacted = false; - result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutes()).intValue(); + result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()).intValue(); result.isPercent = true; result.isTempCancel = false; if (Config.logPumpActions) @@ -421,7 +421,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf } if (doExtendedTemp) { // Check if some temp is already in progress - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) { + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) { if (Config.logPumpActions) log.debug("setTempBasalAbsolute: Stopping temp basal (doExtendedTemp)"); result = cancelRealTempBasal(); @@ -442,12 +442,12 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf // What is current rate of extended bolusing in u/h? if (Config.logPumpActions) { - log.debug("setTempBasalAbsolute: Extended bolus in progress: " + MainApp.getConfigBuilder().isExtendedBoluslInProgress() + " rate: " + pump.extendedBolusAbsoluteRate + "U/h duration remaining: " + pump.extendedBolusRemainingMinutes + "min"); + log.debug("setTempBasalAbsolute: Extended bolus in progress: " + MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() + " rate: " + pump.extendedBolusAbsoluteRate + "U/h duration remaining: " + pump.extendedBolusRemainingMinutes + "min"); log.debug("setTempBasalAbsolute: Rate to set: " + extendedRateToSet + "U/h"); } // Compare with extended rate in progress - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress() && Math.abs(pump.extendedBolusAbsoluteRate - extendedRateToSet) < getPumpDescription().extendedBolusStep) { + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && Math.abs(pump.extendedBolusAbsoluteRate - extendedRateToSet) < getPumpDescription().extendedBolusStep) { // correct extended already set result.success = true; result.absolute = pump.extendedBolusAbsoluteRate; @@ -574,9 +574,9 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf @Override public PumpEnactResult cancelTempBasal() { - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) return cancelRealTempBasal(); - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress() && useExtendedBoluses) { + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) { PumpEnactResult cancelEx = cancelExtendedBolus(); cancelEx.isFakedTempBasal = true; return cancelEx; @@ -669,13 +669,13 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf extended.put("LastBolus", pump.lastBolusTime.toLocaleString()); extended.put("LastBolusAmount", pump.lastBolusAmount); } - TemporaryBasal tb = MainApp.getConfigBuilder().getRealTempBasal(new Date().getTime()); + TemporaryBasal tb = MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()); if (tb != null) { extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(new Date().getTime())); extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date)); extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes()); } - ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()); + ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()); if (eb != null) { extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate()); extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date)); @@ -801,11 +801,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf if (pump.lastBolusTime.getTime() != 0) { ret += "LastBolus: " + DecimalFormatter.to2Decimal(pump.lastBolusAmount) + "U @" + android.text.format.DateFormat.format("HH:mm", pump.lastBolusTime) + "\n"; } - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) { - ret += "Temp: " + MainApp.getConfigBuilder().getRealTempBasal(new Date().getTime()).toString() + "\n"; + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) { + ret += "Temp: " + MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).toString() + "\n"; } - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress()) { - ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()).toString() + "\n"; + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { + ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString() + "\n"; } if (!veryShort) { ret += "TDD: " + DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U\n"; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusBolusExtended.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusBolusExtended.java index 5f64913cbd..db30dcbdaa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusBolusExtended.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusBolusExtended.java @@ -68,22 +68,22 @@ public class MsgStatusBolusExtended extends MessageBase { DanaRPump pump = DanaRPump.getInstance(); long now = new Date().getTime(); - if (treatmentsInterface.isExtendedBoluslInProgress()) { - ExtendedBolus extendedBolus = treatmentsInterface.getExtendedBolus(new Date().getTime()); + if (treatmentsInterface.isInHistoryExtendedBoluslInProgress()) { + ExtendedBolus extendedBolus = treatmentsInterface.getExtendedBolusFromHistory(new Date().getTime()); if (pump.isExtendedInProgress) { if (extendedBolus.absoluteRate() != pump.extendedBolusAbsoluteRate) { // Close current extended - treatmentsInterface.extendedBolusStop(now - 1000); + treatmentsInterface.addToHistoryExtendedBolusStop(now - 1000); // Create new ExtendedBolus newExtended = new ExtendedBolus(); newExtended.date = new Date(now).getTime(); newExtended.insulin = pump.extendedBolusAmount; newExtended.durationInMinutes = pump.extendedBolusMinutes; - treatmentsInterface.extendedBolusStart(newExtended); + treatmentsInterface.addToHistoryExtendedBolusStart(newExtended); } } else { // Close curent temp basal - treatmentsInterface.extendedBolusStop(now); + treatmentsInterface.addToHistoryExtendedBolusStop(now); } } else { if (pump.isExtendedInProgress) { @@ -92,7 +92,7 @@ public class MsgStatusBolusExtended extends MessageBase { newExtended.date = new Date(now).getTime(); newExtended.insulin = pump.extendedBolusAmount; newExtended.durationInMinutes = pump.extendedBolusMinutes; - treatmentsInterface.extendedBolusStart(newExtended); + treatmentsInterface.addToHistoryExtendedBolusStart(newExtended); } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusTempBasal.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusTempBasal.java index 791c6f6536..565243c2b3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusTempBasal.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgStatusTempBasal.java @@ -62,23 +62,23 @@ public class MsgStatusTempBasal extends MessageBase { DanaRPump danaRPump = DanaRPump.getInstance(); long now = new Date().getTime(); - if (treatmentsInterface.isRealTempBasalInProgress()) { - TemporaryBasal tempBasal = treatmentsInterface.getRealTempBasal(new Date().getTime()); + if (treatmentsInterface.isInHistoryRealTempBasalInProgress()) { + TemporaryBasal tempBasal = treatmentsInterface.getRealTempBasalFromHistory(new Date().getTime()); if (danaRPump.isTempBasalInProgress) { if (tempBasal.percentRate != danaRPump.tempBasalPercent) { // Close current temp basal - treatmentsInterface.tempBasalStop(now - 1000); + treatmentsInterface.addToHistoryTempBasalStop(now - 1000); // Create new TemporaryBasal newTempBasal = new TemporaryBasal(); newTempBasal.date = new Date(now).getTime(); newTempBasal.percentRate = danaRPump.tempBasalPercent; newTempBasal.isAbsolute = false; newTempBasal.durationInMinutes = danaRPump.tempBasalTotalSec / 60; - treatmentsInterface.tempBasalStart(newTempBasal); + treatmentsInterface.addToHistoryTempBasalStart(newTempBasal); } } else { // Close current temp basal - treatmentsInterface.tempBasalStop(now); + treatmentsInterface.addToHistoryTempBasalStop(now); } } else { if (danaRPump.isTempBasalInProgress) { @@ -88,7 +88,7 @@ public class MsgStatusTempBasal extends MessageBase { newTempBasal.percentRate = danaRPump.tempBasalPercent; newTempBasal.isAbsolute = false; newTempBasal.durationInMinutes = danaRPump.tempBasalTotalSec / 60; - treatmentsInterface.tempBasalStart(newTempBasal); + treatmentsInterface.addToHistoryTempBasalStart(newTempBasal); } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java index b0cca18e0d..f61892d9ca 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanFragment.java @@ -228,13 +228,13 @@ public class DanaRKoreanFragment extends Fragment { dailyUnitsView.setText(DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U"); SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d); basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(danaRKoreanPlugin.getBaseBasalRate()) + " U/h"); - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) { - tempBasalView.setText(MainApp.getConfigBuilder().getRealTempBasal(new Date().getTime()).toString()); + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) { + tempBasalView.setText(MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).toString()); } else { tempBasalView.setText(""); } - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress()) { - extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()).toString()); + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { + extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString()); } else { extendedBolusView.setText(""); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java index baadf5b572..6075168ef4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java @@ -135,7 +135,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT; - if (useExtendedBoluses != previousValue && MainApp.getConfigBuilder().isExtendedBoluslInProgress()) { + if (useExtendedBoluses != previousValue && MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { sExecutionService.extendedBolusStop(); } } @@ -354,13 +354,13 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints if (doTempOff) { // If extended in progress - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress() && useExtendedBoluses) { + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) { if (Config.logPumpActions) log.debug("setTempBasalAbsolute: Stopping extended bolus (doTempOff)"); return cancelExtendedBolus(); } // If temp in progress - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) { + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) { if (Config.logPumpActions) log.debug("setTempBasalAbsolute: Stopping temp basal (doTempOff)"); return cancelRealTempBasal(); @@ -383,7 +383,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints percentRate = 200; } // If extended in progress - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress() && useExtendedBoluses) { + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) { if (Config.logPumpActions) log.debug("setTempBasalAbsolute: Stopping extended bolus (doLowTemp || doHighTemp)"); result = cancelExtendedBolus(); @@ -393,14 +393,14 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints } } // Check if some temp is already in progress - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) { + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) { // Correct basal already set ? - if (MainApp.getConfigBuilder().getRealTempBasal(new Date().getTime()).percentRate == percentRate) { + if (MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).percentRate == percentRate) { result.success = true; result.percent = percentRate; - result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRate(); + result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory(); result.enacted = false; - result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutes()).intValue(); + result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()).intValue(); result.isPercent = true; result.isTempCancel = false; if (Config.logPumpActions) @@ -424,7 +424,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints } if (doExtendedTemp) { // Check if some temp is already in progress - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) { + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) { if (Config.logPumpActions) log.debug("setTempBasalAbsolute: Stopping temp basal (doExtendedTemp)"); result = cancelRealTempBasal(); @@ -445,12 +445,12 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints // What is current rate of extended bolusing in u/h? if (Config.logPumpActions) { - log.debug("setTempBasalAbsolute: Extended bolus in progress: " + MainApp.getConfigBuilder().isExtendedBoluslInProgress() + " rate: " + pump.extendedBolusAbsoluteRate + "U/h duration remaining: " + pump.extendedBolusRemainingMinutes + "min"); + log.debug("setTempBasalAbsolute: Extended bolus in progress: " + MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() + " rate: " + pump.extendedBolusAbsoluteRate + "U/h duration remaining: " + pump.extendedBolusRemainingMinutes + "min"); log.debug("setTempBasalAbsolute: Rate to set: " + extendedRateToSet + "U/h"); } // Compare with extended rate in progress - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress() && Math.abs(pump.extendedBolusAbsoluteRate - extendedRateToSet) < getPumpDescription().extendedBolusStep) { + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && Math.abs(pump.extendedBolusAbsoluteRate - extendedRateToSet) < getPumpDescription().extendedBolusStep) { // correct extended already set result.success = true; result.absolute = pump.extendedBolusAbsoluteRate; @@ -577,9 +577,9 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints @Override public PumpEnactResult cancelTempBasal() { - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) return cancelRealTempBasal(); - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress() && useExtendedBoluses) { + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) { PumpEnactResult cancelEx = cancelExtendedBolus(); cancelEx.isFakedTempBasal = true; return cancelEx; @@ -672,13 +672,13 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints extended.put("LastBolus", pump.lastBolusTime.toLocaleString()); extended.put("LastBolusAmount", pump.lastBolusAmount); } - TemporaryBasal tb = MainApp.getConfigBuilder().getRealTempBasal(new Date().getTime()); + TemporaryBasal tb = MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()); if (tb != null) { extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(new Date().getTime())); extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date)); extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes()); } - ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()); + ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()); if (eb != null) { extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate()); extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date)); @@ -804,11 +804,11 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints if (pump.lastBolusTime.getTime() != 0) { ret += "LastBolus: " + DecimalFormatter.to2Decimal(pump.lastBolusAmount) + "U @" + android.text.format.DateFormat.format("HH:mm", pump.lastBolusTime) + "\n"; } - if (MainApp.getConfigBuilder().isRealTempBasalInProgress()) { - ret += "Temp: " + MainApp.getConfigBuilder().getRealTempBasal(new Date().getTime()).toString() + "\n"; + if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) { + ret += "Temp: " + MainApp.getConfigBuilder().getRealTempBasalFromHistory(new Date().getTime()).toString() + "\n"; } - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress()) { - ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()).toString() + "\n"; + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { + ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString() + "\n"; } if (!veryShort) { ret += "TDD: " + DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U\n"; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Fragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Fragment.java index 877d5c9a6b..246a6af91d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Fragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Fragment.java @@ -227,12 +227,12 @@ public class DanaRv2Fragment extends Fragment { SetWarnColor.setColor(dailyUnitsView, pump.dailyTotalUnits, pump.maxDailyTotalUnits * 0.75d, pump.maxDailyTotalUnits * 0.9d); basaBasalRateView.setText("( " + (pump.activeProfile + 1) + " ) " + DecimalFormatter.to2Decimal(getPlugin().getBaseBasalRate()) + " U/h"); if (MainApp.getConfigBuilder().isTempBasalInProgress()) { - tempBasalView.setText(MainApp.getConfigBuilder().getTempBasal(new Date().getTime()).toString()); + tempBasalView.setText(MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()).toString()); } else { tempBasalView.setText(""); } - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress()) { - extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()).toString()); + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { + extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString()); } else { extendedBolusView.setText(""); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java index 351f446883..28734b76cc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java @@ -43,7 +43,6 @@ import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; import info.nightscout.androidaps.plugins.PumpDanaRv2.services.DanaRv2ExecutionService; -import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.utils.DateUtil; import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.Round; @@ -361,12 +360,12 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte // Check if some temp is already in progress if (MainApp.getConfigBuilder().isTempBasalInProgress()) { // Correct basal already set ? - if (MainApp.getConfigBuilder().getTempBasal(new Date().getTime()).percentRate == percentRate) { + if (MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()).percentRate == percentRate) { result.success = true; result.percent = percentRate; - result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRate(); + result.absolute = MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory(); result.enacted = false; - result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutes()).intValue(); + result.duration = ((Double) MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()).intValue(); result.isPercent = true; result.isTempCancel = false; if (Config.logPumpActions) @@ -588,13 +587,13 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte extended.put("LastBolus", pump.lastBolusTime.toLocaleString()); extended.put("LastBolusAmount", pump.lastBolusAmount); } - TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasal(new Date().getTime()); + TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()); if (tb != null) { extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(new Date().getTime())); extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date)); extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes()); } - ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()); + ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()); if (eb != null) { extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate()); extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date)); @@ -721,10 +720,10 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte ret += "LastBolus: " + DecimalFormatter.to2Decimal(pump.lastBolusAmount) + "U @" + android.text.format.DateFormat.format("HH:mm", pump.lastBolusTime) + "\n"; } if (MainApp.getConfigBuilder().isTempBasalInProgress()) { - ret += "Temp: " + MainApp.getConfigBuilder().getTempBasal(new Date().getTime()).toString() + "\n"; + ret += "Temp: " + MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()).toString() + "\n"; } - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress()) { - ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()).toString() + "\n"; + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { + ret += "Extended: " + MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString() + "\n"; } if (!veryShort) { ret += "TDD: " + DecimalFormatter.to0Decimal(pump.dailyTotalUnits) + " / " + pump.maxDailyTotalUnits + " U\n"; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java index f1f0fafe99..ef9efe4464 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java @@ -95,12 +95,12 @@ public class VirtualPumpFragment extends Fragment { basaBasalRateView.setText(virtualPumpPlugin.getBaseBasalRate() + "U"); if (MainApp.getConfigBuilder().isTempBasalInProgress()) { - tempBasalView.setText(MainApp.getConfigBuilder().getTempBasal(new Date().getTime()).toString()); + tempBasalView.setText(MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()).toString()); } else { tempBasalView.setText(""); } - if (MainApp.getConfigBuilder().isExtendedBoluslInProgress()) { - extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()).toString()); + if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) { + extendedBolusView.setText(MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()).toString()); } else { extendedBolusView.setText(""); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java index 51ea8cbc8c..cc86325848 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java @@ -27,7 +27,6 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress; import info.nightscout.androidaps.plugins.PumpVirtual.events.EventVirtualPumpUpdateGui; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile; -import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.utils.DateUtil; import info.nightscout.utils.NSUpload; @@ -249,7 +248,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { result.absolute = absoluteRate; result.duration = durationInMinutes; result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); - treatmentsInterface.tempBasalStart(tempBasal); + treatmentsInterface.addToHistoryTempBasalStart(tempBasal); if (Config.logPumpComm) log.debug("Setting temp basal absolute: " + result); MainApp.bus().post(new EventVirtualPumpUpdateGui()); @@ -278,7 +277,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { result.isTempCancel = false; result.duration = durationInMinutes; result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); - treatmentsInterface.tempBasalStart(tempBasal); + treatmentsInterface.addToHistoryTempBasalStart(tempBasal); if (Config.logPumpComm) log.debug("Settings temp basal percent: " + result); MainApp.bus().post(new EventVirtualPumpUpdateGui()); @@ -302,7 +301,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { result.isTempCancel = false; result.duration = durationInMinutes; result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); - treatmentsInterface.extendedBolusStart(extendedBolus); + treatmentsInterface.addToHistoryExtendedBolusStart(extendedBolus); if (Config.logPumpComm) log.debug("Setting extended bolus: " + result); MainApp.bus().post(new EventVirtualPumpUpdateGui()); @@ -319,7 +318,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); if (treatmentsInterface.isTempBasalInProgress()) { result.enacted = true; - treatmentsInterface.tempBasalStop(new Date().getTime()); + treatmentsInterface.addToHistoryTempBasalStop(new Date().getTime()); //tempBasal = null; if (Config.logPumpComm) log.debug("Canceling temp basal: " + result); @@ -333,8 +332,8 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { public PumpEnactResult cancelExtendedBolus() { TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder(); PumpEnactResult result = new PumpEnactResult(); - if (treatmentsInterface.isExtendedBoluslInProgress()) { - treatmentsInterface.extendedBolusStop(new Date().getTime()); + if (treatmentsInterface.isInHistoryExtendedBoluslInProgress()) { + treatmentsInterface.addToHistoryExtendedBolusStop(new Date().getTime()); } result.success = true; result.enacted = true; @@ -364,13 +363,13 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { try { extended.put("ActiveProfile", MainApp.getConfigBuilder().getActiveProfile().getProfile().getActiveProfile()); } catch (Exception e) {} - TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasal(new Date().getTime()); + TemporaryBasal tb = MainApp.getConfigBuilder().getTempBasalFromHistory(new Date().getTime()); if (tb != null) { extended.put("TempBasalAbsoluteRate", tb.tempBasalConvertedToAbsolute(new Date().getTime())); extended.put("TempBasalStart", DateUtil.dateAndTimeString(tb.date)); extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes()); } - ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolus(new Date().getTime()); + ExtendedBolus eb = MainApp.getConfigBuilder().getExtendedBolusFromHistory(new Date().getTime()); if (eb != null) { extended.put("ExtendedBolusAbsoluteRate", eb.absoluteRate()); extended.put("ExtendedBolusStart", DateUtil.dateAndTimeString(eb.date)); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java index 1360500468..a1efb315c9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java @@ -238,12 +238,12 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface { } @Override - public List getTreatments() { + public List getTreatmentsFromHistory() { return treatments; } @Override - public List getTreatments5MinBack(long time) { + public List getTreatments5MinBackFromHistory(long time) { List in5minback = new ArrayList<>(); for (Integer pos = 0; pos < treatments.size(); pos++) { Treatment t = treatments.get(pos); @@ -254,23 +254,23 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface { } @Override - public boolean isRealTempBasalInProgress() { - return getRealTempBasal(new Date().getTime()) != null; + public boolean isInHistoryRealTempBasalInProgress() { + return getRealTempBasalFromHistory(new Date().getTime()) != null; } @Override - public TemporaryBasal getRealTempBasal(long time) { + public TemporaryBasal getRealTempBasalFromHistory(long time) { return (TemporaryBasal) tempBasals.getValueByInterval(time); } @Override public boolean isTempBasalInProgress() { - return getTempBasal(new Date().getTime()) != null; + return getTempBasalFromHistory(new Date().getTime()) != null; } @Override - public boolean isExtendedBoluslInProgress() { - return getExtendedBolus(new Date().getTime()) != null; //TODO: crosscheck here + public boolean isInHistoryExtendedBoluslInProgress() { + return getExtendedBolusFromHistory(new Date().getTime()) != null; //TODO: crosscheck here } @Subscribe @@ -333,28 +333,28 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface { @Nullable @Override - public TemporaryBasal getTempBasal(long time) { - TemporaryBasal tb = getRealTempBasal(time); + public TemporaryBasal getTempBasalFromHistory(long time) { + TemporaryBasal tb = getRealTempBasalFromHistory(time); if (tb != null) return tb; - ExtendedBolus eb = getExtendedBolus(time); + ExtendedBolus eb = getExtendedBolusFromHistory(time); if (eb != null && MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses()) return new TemporaryBasal(eb); return null; } @Override - public ExtendedBolus getExtendedBolus(long time) { + public ExtendedBolus getExtendedBolusFromHistory(long time) { return (ExtendedBolus) extendedBoluses.getValueByInterval(time); } @Override - public void extendedBolusStart(ExtendedBolus extendedBolus) { + public void addToHistoryExtendedBolusStart(ExtendedBolus extendedBolus) { MainApp.getDbHelper().createOrUpdate(extendedBolus); } @Override - public void extendedBolusStop(long time) { + public void addToHistoryExtendedBolusStop(long time) { ExtendedBolus extendedBolus = new ExtendedBolus(); extendedBolus.date = time; extendedBolus.durationInMinutes = 0; @@ -362,15 +362,15 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface { } @Override - public OverlappingIntervals getExtendedBoluses() { + public OverlappingIntervals getExtendedBolusesFromHistory() { return extendedBoluses; } @Override - public double getTempBasalAbsoluteRate() { + public double getTempBasalAbsoluteRateHistory() { PumpInterface pump = MainApp.getConfigBuilder(); - TemporaryBasal tb = getTempBasal(new Date().getTime()); + TemporaryBasal tb = getTempBasalFromHistory(new Date().getTime()); if (tb != null) { if (tb.isAbsolute) { return tb.absoluteRate; @@ -384,24 +384,24 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface { } @Override - public double getTempBasalRemainingMinutes() { + public double getTempBasalRemainingMinutesFromHistory() { if (isTempBasalInProgress()) - return getTempBasal(new Date().getTime()).getPlannedRemainingMinutes(); + return getTempBasalFromHistory(new Date().getTime()).getPlannedRemainingMinutes(); return 0; } @Override - public OverlappingIntervals getTemporaryBasals() { + public OverlappingIntervals getTemporaryBasalsFromHistory() { return tempBasals; } @Override - public void tempBasalStart(TemporaryBasal tempBasal) { + public void addToHistoryTempBasalStart(TemporaryBasal tempBasal) { MainApp.getDbHelper().createOrUpdate(tempBasal); } @Override - public void tempBasalStop(long time) { + public void addToHistoryTempBasalStop(long time) { TemporaryBasal temporaryBasal = new TemporaryBasal(); temporaryBasal.date = time; temporaryBasal.durationInMinutes = 0; @@ -429,12 +429,12 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface { @Nullable @Override - public TempTarget getTempTarget(long time) { + public TempTarget getTempTargetFromHistory(long time) { return (TempTarget) tempTargets.getValueByInterval(time); } @Override - public OverlappingIntervals getTempTargets() { + public OverlappingIntervals getTempTargetsFromHistory() { return tempTargets; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsExtendedBolusesFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsExtendedBolusesFragment.java index bd7ecb9f6e..2964e41ea8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsExtendedBolusesFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsExtendedBolusesFragment.java @@ -167,7 +167,7 @@ public class TreatmentsExtendedBolusesFragment extends Fragment { llm = new LinearLayoutManager(view.getContext()); recyclerView.setLayoutManager(llm); - RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getConfigBuilder().getExtendedBoluses()); + RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getConfigBuilder().getExtendedBolusesFromHistory()); recyclerView.setAdapter(adapter); context = getContext(); @@ -204,7 +204,7 @@ public class TreatmentsExtendedBolusesFragment extends Fragment { activity.runOnUiThread(new Runnable() { @Override public void run() { - recyclerView.swapAdapter(new RecyclerViewAdapter(MainApp.getConfigBuilder().getExtendedBoluses()), false); + recyclerView.swapAdapter(new RecyclerViewAdapter(MainApp.getConfigBuilder().getExtendedBolusesFromHistory()), false); } }); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsTempTargetFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsTempTargetFragment.java index 8ded729c7d..5e1c4f8cdd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsTempTargetFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsTempTargetFragment.java @@ -159,7 +159,7 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli llm = new LinearLayoutManager(view.getContext()); recyclerView.setLayoutManager(llm); - RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getConfigBuilder().getTempTargets()); + RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getConfigBuilder().getTempTargetsFromHistory()); recyclerView.setAdapter(adapter); refreshFromNS = (Button) view.findViewById(R.id.temptargetrange_refreshfromnightscout); @@ -219,7 +219,7 @@ public class TreatmentsTempTargetFragment extends Fragment implements View.OnCli activity.runOnUiThread(new Runnable() { @Override public void run() { - recyclerView.swapAdapter(new RecyclerViewAdapter(MainApp.getConfigBuilder().getTempTargets()), false); + recyclerView.swapAdapter(new RecyclerViewAdapter(MainApp.getConfigBuilder().getTempTargetsFromHistory()), false); } }); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsTemporaryBasalsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsTemporaryBasalsFragment.java index 7c3d7f9ed5..436b908ecd 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsTemporaryBasalsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/fragments/TreatmentsTemporaryBasalsFragment.java @@ -183,7 +183,7 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment { llm = new LinearLayoutManager(view.getContext()); recyclerView.setLayoutManager(llm); - RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getConfigBuilder().getTemporaryBasals()); + RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getConfigBuilder().getTemporaryBasalsFromHistory()); recyclerView.setAdapter(adapter); tempBasalTotalView = (TextView) view.findViewById(R.id.tempbasals_totaltempiob); @@ -222,7 +222,7 @@ public class TreatmentsTemporaryBasalsFragment extends Fragment { activity.runOnUiThread(new Runnable() { @Override public void run() { - recyclerView.swapAdapter(new RecyclerViewAdapter(MainApp.getConfigBuilder().getTemporaryBasals()), false); + recyclerView.swapAdapter(new RecyclerViewAdapter(MainApp.getConfigBuilder().getTemporaryBasalsFromHistory()), false); if (MainApp.getConfigBuilder().getLastCalculationTempBasals() != null) { String totalText = DecimalFormatter.to2Decimal(MainApp.getConfigBuilder().getLastCalculationTempBasals().basaliob) + " U"; tempBasalTotalView.setText(totalText); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index ed2ce5485d..4a03ee1972 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -275,7 +275,7 @@ public class ActionStringHandler { } //Check for Temp-Target: - TempTarget tempTarget = MainApp.getConfigBuilder().getTempTarget(new Date().getTime()); + TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(new Date().getTime()); if (tempTarget != null) { ret += "Temp Target: " + NSProfile.toUnitsString(tempTarget.low, NSProfile.fromMgdlToUnits(tempTarget.low, profile.getUnits()), profile.getUnits()) + " - " + NSProfile.toUnitsString(tempTarget.high, NSProfile.fromMgdlToUnits(tempTarget.high, profile.getUnits()), profile.getUnits()); ret += "\nuntil: " + DateUtil.timeString(tempTarget.originalEnd()); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java index 3d74eec9b9..2e3523bf41 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java @@ -351,8 +351,8 @@ public class WatchUpdaterService extends WearableListenerService implements double beginBasalValue = profile.getBasal(NSProfile.secondsFromMidnight(new Date(beginBasalSegmentTime))); double endBasalValue = beginBasalValue; - TemporaryBasal tb1 = MainApp.getConfigBuilder().getTempBasal(runningTime); - TemporaryBasal tb2 = MainApp.getConfigBuilder().getTempBasal(runningTime); + TemporaryBasal tb1 = MainApp.getConfigBuilder().getTempBasalFromHistory(runningTime); + TemporaryBasal tb2 = MainApp.getConfigBuilder().getTempBasalFromHistory(runningTime); double tb_before = beginBasalValue; double tb_amount = beginBasalValue; long tb_start = runningTime; @@ -378,7 +378,7 @@ public class WatchUpdaterService extends WearableListenerService implements } //temps - tb2 = MainApp.getConfigBuilder().getTempBasal(runningTime); + tb2 = MainApp.getConfigBuilder().getTempBasalFromHistory(runningTime); if (tb1 == null && tb2 == null) { //no temp stays no temp @@ -411,7 +411,7 @@ public class WatchUpdaterService extends WearableListenerService implements basals.add(basalMap(beginBasalSegmentTime, runningTime, beginBasalValue)); } if (tb1 != null) { - tb2 = MainApp.getConfigBuilder().getTempBasal(now); //use "now" to express current situation + tb2 = MainApp.getConfigBuilder().getTempBasalFromHistory(now); //use "now" to express current situation if (tb2 == null) { //express the cancelled temp by painting it down one minute early temps.add(tempDatamap(tb_start, tb_before, now - 1 * 60 * 1000, endBasalValue, tb_amount)); @@ -426,7 +426,7 @@ public class WatchUpdaterService extends WearableListenerService implements } } } else { - tb2 = MainApp.getConfigBuilder().getTempBasal(now); //use "now" to express current situation + tb2 = MainApp.getConfigBuilder().getTempBasalFromHistory(now); //use "now" to express current situation if (tb2 != null) { //onset at the end double currentAmount = tb2.tempBasalConvertedToAbsolute(runningTime); @@ -541,7 +541,7 @@ public class WatchUpdaterService extends WearableListenerService implements TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder(); if (treatmentsInterface.isTempBasalInProgress()) { - TemporaryBasal activeTemp = treatmentsInterface.getTempBasal(new Date().getTime()); + TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(new Date().getTime()); if (shortString) { status += activeTemp.toStringShort(); } else { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java index ed998c2b6a..8e4d419c1b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/XDripStatusline/StatuslinePlugin.java @@ -165,7 +165,7 @@ public class StatuslinePlugin implements PluginBase { TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder(); if (treatmentsInterface.isTempBasalInProgress()) { - TemporaryBasal activeTemp = treatmentsInterface.getTempBasal(new Date().getTime()); + TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(new Date().getTime()); if (shortString) { status += activeTemp.toStringShort(); } else {