From 4d953cf3059e769fe4318aeb323906ec4ce1ff3f Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sat, 14 Dec 2019 21:20:01 +0100 Subject: [PATCH] remove profile interface from dana pumps --- .../nightscout/androidaps/data/Profile.java | 2 +- .../pump/danaR/AbstractDanaRPlugin.java | 19 +---------------- .../plugins/pump/danaRS/DanaRSPlugin.java | 21 ++----------------- 3 files changed, 4 insertions(+), 38 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/data/Profile.java b/app/src/main/java/info/nightscout/androidaps/data/Profile.java index 00d4bafebe..6ac3517054 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/Profile.java +++ b/app/src/main/java/info/nightscout/androidaps/data/Profile.java @@ -589,7 +589,7 @@ public class Profile { public double getMaxDailyBasal() { double max = 0d; for (int hour = 0; hour < 24; hour++) { - double value = getBasalTimeFromMidnight((Integer) (hour * 60 * 60)); + double value = getBasalTimeFromMidnight(hour * 60 * 60); if (value > max) max = value; } return max; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java index d8b2873a50..57dadbdc55 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaR/AbstractDanaRPlugin.java @@ -1,6 +1,5 @@ package info.nightscout.androidaps.plugins.pump.danaR; -import androidx.annotation.Nullable; import androidx.fragment.app.FragmentActivity; import org.json.JSONException; @@ -15,7 +14,6 @@ import info.nightscout.androidaps.BuildConfig; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.Profile; -import info.nightscout.androidaps.data.ProfileStore; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.TemporaryBasal; @@ -25,7 +23,6 @@ import info.nightscout.androidaps.interfaces.DanaRInterface; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginType; -import info.nightscout.androidaps.interfaces.ProfileInterface; import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.logging.L; @@ -49,7 +46,7 @@ import info.nightscout.androidaps.utils.SP; * Created by mike on 28.01.2018. */ -public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInterface, DanaRInterface, ConstraintsInterface, ProfileInterface { +public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInterface, DanaRInterface, ConstraintsInterface { protected Logger log = LoggerFactory.getLogger(L.PUMP); protected AbstractDanaRExecutionService sExecutionService; @@ -143,7 +140,6 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte for (int h = 0; h < basalValues; h++) { Double pumpValue = pump.pumpProfiles[pump.activeProfile][h]; Double profileValue = profile.getBasalTimeFromMidnight(h * basalIncrement); - if (profileValue == null) return true; if (Math.abs(pumpValue - profileValue) > getPumpDescription().basalStep) { if (L.isEnabled(L.PUMP)) log.debug("Diff found. Hour: " + h + " Pump: " + pumpValue + " Profile: " + profileValue); @@ -436,19 +432,6 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte return applyBolusConstraints(insulin); } - @Nullable - @Override - public ProfileStore getProfile() { - if (DanaRPump.getInstance().lastSettingsRead == 0) - return null; // no info now - return DanaRPump.getInstance().createConvertedProfile(); - } - - @Override - public String getProfileName() { - return DanaRPump.getInstance().createConvertedProfileName(); - } - @Override public PumpEnactResult loadTDDs() { return loadHistory(RecordTypes.RECORD_TYPE_DAILY); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java index 0eedd374b2..8c8780d021 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/danaRS/DanaRSPlugin.java @@ -34,7 +34,6 @@ import info.nightscout.androidaps.interfaces.DanaRInterface; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginType; -import info.nightscout.androidaps.interfaces.ProfileInterface; import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.logging.L; @@ -70,7 +69,7 @@ import io.reactivex.schedulers.Schedulers; * Created by mike on 03.09.2017. */ -public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInterface, ConstraintsInterface, ProfileInterface { +public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInterface, ConstraintsInterface { private Logger log = LoggerFactory.getLogger(L.PUMP); private CompositeDisposable disposable = new CompositeDisposable(); @@ -275,21 +274,6 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte return applyBolusConstraints(insulin); } - // Profile interface - - @Nullable - @Override - public ProfileStore getProfile() { - if (DanaRPump.getInstance().lastSettingsRead == 0) - return null; // no info now - return DanaRPump.getInstance().createConvertedProfile(); - } - - @Override - public String getProfileName() { - return DanaRPump.getInstance().createConvertedProfileName(); - } - // Pump interface @Override @@ -354,8 +338,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte int basalIncrement = pump.basal48Enable ? 30 * 60 : 60 * 60; for (int h = 0; h < basalValues; h++) { Double pumpValue = pump.pumpProfiles[pump.activeProfile][h]; - Double profileValue = profile.getBasalTimeFromMidnight((Integer) (h * basalIncrement)); - if (profileValue == null) return true; + Double profileValue = profile.getBasalTimeFromMidnight(h * basalIncrement); if (Math.abs(pumpValue - profileValue) > getPumpDescription().basalStep) { if (L.isEnabled(L.PUMP)) log.debug("Diff found. Hour: " + h + " Pump: " + pumpValue + " Profile: " + profileValue);