virtual pump description

This commit is contained in:
Milos Kozak 2016-12-09 21:30:34 +01:00
parent b824cc28c9
commit 2a10d4789e
4 changed files with 61 additions and 25 deletions

View file

@ -5,9 +5,9 @@ package info.nightscout.androidaps.interfaces;
*/ */
public class PumpDescription { public class PumpDescription {
public static final int PERCENT = 0; public static final int PERCENT = 1;
public static final int ABSOLUTE = 1; public static final int ABSOLUTE = 2;
public static final int EXTENDED = 2; public static final int EXTENDED = 4;
public boolean isBolusCapable = true; public boolean isBolusCapable = true;
public double bolusStep = 0.1d; public double bolusStep = 0.1d;
@ -18,11 +18,16 @@ public class PumpDescription {
public boolean isTempBasalCapable = true; public boolean isTempBasalCapable = true;
public int lowTempBasalStyle = PERCENT; public int lowTempBasalStyle = PERCENT;
public int highTempBasalStyle = PERCENT; public int highTempBasalStyle = PERCENT;
public double maxHighTemp = 200; public double maxHighTempPercent = 200;
public double lowTempStep = 10; public double maxHighTempAbsolute = 0; // zero = no limit
public int lowTempDuration = 60; public double lowTempPercentStep = 10;
public double highTempStep = 10; public double lowTempAbsoluteStep = 0.05d;
public int highTempDuration = 60; public int lowTempPercentDuration = 30;
public int lowTempAbsoluteDuration = 30;
public double highTempPercentStep = 10;
public double highTempAbsoluteStep = 0.05d;
public int highTempPercentDuration = 30;
public int highTempAbsoluteDuration = 30;
public boolean isSetBasalProfileCapable = true; public boolean isSetBasalProfileCapable = true;
public double basalStep = 0.01d; public double basalStep = 0.01d;

View file

@ -16,7 +16,6 @@ import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.text.DateFormat;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
@ -88,11 +87,16 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
pumpDescription.isTempBasalCapable = true; pumpDescription.isTempBasalCapable = true;
pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT; pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT; pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
pumpDescription.maxHighTemp = useExtendedBoluses ? 0: 200; pumpDescription.maxHighTempPercent = 200;
pumpDescription.lowTempStep = 10; pumpDescription.maxHighTempAbsolute = 0;
pumpDescription.lowTempDuration = 60; pumpDescription.lowTempPercentStep = 10;
pumpDescription.highTempStep = useExtendedBoluses ? 0.05d : 10; pumpDescription.lowTempAbsoluteStep = 0;
pumpDescription.highTempDuration = useExtendedBoluses ? 30 : 60; pumpDescription.lowTempPercentDuration = 60;
pumpDescription.lowTempAbsoluteDuration = 60;
pumpDescription.highTempPercentStep = 10;
pumpDescription.highTempAbsoluteStep = 0.05d;
pumpDescription.highTempPercentDuration = 60;
pumpDescription.highTempAbsoluteDuration = 30;
pumpDescription.isSetBasalProfileCapable = true; pumpDescription.isSetBasalProfileCapable = true;
pumpDescription.basalStep = 0.01d; pumpDescription.basalStep = 0.01d;
@ -129,9 +133,6 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false); useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false);
pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT; pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
pumpDescription.maxHighTemp = useExtendedBoluses ? 0: 200;
pumpDescription.highTempStep = useExtendedBoluses ? 0.05d : 10;
pumpDescription.highTempDuration = useExtendedBoluses ? 30 : 60;
if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) { if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) {
sExecutionService.extendedBolusStop(); sExecutionService.extendedBolusStop();

View file

@ -87,11 +87,16 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
pumpDescription.isTempBasalCapable = true; pumpDescription.isTempBasalCapable = true;
pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT; pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT; pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
pumpDescription.maxHighTemp = useExtendedBoluses ? 0: 200; pumpDescription.maxHighTempPercent = 200;
pumpDescription.lowTempStep = 10; pumpDescription.maxHighTempAbsolute = 0;
pumpDescription.lowTempDuration = 60; pumpDescription.lowTempPercentStep = 10;
pumpDescription.highTempStep = useExtendedBoluses ? 0.05d : 10; pumpDescription.lowTempAbsoluteStep = 0;
pumpDescription.highTempDuration = useExtendedBoluses ? 30 : 60; pumpDescription.lowTempPercentDuration = 60;
pumpDescription.lowTempAbsoluteDuration = 60;
pumpDescription.highTempPercentStep = 10;
pumpDescription.highTempAbsoluteStep = 0.05d;
pumpDescription.highTempPercentDuration = 60;
pumpDescription.highTempAbsoluteDuration = 30;
pumpDescription.isSetBasalProfileCapable = true; pumpDescription.isSetBasalProfileCapable = true;
pumpDescription.basalStep = 0.01d; pumpDescription.basalStep = 0.01d;
@ -128,9 +133,6 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false); useExtendedBoluses = sharedPreferences.getBoolean("danar_useextended", false);
pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT; pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
pumpDescription.maxHighTemp = useExtendedBoluses ? 0: 200;
pumpDescription.highTempStep = useExtendedBoluses ? 0.05d : 10;
pumpDescription.highTempDuration = useExtendedBoluses ? 30 : 60;
if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) { if (useExtendedBoluses != previousValue && isExtendedBoluslInProgress()) {
sExecutionService.extendedBolusStop(); sExecutionService.extendedBolusStop();

View file

@ -40,6 +40,34 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
PumpDescription pumpDescription = new PumpDescription(); PumpDescription pumpDescription = new PumpDescription();
public VirtualPumpPlugin() {
pumpDescription.isBolusCapable = true;
pumpDescription.bolusStep = 1d;
pumpDescription.isExtendedBolusCapable = true;
pumpDescription.extendedBolusStep = 0.2d;
pumpDescription.isTempBasalCapable = true;
pumpDescription.lowTempBasalStyle = PumpDescription.ABSOLUTE | PumpDescription.PERCENT;
pumpDescription.highTempBasalStyle = PumpDescription.ABSOLUTE | PumpDescription.PERCENT;
pumpDescription.maxHighTempPercent = 600;
pumpDescription.maxHighTempAbsolute = 10;
pumpDescription.lowTempPercentStep = 5;
pumpDescription.lowTempAbsoluteStep = 0.1;
pumpDescription.lowTempPercentDuration = 30;
pumpDescription.lowTempAbsoluteDuration = 30;
pumpDescription.highTempPercentStep = 10;
pumpDescription.highTempAbsoluteStep = 0.05d;
pumpDescription.highTempPercentDuration = 30;
pumpDescription.highTempAbsoluteDuration = 30;
pumpDescription.isSetBasalProfileCapable = true;
pumpDescription.basalStep = 0.01d;
pumpDescription.basalMinimumRate = 0.04d;
pumpDescription.isRefillingCapable = false;
}
@Override @Override
public String getFragmentClass() { public String getFragmentClass() {
return VirtualPumpFragment.class.getName(); return VirtualPumpFragment.class.getName();