Implement getBatteryLevel() in PumpInterface and for all pump plugins
This commit is contained in:
parent
f28fca668f
commit
a7aa4c2b5a
7 changed files with 29 additions and 0 deletions
|
@ -35,6 +35,8 @@ public interface PumpInterface {
|
||||||
|
|
||||||
double getReservoirLevel();
|
double getReservoirLevel();
|
||||||
|
|
||||||
|
int getBatteryLevel(); // in percent as integer
|
||||||
|
|
||||||
PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo);
|
PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo);
|
||||||
void stopBolusDelivering();
|
void stopBolusDelivering();
|
||||||
PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew);
|
PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew);
|
||||||
|
|
|
@ -428,6 +428,18 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
|
||||||
return pump.reservoirLevel;
|
return pump.reservoirLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBatteryLevel() {
|
||||||
|
switch (pump.state.batteryState) {
|
||||||
|
case PumpState.EMPTY:
|
||||||
|
return 0;
|
||||||
|
case PumpState.LOW:
|
||||||
|
return 25;
|
||||||
|
default:
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static BolusProgressReporter bolusProgressReporter = (state, percent, delivered) -> {
|
private static BolusProgressReporter bolusProgressReporter = (state, percent, delivered) -> {
|
||||||
EventOverviewBolusProgress event = EventOverviewBolusProgress.getInstance();
|
EventOverviewBolusProgress event = EventOverviewBolusProgress.getInstance();
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
|
|
@ -153,6 +153,9 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
||||||
@Override
|
@Override
|
||||||
public double getReservoirLevel() { return pump.reservoirRemainingUnits; }
|
public double getReservoirLevel() { return pump.reservoirRemainingUnits; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBatteryLevel() { return pump.batteryRemaining; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stopBolusDelivering() {
|
public void stopBolusDelivering() {
|
||||||
if (sExecutionService == null) {
|
if (sExecutionService == null) {
|
||||||
|
|
|
@ -357,6 +357,9 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
||||||
return pump.reservoirRemainingUnits;
|
return pump.reservoirRemainingUnits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBatteryLevel() { return pump.batteryRemaining; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
public synchronized PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
||||||
detailedBolusInfo.insulin = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(detailedBolusInfo.insulin)).value();
|
detailedBolusInfo.insulin = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(detailedBolusInfo.insulin)).value();
|
||||||
|
|
|
@ -388,6 +388,9 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai
|
||||||
@Override
|
@Override
|
||||||
public double getReservoirLevel() { return reservoirInUnits; }
|
public double getReservoirLevel() { return reservoirInUnits; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBatteryLevel() { return batteryPercent; }
|
||||||
|
|
||||||
public String getBaseBasalRateString() {
|
public String getBaseBasalRateString() {
|
||||||
final DecimalFormat df = new DecimalFormat("#.##");
|
final DecimalFormat df = new DecimalFormat("#.##");
|
||||||
return df.format(basalRate);
|
return df.format(basalRate);
|
||||||
|
|
|
@ -132,6 +132,9 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
|
||||||
@Override
|
@Override
|
||||||
public double getReservoirLevel() { return -1; }
|
public double getReservoirLevel() { return -1; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBatteryLevel() { return -1; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
|
|
|
@ -200,6 +200,9 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
||||||
@Override
|
@Override
|
||||||
public double getReservoirLevel() { return reservoirInUnits; }
|
public double getReservoirLevel() { return reservoirInUnits; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBatteryLevel() { return batteryPercent; }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
|
|
Loading…
Reference in a new issue