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) { if (pump != null) {
new Thread(() -> { new Thread(() -> {
SystemClock.sleep(5000); SystemClock.sleep(5000);
ConfigBuilderPlugin.getCommandQueue().readStatus("Initialization", null); ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("Initialization", null);
startKeepAliveService(); startKeepAliveService();
}).start(); }).start();
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -178,7 +178,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
detailedBolusInfo.context = context; detailedBolusInfo.context = context;
detailedBolusInfo.source = Source.USER; detailedBolusInfo.source = Source.USER;
if (!(recordOnlyCheckbox.isChecked() && (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo))) { 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 @Override
public void run() { public void run() {
if (!result.success) { 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); loopPlugin.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
MainApp.bus().post(new EventRefreshOverview("WizardDialog")); 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 @Override
public void run() { public void run() {
if (!result.success) { if (!result.success) {
@ -395,7 +395,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
detailedBolusInfo.source = Source.USER; detailedBolusInfo.source = Source.USER;
detailedBolusInfo.notes = finalNotes; detailedBolusInfo.notes = finalNotes;
if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo) { if (detailedBolusInfo.insulin > 0 || ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().storesCarbInfo) {
ConfigBuilderPlugin.getCommandQueue().bolus(detailedBolusInfo, new Callback() { ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(detailedBolusInfo, new Callback() {
@Override @Override
public void run() { public void run() {
if (!result.success) { if (!result.success) {

View file

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

View file

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

View file

@ -898,7 +898,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
Notification.URGENT); Notification.URGENT);
n.soundId = R.raw.alarm; n.soundId = R.raw.alarm;
MainApp.bus().post(new EventNewNotification(n)); MainApp.bus().post(new EventNewNotification(n));
ConfigBuilderPlugin.getCommandQueue().cancelTempBasal(true, null); ConfigBuilderPlugin.getPlugin().getCommandQueue().cancelTempBasal(true, null);
} }
updateLocalData(commandResult); updateLocalData(commandResult);
} }
@ -1077,7 +1077,7 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
n.soundId = R.raw.alarm; n.soundId = R.raw.alarm;
MainApp.bus().post(new EventNewNotification(n)); MainApp.bus().post(new EventNewNotification(n));
violationWarningRaisedForBolusAt = lowSuspendOnlyLoopEnforcedUntil; 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)) if (L.isEnabled(L.PUMP))
log.debug("Clicked connect to pump"); log.debug("Clicked connect to pump");
DanaRPump.getInstance().lastConnection = 0; DanaRPump.getInstance().lastConnection = 0;
ConfigBuilderPlugin.getCommandQueue().readStatus("Clicked connect to pump", null); ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("Clicked connect to pump", null);
} }
@Subscribe @Subscribe
@ -265,7 +265,7 @@ public class DanaRFragment extends SubscriberFragment {
bolusStepView.setText("" + pump.bolusStep); bolusStepView.setText("" + pump.bolusStep);
serialNumberView.setText("" + pump.serialNumber); serialNumberView.setText("" + pump.serialNumber);
if (queueView != null) { if (queueView != null) {
Spanned status = ConfigBuilderPlugin.getCommandQueue().spannedStatus(); Spanned status = ConfigBuilderPlugin.getPlugin().getCommandQueue().spannedStatus();
if (status.toString().equals("")) { if (status.toString().equals("")) {
queueView.setVisibility(View.GONE); queueView.setVisibility(View.GONE);
} else { } else {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -168,7 +168,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) { if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings))); MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
mSerialIOThread.sendMessage(new MsgSettingBasal()); 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()); MainApp.bus().post(new EventProfileSwitchChange());
} }
} }
@ -294,7 +294,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
SystemClock.sleep(300); SystemClock.sleep(300);
mBolusingTreatment = null; mBolusingTreatment = null;
ConfigBuilderPlugin.getCommandQueue().readStatus("bolusOK", null); ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("bolusOK", null);
} }
return !start.failed; 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) { if (profile != null && Math.abs(danaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings))); MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal 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()); MainApp.bus().post(new EventProfileSwitchChange());
} }
} }
@ -331,7 +331,7 @@ public class DanaRSService extends Service {
SystemClock.sleep(1000); SystemClock.sleep(1000);
} }
// do not call loadEvents() directly, reconnection may be needed // do not call loadEvents() directly, reconnection may be needed
ConfigBuilderPlugin.getCommandQueue().loadEvents(new Callback() { ConfigBuilderPlugin.getPlugin().getCommandQueue().loadEvents(new Callback() {
@Override @Override
public void run() { public void run() {
// reread bolus status // reread bolus status

View file

@ -61,7 +61,7 @@ public class MsgCheckValue_v2 extends MessageBase {
MainApp.getConfigBuilder().storeSettings("ChangingDanaRv2Driver"); MainApp.getConfigBuilder().storeSettings("ChangingDanaRv2Driver");
MainApp.bus().post(new EventRefreshGui()); MainApp.bus().post(new EventRefreshGui());
ConfigBuilderPlugin.getCommandQueue().readStatus("PumpDriverChange", null); // force new connection ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("PumpDriverChange", null); // force new connection
return; return;
} }
@ -84,7 +84,7 @@ public class MsgCheckValue_v2 extends MessageBase {
MainApp.getConfigBuilder().storeSettings("ChangingDanaRv2Driver"); MainApp.getConfigBuilder().storeSettings("ChangingDanaRv2Driver");
MainApp.bus().post(new EventRefreshGui()); MainApp.bus().post(new EventRefreshGui());
ConfigBuilderPlugin.getCommandQueue().readStatus("PumpDriverChange", null); // force new connection ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("PumpDriverChange", null); // force new connection
return; return;
} }
if (L.isEnabled(L.PUMPCOMM)) { 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) { if (profile != null && Math.abs(mDanaRPump.currentBasal - profile.getBasal()) >= pump.getPumpDescription().basalStep) {
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings))); MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
mSerialIOThread.sendMessage(new MsgSettingBasal()); 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()); MainApp.bus().post(new EventProfileSwitchChange());
} }
} }
@ -409,7 +409,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
SystemClock.sleep(1000); SystemClock.sleep(1000);
} }
// do not call loadEvents() directly, reconnection may be needed // do not call loadEvents() directly, reconnection may be needed
ConfigBuilderPlugin.getCommandQueue().loadEvents(new Callback() { ConfigBuilderPlugin.getPlugin().getCommandQueue().loadEvents(new Callback() {
@Override @Override
public void run() { public void run() {
// load last bolus status // load last bolus status

View file

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

View file

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

View file

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

View file

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

View file

@ -75,14 +75,14 @@ public class KeepAliveReceiver extends BroadcastReceiver {
LocalAlertUtils.checkPumpUnreachableAlarm(lastConnection, isStatusOutdated); 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()); MainApp.bus().post(new EventProfileSwitchChange());
} else if (isStatusOutdated && !pump.isBusy()) { } else if (isStatusOutdated && !pump.isBusy()) {
lastReadStatus = System.currentTimeMillis(); lastReadStatus = System.currentTimeMillis();
ConfigBuilderPlugin.getCommandQueue().readStatus("KeepAlive. Status outdated.", null); ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("KeepAlive. Status outdated.", null);
} else if (isBasalOutdated && !pump.isBusy()) { } else if (isBasalOutdated && !pump.isBusy()) {
lastReadStatus = System.currentTimeMillis(); 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()) { 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)) .visibility(() -> ((PluginBase) ConfigBuilderPlugin.getPlugin().getActivePump()).getPreferencesId() > 0))
.add(new SWButton() .add(new SWButton()
.text(R.string.readstatus) .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)) .visibility(() -> ConfigBuilderPlugin.getPlugin().getActivePump() != null))
.add(new SWEventListener(this) .add(new SWEventListener(this)
.listener(new Object() { .listener(new Object() {

View file

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