added PumpDescription

This commit is contained in:
Milos Kozak 2016-12-08 15:21:16 +01:00
parent 0044b8b41a
commit 073cc84368
6 changed files with 70 additions and 0 deletions

View file

@ -0,0 +1,28 @@
package info.nightscout.androidaps.interfaces;
/**
* Created by mike on 08.12.2016.
*/
public class PumpDescription {
public final int PERCENT = 0;
public final int ABSOLUTE = 0;
public boolean isBolusCapable = true;
public double bolusStep = 0.1d;
public boolean isExtendedBolusCapable = true;
public double extendedBolusStep = 0.1d;
public boolean isTempBasalCapable = true;
public int lowTempBasalStyle = PERCENT;
public int highTempBasalStyle = PERCENT;
public double maxHighTemp = 200;
public double lowTempStep = 10;
public double highTempStep = 10;
public boolean isSetBasalProfileCapable = true;
public double basalStep = 0.01d;
public boolean isRefillingCapable = false;
}

View file

@ -42,4 +42,6 @@ public interface PumpInterface {
// Status to be passed to NS
JSONObject getJSONStatus();
String deviceID();
PumpDescription getPumpDescription();
}

View file

@ -35,6 +35,7 @@ import info.nightscout.androidaps.interfaces.BgSourceInterface;
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.interfaces.TempBasalsInterface;
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
@ -594,6 +595,21 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
else return "Unknown";
}
@Override
public PumpDescription getPumpDescription() {
if (activePump != null)
return activePump.getPumpDescription();
else {
PumpDescription emptyDescription = new PumpDescription();
emptyDescription.isBolusCapable = false;
emptyDescription.isExtendedBolusCapable = false;
emptyDescription.isSetBasalProfileCapable = false;
emptyDescription.isTempBasalCapable = false;
emptyDescription.isRefillingCapable = false;
return emptyDescription;
}
}
/**
* Constraints interface
**/

View file

@ -33,6 +33,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.DanaR.Services.ExecutionService;
@ -63,6 +64,8 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
private static DanaRPump sDanaRPump = new DanaRPump();
private static boolean useExtendedBoluses = false;
private static PumpDescription pumpDescription = new PumpDescription();
public static DanaRPump getDanaRPump() {
return sDanaRPump;
}
@ -633,6 +636,11 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
return getDanaRPump().serialNumber;
}
@Override
public PumpDescription getPumpDescription() {
return pumpDescription;
}
/**
* Constraint interface
*/

View file

@ -32,6 +32,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.ProfileInterface;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.DanaRKorean.Services.ExecutionService;
@ -62,6 +63,8 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
private static DanaRKoreanPump sDanaRKoreanPump = new DanaRKoreanPump();
private static boolean useExtendedBoluses = false;
private PumpDescription pumpDescription = new PumpDescription();
public static DanaRKoreanPump getDanaRPump() {
return sDanaRKoreanPump;
}
@ -632,6 +635,11 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
return getDanaRPump().serialNumber;
}
@Override
public PumpDescription getPumpDescription() {
return pumpDescription;
}
/**
* Constraint interface
*/

View file

@ -17,6 +17,7 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.TempBasal;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
import info.nightscout.androidaps.plugins.VirtualPump.events.EventVirtualPumpUpdateGui;
@ -37,6 +38,8 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
boolean fragmentEnabled = true;
boolean fragmentVisible = true;
PumpDescription pumpDescription = new PumpDescription();
@Override
public String getFragmentClass() {
return VirtualPumpFragment.class.getName();
@ -367,4 +370,9 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
return "VirtualPump";
}
@Override
public PumpDescription getPumpDescription() {
return pumpDescription;
}
}