diff --git a/app/src/main/java/info/nightscout/androidaps/MainApp.java b/app/src/main/java/info/nightscout/androidaps/MainApp.java index ffe20ca746..070be18119 100644 --- a/app/src/main/java/info/nightscout/androidaps/MainApp.java +++ b/app/src/main/java/info/nightscout/androidaps/MainApp.java @@ -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(); } diff --git a/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java b/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java index f608ab675f..b46faec980 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/activities/TDDStatsActivity.java @@ -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(); diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java index 3d7895a62a..a1a35b7413 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PluginBase.java @@ -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(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java index 1075a9459f..5c7349c7aa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/ActionsFragment.java @@ -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; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java index 283a069199..880bee86a8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/FillDialog.java @@ -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) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java index 06ab8d2982..710874a790 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java @@ -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) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java index 3f14170fc3..95abf173db 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewTempBasalDialog.java @@ -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")); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index cf1604cdce..588ba2ac93 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -47,9 +47,9 @@ public class ConfigBuilderPlugin extends PluginBase { private InsulinInterface activeInsulin; private SensitivityInterface activeSensitivity; - private static ArrayList pluginList; + private ArrayList 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; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java index 1b4d9b2347..832de94e3d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/LoopPlugin.java @@ -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) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java index f8f2b1dff4..1baac9a694 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/BolusProgressDialog.java @@ -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; } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java index 453048a3ec..8545858d4e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java @@ -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) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java index 909ced9542..b1a8bf172a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java @@ -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) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java index 819c46dc7e..e8e360516f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java @@ -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) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 7859fa1c80..9f90e05973 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -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) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java index a37069c71d..e1ae0286de 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java @@ -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(""); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index f6f1de2ad0..3f30071327 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -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); } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java index b0cc64467c..33d371dca3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java @@ -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 { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/Dialogs/ProfileViewDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/Dialogs/ProfileViewDialog.java index a00b8003f1..06906aa0b4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/Dialogs/ProfileViewDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/Dialogs/ProfileViewDialog.java @@ -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(); } }); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/activities/DanaRHistoryActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/activities/DanaRHistoryActivity.java index 6398c41a09..5a3e127b9a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/activities/DanaRHistoryActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/activities/DanaRHistoryActivity.java @@ -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); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgInitConnStatusTime.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgInitConnStatusTime.java index e424c5dbda..2e86016613 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgInitConnStatusTime.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgInitConnStatusTime.java @@ -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 { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java index 20db668159..425e72ea04 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java @@ -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; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/comm/MsgInitConnStatusTime_k.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/comm/MsgInitConnStatusTime_k.java index ac0e856d90..53c3b6a391 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/comm/MsgInitConnStatusTime_k.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/comm/MsgInitConnStatusTime_k.java @@ -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; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java index 456bf2a40e..d419d7c1f1 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java @@ -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; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java index a52926aa1f..cb823a3c88 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java @@ -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 diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgCheckValue_v2.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgCheckValue_v2.java index 8810edb815..09b87e6781 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgCheckValue_v2.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MsgCheckValue_v2.java @@ -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)) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java index 1c1046180c..073cbbde1e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java @@ -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 diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java index 37c1aeb1f0..1d36eea817 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java @@ -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) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java index 568aa4e1ec..90436f5eb2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/CarbsGenerator.java @@ -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) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index a2e7006a25..5245921922 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -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 dummies = new LinkedList(); @@ -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) { diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.java b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.java index f23d7ae34a..a9bf7258e3 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.java @@ -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) diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java index 9d6423772c..cc36f21a59 100644 --- a/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java +++ b/app/src/main/java/info/nightscout/androidaps/receivers/KeepAliveReceiver.java @@ -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()) { diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java index e0f1badbc5..74a8ac83c7 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.java @@ -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() { diff --git a/app/src/test/java/info/AAPSMocker.java b/app/src/test/java/info/AAPSMocker.java index 666097b588..6198b06aea 100644 --- a/app/src/test/java/info/AAPSMocker.java +++ b/app/src/test/java/info/AAPSMocker.java @@ -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() {