On bolus cancel request, cancel all boluses. Partially addresses #646.

This commit is contained in:
Johannes Mockenhaupt 2018-05-13 23:44:12 +02:00
parent 7be418fdf2
commit 25aa6f859f
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 7 additions and 1 deletions

View file

@ -112,7 +112,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
stopPressed = true; stopPressed = true;
stopPressedView.setVisibility(View.VISIBLE); stopPressedView.setVisibility(View.VISIBLE);
stopButton.setVisibility(View.INVISIBLE); stopButton.setVisibility(View.INVISIBLE);
ConfigBuilderPlugin.getActivePump().stopBolusDelivering(); ConfigBuilderPlugin.getCommandQueue().cancelAllBoluses();
break; break;
} }
} }

View file

@ -213,6 +213,12 @@ public class CommandQueue {
return true; return true;
} }
public synchronized void cancelAllBoluses() {
removeAll(Command.CommandType.BOLUS);
removeAll(Command.CommandType.SMB_BOLUS);
ConfigBuilderPlugin.getActivePump().stopBolusDelivering();
}
// returns true if command is queued // returns true if command is queued
public boolean tempBasalAbsolute(double absoluteRate, int durationInMinutes, boolean enforceNew, Profile profile, Callback callback) { public boolean tempBasalAbsolute(double absoluteRate, int durationInMinutes, boolean enforceNew, Profile profile, Callback callback) {
if (!enforceNew && isRunning(Command.CommandType.TEMPBASAL)) { if (!enforceNew && isRunning(Command.CommandType.TEMPBASAL)) {