Merge pull request #902 from MilosKozak/commandQueue-enforce

Enforce TBRs on enforceNew
This commit is contained in:
Milos Kozak 2018-04-20 18:34:19 +02:00 committed by GitHub
commit 39cc59708a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -205,7 +205,7 @@ public class CommandQueue {
// 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 (isRunning(Command.CommandType.TEMPBASAL)) { if (!enforceNew && isRunning(Command.CommandType.TEMPBASAL)) {
if (callback != null) if (callback != null)
callback.result(executingNowError()).run(); callback.result(executingNowError()).run();
return false; return false;
@ -226,7 +226,7 @@ public class CommandQueue {
// returns true if command is queued // returns true if command is queued
public boolean tempBasalPercent(Integer percent, int durationInMinutes, boolean enforceNew, Profile profile, Callback callback) { public boolean tempBasalPercent(Integer percent, int durationInMinutes, boolean enforceNew, Profile profile, Callback callback) {
if (isRunning(Command.CommandType.TEMPBASAL)) { if (!enforceNew && isRunning(Command.CommandType.TEMPBASAL)) {
if (callback != null) if (callback != null)
callback.result(executingNowError()).run(); callback.result(executingNowError()).run();
return false; return false;
@ -268,7 +268,7 @@ public class CommandQueue {
// returns true if command is queued // returns true if command is queued
public boolean cancelTempBasal(boolean enforceNew, Callback callback) { public boolean cancelTempBasal(boolean enforceNew, Callback callback) {
if (isRunning(Command.CommandType.TEMPBASAL)) { if (!enforceNew && isRunning(Command.CommandType.TEMPBASAL)) {
if (callback != null) if (callback != null)
callback.result(executingNowError()).run(); callback.result(executingNowError()).run();
return false; return false;