Enforce TBRs on enforceNew

This commit is contained in:
AdrianLxM 2018-04-20 18:05:37 +02:00 committed by GitHub
parent 645e83b6e6
commit 69c8eea53b
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;