Minor cleanups around the Command queue.
This commit is contained in:
parent
86b63cb27d
commit
b0d55b09d4
|
@ -80,7 +80,7 @@ public class CommandQueue {
|
||||||
return new PumpEnactResult().success(false).enacted(false).comment(MainApp.sResources.getString(R.string.executingrightnow));
|
return new PumpEnactResult().success(false).enacted(false).comment(MainApp.sResources.getString(R.string.executingrightnow));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRunning(Command.CommandType type) {
|
private boolean isRunning(Command.CommandType type) {
|
||||||
if (performing != null && performing.commandType == type)
|
if (performing != null && performing.commandType == type)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -161,10 +161,11 @@ public class CommandQueue {
|
||||||
// Notify Wear about upcoming bolus
|
// Notify Wear about upcoming bolus
|
||||||
MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin));
|
MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin));
|
||||||
|
|
||||||
// Bring up bolus progress dialog
|
// Apply constraints
|
||||||
detailedBolusInfo.insulin = MainApp.getConfigBuilder().applyBolusConstraints(detailedBolusInfo.insulin);
|
detailedBolusInfo.insulin = MainApp.getConfigBuilder().applyBolusConstraints(detailedBolusInfo.insulin);
|
||||||
detailedBolusInfo.carbs = MainApp.getConfigBuilder().applyCarbsConstraints((int) detailedBolusInfo.carbs);
|
detailedBolusInfo.carbs = MainApp.getConfigBuilder().applyCarbsConstraints((int) detailedBolusInfo.carbs);
|
||||||
|
|
||||||
|
// Bring up bolus progress dialog
|
||||||
BolusProgressDialog bolusProgressDialog = null;
|
BolusProgressDialog bolusProgressDialog = null;
|
||||||
if (detailedBolusInfo.context != null) {
|
if (detailedBolusInfo.context != null) {
|
||||||
bolusProgressDialog = new BolusProgressDialog();
|
bolusProgressDialog = new BolusProgressDialog();
|
||||||
|
@ -294,8 +295,8 @@ public class CommandQueue {
|
||||||
Profile.BasalValue[] basalValues = profile.getBasalValues();
|
Profile.BasalValue[] basalValues = profile.getBasalValues();
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
||||||
|
|
||||||
for (int index = 0; index < basalValues.length; index++) {
|
for (Profile.BasalValue basalValue : basalValues) {
|
||||||
if (basalValues[index].value < pump.getPumpDescription().basalMinimumRate) {
|
if (basalValue.value < pump.getPumpDescription().basalMinimumRate) {
|
||||||
Notification notification = new Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, MainApp.sResources.getString(R.string.basalvaluebelowminimum), Notification.URGENT);
|
Notification notification = new Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, MainApp.sResources.getString(R.string.basalvaluebelowminimum), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
if (callback != null)
|
if (callback != null)
|
||||||
|
|
|
@ -26,9 +26,8 @@ import info.nightscout.utils.SP;
|
||||||
public class QueueThread extends Thread {
|
public class QueueThread extends Thread {
|
||||||
private static Logger log = LoggerFactory.getLogger(QueueThread.class);
|
private static Logger log = LoggerFactory.getLogger(QueueThread.class);
|
||||||
|
|
||||||
CommandQueue queue;
|
private CommandQueue queue;
|
||||||
|
|
||||||
private long connectionStartTime = 0;
|
|
||||||
private boolean connectLogged = false;
|
private boolean connectLogged = false;
|
||||||
|
|
||||||
private PowerManager.WakeLock mWakeLock;
|
private PowerManager.WakeLock mWakeLock;
|
||||||
|
@ -45,7 +44,7 @@ public class QueueThread extends Thread {
|
||||||
public final void run() {
|
public final void run() {
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
MainApp.bus().post(new EventQueueChanged());
|
MainApp.bus().post(new EventQueueChanged());
|
||||||
connectionStartTime = System.currentTimeMillis();
|
long connectionStartTime = System.currentTimeMillis();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
Loading…
Reference in a new issue