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();
|
||||
|
||||
int getBatteryLevel(); // in percent as integer
|
||||
|
||||
PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo);
|
||||
void stopBolusDelivering();
|
||||
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;
|
||||
}
|
||||
|
||||
@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) -> {
|
||||
EventOverviewBolusProgress event = EventOverviewBolusProgress.getInstance();
|
||||
switch (state) {
|
||||
|
|
|
@ -153,6 +153,9 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
|||
@Override
|
||||
public double getReservoirLevel() { return pump.reservoirRemainingUnits; }
|
||||
|
||||
@Override
|
||||
public int getBatteryLevel() { return pump.batteryRemaining; }
|
||||
|
||||
@Override
|
||||
public void stopBolusDelivering() {
|
||||
if (sExecutionService == null) {
|
||||
|
|
|
@ -357,6 +357,9 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
|||
return pump.reservoirRemainingUnits;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBatteryLevel() { return pump.batteryRemaining; }
|
||||
|
||||
@Override
|
||||
public synchronized PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
||||
detailedBolusInfo.insulin = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(detailedBolusInfo.insulin)).value();
|
||||
|
|
|
@ -388,6 +388,9 @@ public class InsightPlugin extends PluginBase implements PumpInterface, Constrai
|
|||
@Override
|
||||
public double getReservoirLevel() { return reservoirInUnits; }
|
||||
|
||||
@Override
|
||||
public int getBatteryLevel() { return batteryPercent; }
|
||||
|
||||
public String getBaseBasalRateString() {
|
||||
final DecimalFormat df = new DecimalFormat("#.##");
|
||||
return df.format(basalRate);
|
||||
|
|
|
@ -132,6 +132,9 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
|
|||
@Override
|
||||
public double getReservoirLevel() { return -1; }
|
||||
|
||||
@Override
|
||||
public int getBatteryLevel() { return -1; }
|
||||
|
||||
@Override
|
||||
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
|
|
|
@ -200,6 +200,9 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
@Override
|
||||
public double getReservoirLevel() { return reservoirInUnits; }
|
||||
|
||||
@Override
|
||||
public int getBatteryLevel() { return batteryPercent; }
|
||||
|
||||
@Override
|
||||
public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
|
|
Loading…
Reference in a new issue