log invoke() source

This commit is contained in:
Milos Kozak 2017-01-08 00:38:53 +01:00
parent 6621c2f610
commit 66bd06076e
8 changed files with 13 additions and 11 deletions

View file

@ -11,5 +11,5 @@ public interface APSInterface {
public APSResult getLastAPSResult(); public APSResult getLastAPSResult();
public Date getLastAPSRun(); public Date getLastAPSRun();
public void invoke(); public void invoke(String initiator);
} }

View file

@ -76,7 +76,7 @@ public class LoopFragment extends Fragment implements View.OnClickListener, Frag
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.loop_run: case R.id.loop_run:
getPlugin().invoke(true); getPlugin().invoke("Loop button", true);
break; break;
} }

View file

@ -108,15 +108,15 @@ public class LoopPlugin implements PluginBase {
@Subscribe @Subscribe
public void onStatusEvent(final EventTreatmentChange ev) { public void onStatusEvent(final EventTreatmentChange ev) {
invoke(true); invoke("EventTreatmentChange", true);
} }
@Subscribe @Subscribe
public void onStatusEvent(final EventNewBG ev) { public void onStatusEvent(final EventNewBG ev) {
invoke(true); invoke("EventNewBG", true);
} }
public void invoke(boolean allowNotification) { public void invoke(String initiator, boolean allowNotification) {
try { try {
if (Config.logFunctionCalls) if (Config.logFunctionCalls)
log.debug("invoke"); log.debug("invoke");
@ -136,7 +136,7 @@ public class LoopPlugin implements PluginBase {
APSInterface usedAPS = configBuilder.getActiveAPS(); APSInterface usedAPS = configBuilder.getActiveAPS();
if (usedAPS != null && ((PluginBase) usedAPS).isEnabled(PluginBase.APS)) { if (usedAPS != null && ((PluginBase) usedAPS).isEnabled(PluginBase.APS)) {
usedAPS.invoke(); usedAPS.invoke(initiator);
result = usedAPS.getLastAPSResult(); result = usedAPS.getLastAPSResult();
} }

View file

@ -73,7 +73,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.openapsma_run: case R.id.openapsma_run:
getPlugin().invoke(); getPlugin().invoke("OpenAPSAMA button");
break; break;
} }

View file

@ -99,7 +99,8 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
} }
@Override @Override
public void invoke() { public void invoke(String initiator) {
log.debug("invoke from " + initiator);
lastAPSResult = null; lastAPSResult = null;
DetermineBasalAdapterAMAJS determineBasalAdapterAMAJS = null; DetermineBasalAdapterAMAJS determineBasalAdapterAMAJS = null;
try { try {

View file

@ -67,7 +67,7 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener,
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { switch (view.getId()) {
case R.id.openapsma_run: case R.id.openapsma_run:
getPlugin().invoke(); getPlugin().invoke("OpenAPSMA button");
break; break;
} }

View file

@ -97,7 +97,8 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
} }
@Override @Override
public void invoke() { public void invoke(String initiator) {
log.debug("invoke from " + initiator);
lastAPSResult = null; lastAPSResult = null;
DetermineBasalAdapterMAJS determineBasalAdapterMAJS = null; DetermineBasalAdapterMAJS determineBasalAdapterMAJS = null;
try { try {

View file

@ -214,7 +214,7 @@ public class OverviewFragment extends Fragment {
acceptTempButton.setOnClickListener(new View.OnClickListener() { acceptTempButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
MainApp.getConfigBuilder().getActiveLoop().invoke(false); MainApp.getConfigBuilder().getActiveLoop().invoke("Accept temp button", false);
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun; final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
if (finalLastRun != null && finalLastRun.lastAPSRun != null && finalLastRun.constraintsProcessed.changeRequested) { if (finalLastRun != null && finalLastRun.lastAPSRun != null && finalLastRun.constraintsProcessed.changeRequested) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); AlertDialog.Builder builder = new AlertDialog.Builder(getContext());