remove static ConfigBuilderPlugin.commandQueue

This commit is contained in:
Milos Kozak 2018-09-17 19:29:01 +02:00
parent f6c113550f
commit 924bc97e3b
33 changed files with 62 additions and 62 deletions

View file

@ -200,7 +200,7 @@ public class MainApp extends Application {
if (pump != null) {
new Thread(() -> {
SystemClock.sleep(5000);
ConfigBuilderPlugin.getCommandQueue().readStatus("Initialization", null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("Initialization", null);
startKeepAliveService();
}).start();
}

View file

@ -239,7 +239,7 @@ public class TDDStatsActivity extends Activity {
statsMessage.setText(MainApp.gs(R.string.danar_stats_warning_Message));
}
});
ConfigBuilderPlugin.getCommandQueue().loadTDDs( new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().loadTDDs( new Callback() {
@Override
public void run() {
loadDataFromDB();

View file

@ -169,7 +169,7 @@ public abstract class PluginBase {
if (getType() == PluginType.PUMP) {
new Thread(() -> {
SystemClock.sleep(3000);
CommandQueue commandQueue = ConfigBuilderPlugin.getCommandQueue();
CommandQueue commandQueue = ConfigBuilderPlugin.getPlugin().getCommandQueue();
if (commandQueue != null)
commandQueue.readStatus("Pump driver changed.", null);
}).start();

View file

@ -223,13 +223,13 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
break;
case R.id.actions_extendedbolus_cancel:
if (TreatmentsPlugin.getPlugin().isInHistoryExtendedBoluslInProgress()) {
ConfigBuilderPlugin.getCommandQueue().cancelExtended(null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelExtended(null);
FabricPrivacy.getInstance().logCustom(new CustomEvent("CancelExtended"));
}
break;
case R.id.actions_canceltempbasal:
if (TreatmentsPlugin.getPlugin().isTempBasalInProgress()) {
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null);
FabricPrivacy.getInstance().logCustom(new CustomEvent("CancelTemp"));
}
break;

View file

@ -223,7 +223,7 @@ public class FillDialog extends DialogFragment implements OnClickListener {
detailedBolusInfo.source = Source.USER;
detailedBolusInfo.isValid = false; // do not count it in IOB (for pump history)
detailedBolusInfo.notes = notes;
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
if (!result.success) {

View file

@ -87,7 +87,7 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
builder.setMessage(confirmMessage);
builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
ConfigBuilderPlugin.getCommandQueue().extendedBolus(finalInsulin, finalDurationInMinutes, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().extendedBolus(finalInsulin, finalDurationInMinutes, new Callback() {
@Override
public void run() {
if (!result.success) {

View file

@ -163,9 +163,9 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
}
};
if (setAsPercent) {
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(finalBasalPercent, finalDurationInMinutes, true, profile, callback);
ConfigBuilderPlugin.getPlugin().getCommandQueue().tempBasalPercent(finalBasalPercent, finalDurationInMinutes, true, profile, callback);
} else {
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, profile, callback);
ConfigBuilderPlugin.getPlugin().getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, profile, callback);
}
FabricPrivacy.getInstance().logCustom(new CustomEvent("TempBasal"));
}

View file

@ -47,9 +47,9 @@ public class ConfigBuilderPlugin extends PluginBase {
private InsulinInterface activeInsulin;
private SensitivityInterface activeSensitivity;
private static ArrayList<PluginBase> pluginList;
private ArrayList<PluginBase> pluginList;
private static CommandQueue commandQueue = new CommandQueue();
private CommandQueue commandQueue = new CommandQueue();
public ConfigBuilderPlugin() {
super(new PluginDescription()
@ -228,7 +228,7 @@ public class ConfigBuilderPlugin extends PluginBase {
}
}
public static CommandQueue getCommandQueue() {
public CommandQueue getCommandQueue() {
return commandQueue;
}

View file

@ -358,8 +358,8 @@ public class LoopPlugin extends PluginBase {
if (closedLoopEnabled.value()) {
if (resultAfterConstraints.isChangeRequested()
&& !ConfigBuilderPlugin.getCommandQueue().bolusInQueue()
&& !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BOLUS)) {
&& !ConfigBuilderPlugin.getPlugin().getCommandQueue().bolusInQueue()
&& !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BOLUS)) {
final PumpEnactResult waiting = new PumpEnactResult();
waiting.queued = true;
if (resultAfterConstraints.tempBasalRequested)

View file

@ -73,7 +73,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
super.onResume();
if (L.isEnabled(L.UI))
log.debug("onResume");
if (!ConfigBuilderPlugin.getCommandQueue().bolusInQueue()) {
if (!ConfigBuilderPlugin.getPlugin().getCommandQueue().bolusInQueue()) {
bolusEnded = true;
}
if (bolusEnded) {
@ -123,7 +123,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
stopPressed = true;
stopPressedView.setVisibility(View.VISIBLE);
stopButton.setVisibility(View.INVISIBLE);
ConfigBuilderPlugin.getCommandQueue().cancelAllBoluses();
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelAllBoluses();
break;
}
}

View file

@ -293,7 +293,7 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, false);
} else {
detailedBolusInfo.date = now();
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
if (!result.success) {

View file

@ -178,7 +178,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
detailedBolusInfo.context = context;
detailedBolusInfo.source = Source.USER;
if (!(recordOnlyCheckbox.isChecked() && (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo))) {
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
if (!result.success) {

View file

@ -369,7 +369,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
loopPlugin.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
MainApp.bus().post(new EventRefreshOverview("WizardDialog"));
}
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 120, true, profile, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().tempBasalPercent(0, 120, true, profile, new Callback() {
@Override
public void run() {
if (!result.success) {
@ -395,7 +395,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
detailedBolusInfo.source = Source.USER;
detailedBolusInfo.notes = finalNotes;
if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo) {
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
if (!result.success) {

View file

@ -499,7 +499,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
loopPlugin.setFragmentVisible(PluginType.LOOP, false);
MainApp.getConfigBuilder().storeSettings("DisablingLoop");
updateGUI("suspendmenu");
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() {
@Override
public void run() {
if (!result.success) {
@ -519,7 +519,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
} else if (item.getTitle().equals(MainApp.gs(R.string.resume))) {
loopPlugin.suspendTo(0L);
updateGUI("suspendmenu");
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() {
@Override
public void run() {
if (!result.success) {
@ -682,7 +682,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
break;
case R.id.overview_pumpstatus:
if (ConfigBuilderPlugin.getPlugin().getActivePump().isSuspended() || !ConfigBuilderPlugin.getPlugin().getActivePump().isInitialized())
ConfigBuilderPlugin.getCommandQueue().readStatus("RefreshClicked", null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("RefreshClicked", null);
break;
}
@ -815,7 +815,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
loopPlugin.superBolusTo(System.currentTimeMillis() + T.hours(2).msecs());
MainApp.bus().post(new EventRefreshOverview("WizardDialog"));
}
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 120, true, profile, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().tempBasalPercent(0, 120, true, profile, new Callback() {
@Override
public void run() {
if (!result.success) {
@ -837,7 +837,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
detailedBolusInfo.boluscalc = boluscalcJSON;
detailedBolusInfo.source = Source.USER;
if (finalInsulinAfterConstraints > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo) {
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
if (!result.success) {

View file

@ -77,7 +77,7 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
switch (view.getId()) {
case R.id.combo_refresh_button:
refreshButton.setEnabled(false);
ConfigBuilderPlugin.getCommandQueue().readStatus("User request", new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("User request", new Callback() {
@Override
public void run() {
runOnUiThread(() -> refreshButton.setEnabled(true));
@ -124,7 +124,7 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
activityView.setTextColor(Color.WHITE);
activityView.setTextSize(14);
activityView.setText(activity);
} else if (ConfigBuilderPlugin.getCommandQueue().size() > 0) {
} else if (ConfigBuilderPlugin.getPlugin().getCommandQueue().size() > 0) {
activityView.setTextColor(Color.WHITE);
activityView.setTextSize(14);
activityView.setText("");

View file

@ -898,7 +898,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
Notification.URGENT);
n.soundId = R.raw.alarm;
MainApp.bus().post(new EventNewNotification(n));
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null);
}
updateLocalData(commandResult);
}
@ -1077,7 +1077,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
n.soundId = R.raw.alarm;
MainApp.bus().post(new EventNewNotification(n));
violationWarningRaisedForBolusAt = lowSuspendOnlyLoopEnforcedUntil;
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null);
}
}
}

View file

@ -148,7 +148,7 @@ public class DanaRFragment extends SubscriberFragment {
if (L.isEnabled(L.PUMP))
log.debug("Clicked connect to pump");
DanaRPump.getInstance().lastConnection = 0;
ConfigBuilderPlugin.getCommandQueue().readStatus("Clicked connect to pump", null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("Clicked connect to pump", null);
}
@Subscribe
@ -265,7 +265,7 @@ public class DanaRFragment extends SubscriberFragment {
bolusStepView.setText("" + pump.bolusStep);
serialNumberView.setText("" + pump.serialNumber);
if (queueView != null) {
Spanned status = ConfigBuilderPlugin.getCommandQueue().spannedStatus();
Spanned status = ConfigBuilderPlugin.getPlugin().getCommandQueue().spannedStatus();
if (status.toString().equals("")) {
queueView.setVisibility(View.GONE);
} else {

View file

@ -55,7 +55,7 @@ public class ProfileViewDialog extends DialogFragment {
refreshButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ConfigBuilderPlugin.getCommandQueue().readStatus("ProfileViewDialog", null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("ProfileViewDialog", null);
dismiss();
}
});

View file

@ -148,7 +148,7 @@ public class DanaRHistoryActivity extends Activity {
statusView.setVisibility(View.VISIBLE);
});
clearCardView();
ConfigBuilderPlugin.getCommandQueue().loadHistory(selected.type, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().loadHistory(selected.type, new Callback() {
@Override
public void run() {
loadDataFromDB(selected.type);

View file

@ -49,7 +49,7 @@ public class MsgInitConnStatusTime extends MessageBase {
MainApp.getConfigBuilder().storeSettings("ChangingDanaDriver");
MainApp.bus().post(new EventRefreshGui());
ConfigBuilderPlugin.getCommandQueue().readStatus("PumpDriverChange", null); // force new connection
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("PumpDriverChange", null); // force new connection
failed = false;
return;
} else {

View file

@ -164,7 +164,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
mSerialIOThread.sendMessage(new MsgSettingBasal());
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
MainApp.bus().post(new EventProfileSwitchChange());
}
}
@ -332,7 +332,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
final Object o = new Object();
synchronized (o) {
ConfigBuilderPlugin.getCommandQueue().independentConnect("bolusingInterrupted", new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().independentConnect("bolusingInterrupted", new Callback() {
@Override
public void run() {
if (mDanaRPump.lastBolusTime > System.currentTimeMillis() - 60 * 1000L) { // last bolus max 1 min old
@ -355,7 +355,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
}
}
} else {
ConfigBuilderPlugin.getCommandQueue().readStatus("bolusOK", null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("bolusOK", null);
}
}
return !start.failed;

View file

@ -49,7 +49,7 @@ public class MsgInitConnStatusTime_k extends MessageBase {
MainApp.getConfigBuilder().storeSettings("ChangingKoreanDanaDriver");
MainApp.bus().post(new EventRefreshGui());
ConfigBuilderPlugin.getCommandQueue().readStatus("PumpDriverChange", null); // force new connection
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("PumpDriverChange", null); // force new connection
return;
}

View file

@ -168,7 +168,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
mSerialIOThread.sendMessage(new MsgSettingBasal());
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
MainApp.bus().post(new EventProfileSwitchChange());
}
}
@ -294,7 +294,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
SystemClock.sleep(300);
mBolusingTreatment = null;
ConfigBuilderPlugin.getCommandQueue().readStatus("bolusOK", null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("bolusOK", null);
}
return !start.failed;

View file

@ -148,7 +148,7 @@ public class DanaRSService extends Service {
if (profile != null && Math.abs(danaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
MainApp.bus().post(new EventProfileSwitchChange());
}
}
@ -331,7 +331,7 @@ public class DanaRSService extends Service {
SystemClock.sleep(1000);
}
// do not call loadEvents() directly, reconnection may be needed
ConfigBuilderPlugin.getCommandQueue().loadEvents(new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().loadEvents(new Callback() {
@Override
public void run() {
// reread bolus status

View file

@ -61,7 +61,7 @@ public class MsgCheckValue_v2 extends MessageBase {
MainApp.getConfigBuilder().storeSettings("ChangingDanaRv2Driver");
MainApp.bus().post(new EventRefreshGui());
ConfigBuilderPlugin.getCommandQueue().readStatus("PumpDriverChange", null); // force new connection
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("PumpDriverChange", null); // force new connection
return;
}
@ -84,7 +84,7 @@ public class MsgCheckValue_v2 extends MessageBase {
MainApp.getConfigBuilder().storeSettings("ChangingDanaRv2Driver");
MainApp.bus().post(new EventRefreshGui());
ConfigBuilderPlugin.getCommandQueue().readStatus("PumpDriverChange", null); // force new connection
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("PumpDriverChange", null); // force new connection
return;
}
if (L.isEnabled(L.PUMPCOMM)) {

View file

@ -186,7 +186,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
mSerialIOThread.sendMessage(new MsgSettingBasal());
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
MainApp.bus().post(new EventProfileSwitchChange());
}
}
@ -409,7 +409,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
SystemClock.sleep(1000);
}
// do not call loadEvents() directly, reconnection may be needed
ConfigBuilderPlugin.getCommandQueue().loadEvents(new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().loadEvents(new Callback() {
@Override
public void run() {
// load last bolus status

View file

@ -242,7 +242,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
LoopPlugin loopPlugin = MainApp.getSpecificPlugin(LoopPlugin.class);
if (loopPlugin != null && loopPlugin.isEnabled(PluginType.LOOP)) {
loopPlugin.setPluginEnabled(PluginType.LOOP, false);
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() {
@Override
public void run() {
MainApp.bus().post(new EventRefreshOverview("SMS_LOOP_STOP"));
@ -345,7 +345,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
break;
case "PUMP":
case "DANAR":
ConfigBuilderPlugin.getCommandQueue().readStatus("SMS", new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("SMS", new Callback() {
@Override
public void run() {
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
@ -449,7 +449,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.insulin = bolusWaitingForConfirmation.bolusRequested;
detailedBolusInfo.source = Source.USER;
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
@ -474,7 +474,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
tempBasalWaitingForConfirmation.processed = true;
Profile profile = ProfileFunctions.getInstance().getProfile();
if (profile != null)
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(tempBasalWaitingForConfirmation.tempBasal, 30, true, profile, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().tempBasalAbsolute(tempBasalWaitingForConfirmation.tempBasal, 30, true, profile, new Callback() {
@Override
public void run() {
if (result.success) {
@ -491,7 +491,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
} else if (cancelTempBasalWaitingForConfirmation != null && !cancelTempBasalWaitingForConfirmation.processed &&
cancelTempBasalWaitingForConfirmation.confirmCode.equals(splited[0]) && System.currentTimeMillis() - cancelTempBasalWaitingForConfirmation.date < Constants.SMS_CONFIRM_TIMEOUT) {
cancelTempBasalWaitingForConfirmation.processed = true;
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() {
@Override
public void run() {
if (result.success) {
@ -519,7 +519,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
} else if (suspendWaitingForConfirmation != null && !suspendWaitingForConfirmation.processed &&
suspendWaitingForConfirmation.confirmCode.equals(splited[0]) && System.currentTimeMillis() - suspendWaitingForConfirmation.date < Constants.SMS_CONFIRM_TIMEOUT) {
suspendWaitingForConfirmation.processed = true;
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, new Callback() {
@Override
public void run() {
if (result.success) {

View file

@ -36,7 +36,7 @@ public class CarbsGenerator {
carbInfo.source = Source.USER;
carbInfo.notes = notes;
if (ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo && carbInfo.date <= now()) {
ConfigBuilderPlugin.getCommandQueue().bolus(carbInfo, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(carbInfo, new Callback() {
@Override
public void run() {
if (!result.success) {

View file

@ -313,7 +313,7 @@ public class ActionStringHandler {
} else {
rMessage += "trying to fetch data from pump.";
ConfigBuilderPlugin.getCommandQueue().loadTDDs(new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().loadTDDs(new Callback() {
@Override
public void run() {
List<TDD> dummies = new LinkedList<TDD>();
@ -715,7 +715,7 @@ public class ActionStringHandler {
detailedBolusInfo.insulin = amount;
detailedBolusInfo.isValid = false;
detailedBolusInfo.source = Source.USER;
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
if (!result.success) {
@ -733,7 +733,7 @@ public class ActionStringHandler {
detailedBolusInfo.carbs = carbs;
detailedBolusInfo.source = Source.USER;
if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo) {
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() {
ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override
public void run() {
if (!result.success) {

View file

@ -33,7 +33,7 @@ public class CommandSetProfile extends Command {
@Override
public void execute() {
if (ConfigBuilderPlugin.getCommandQueue().isThisProfileSet(profile)) {
if (ConfigBuilderPlugin.getPlugin().getCommandQueue().isThisProfileSet(profile)) {
if (L.isEnabled(L.PUMPQUEUE))
log.debug("Correct profile already set. profile: " + profile.toString());
if (callback != null)

View file

@ -75,14 +75,14 @@ public class KeepAliveReceiver extends BroadcastReceiver {
LocalAlertUtils.checkPumpUnreachableAlarm(lastConnection, isStatusOutdated);
}
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
if (!pump.isThisProfileSet(profile) && !ConfigBuilderPlugin.getPlugin().getCommandQueue().isRunning(Command.CommandType.BASALPROFILE)) {
MainApp.bus().post(new EventProfileSwitchChange());
} else if (isStatusOutdated && !pump.isBusy()) {
lastReadStatus = System.currentTimeMillis();
ConfigBuilderPlugin.getCommandQueue().readStatus("KeepAlive. Status outdated.", null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("KeepAlive. Status outdated.", null);
} else if (isBasalOutdated && !pump.isBusy()) {
lastReadStatus = System.currentTimeMillis();
ConfigBuilderPlugin.getCommandQueue().readStatus("KeepAlive. Basal outdated.", null);
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("KeepAlive. Basal outdated.", null);
}
}
if (lastRun != 0 && System.currentTimeMillis() - lastRun > T.mins(10).msecs()) {

View file

@ -327,7 +327,7 @@ public class SWDefinition {
.visibility(() -> ((PluginBase) ConfigBuilderPlugin.getPlugin().getActivePump()).getPreferencesId() > 0))
.add(new SWButton()
.text(R.string.readstatus)
.action(() -> ConfigBuilderPlugin.getCommandQueue().readStatus("Clicked connect to pump", null))
.action(() -> ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("Clicked connect to pump", null))
.visibility(() -> ConfigBuilderPlugin.getPlugin().getActivePump() != null))
.add(new SWEventListener(this)
.listener(new Object() {

View file

@ -159,7 +159,7 @@ public class AAPSMocker {
public static void mockCommandQueue() {
CommandQueue queue = mock(CommandQueue.class);
when(ConfigBuilderPlugin.getCommandQueue()).thenReturn(queue);
when(ConfigBuilderPlugin.getPlugin().getCommandQueue()).thenReturn(queue);
}
public static TreatmentsPlugin mockTreatmentPlugin() {