remove profile interface from dana pumps

This commit is contained in:
Milos Kozak 2019-12-14 21:20:01 +01:00
parent f2734a6c89
commit 4d953cf305
3 changed files with 4 additions and 38 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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);