log script debug in fragment
This commit is contained in:
parent
28c329dc01
commit
6621c2f610
4 changed files with 28 additions and 1 deletions
|
@ -51,6 +51,8 @@ public class DetermineBasalAdapterAMAJS {
|
||||||
private String storedMeal_data = null;
|
private String storedMeal_data = null;
|
||||||
private String storedAutosens_data = null;
|
private String storedAutosens_data = null;
|
||||||
|
|
||||||
|
private String scriptDebug = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main code
|
* Main code
|
||||||
*/
|
*/
|
||||||
|
@ -183,6 +185,10 @@ public class DetermineBasalAdapterAMAJS {
|
||||||
return storedAutosens_data;
|
return storedAutosens_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getScriptDebug() {
|
||||||
|
return scriptDebug;
|
||||||
|
}
|
||||||
|
|
||||||
private void loadScript() throws IOException {
|
private void loadScript() throws IOException {
|
||||||
mV8rt.executeVoidScript(readFile("OpenAPSAMA/round-basal.js"), "OpenAPSAMA/round-basal.js", 0);
|
mV8rt.executeVoidScript(readFile("OpenAPSAMA/round-basal.js"), "OpenAPSAMA/round-basal.js", 0);
|
||||||
mV8rt.executeVoidScript("var round_basal = module.exports;");
|
mV8rt.executeVoidScript("var round_basal = module.exports;");
|
||||||
|
@ -236,8 +242,10 @@ public class DetermineBasalAdapterAMAJS {
|
||||||
s += arg + " ";
|
s += arg + " ";
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (!s.equals("") && Config.logAPSResult)
|
if (!s.equals("") && Config.logAPSResult) {
|
||||||
log.debug("Script debug: " + s);
|
log.debug("Script debug: " + s);
|
||||||
|
scriptDebug += s + "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mV8rt.registerJavaMethod(callbackLog, "log");
|
mV8rt.registerJavaMethod(callbackLog, "log");
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
|
||||||
TextView mealDataView;
|
TextView mealDataView;
|
||||||
TextView autosensDataView;
|
TextView autosensDataView;
|
||||||
TextView resultView;
|
TextView resultView;
|
||||||
|
TextView scriptdebugView;
|
||||||
TextView requestView;
|
TextView requestView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -60,6 +61,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
|
||||||
profileView = (TextView) view.findViewById(R.id.openapsma_profile);
|
profileView = (TextView) view.findViewById(R.id.openapsma_profile);
|
||||||
mealDataView = (TextView) view.findViewById(R.id.openapsma_mealdata);
|
mealDataView = (TextView) view.findViewById(R.id.openapsma_mealdata);
|
||||||
autosensDataView = (TextView) view.findViewById(R.id.openapsma_autosensdata);
|
autosensDataView = (TextView) view.findViewById(R.id.openapsma_autosensdata);
|
||||||
|
scriptdebugView = (TextView) view.findViewById(R.id.openapsma_scriptdebugdata);
|
||||||
resultView = (TextView) view.findViewById(R.id.openapsma_result);
|
resultView = (TextView) view.findViewById(R.id.openapsma_result);
|
||||||
requestView = (TextView) view.findViewById(R.id.openapsma_request);
|
requestView = (TextView) view.findViewById(R.id.openapsma_request);
|
||||||
|
|
||||||
|
@ -124,6 +126,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
|
||||||
profileView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getProfileParam()));
|
profileView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getProfileParam()));
|
||||||
mealDataView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getMealDataParam()));
|
mealDataView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getMealDataParam()));
|
||||||
autosensDataView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getAutosensDataParam()));
|
autosensDataView.setText(JSONFormatter.format(determineBasalAdapterAMAJS.getAutosensDataParam()));
|
||||||
|
scriptdebugView.setText(determineBasalAdapterAMAJS.getScriptDebug());
|
||||||
}
|
}
|
||||||
if (getPlugin().lastAPSRun != null) {
|
if (getPlugin().lastAPSRun != null) {
|
||||||
lastRunView.setText(getPlugin().lastAPSRun.toLocaleString());
|
lastRunView.setText(getPlugin().lastAPSRun.toLocaleString());
|
||||||
|
@ -145,6 +148,7 @@ public class OpenAPSAMAFragment extends Fragment implements View.OnClickListener
|
||||||
profileView.setText("");
|
profileView.setText("");
|
||||||
mealDataView.setText("");
|
mealDataView.setText("");
|
||||||
autosensDataView.setText("");
|
autosensDataView.setText("");
|
||||||
|
scriptdebugView.setText("");
|
||||||
requestView.setText("");
|
requestView.setText("");
|
||||||
lastRunView.setText("");
|
lastRunView.setText("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,20 @@
|
||||||
android:background="@color/linearBlockBackground"
|
android:background="@color/linearBlockBackground"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/openapsma_scriptdebugdata_label"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:layout_marginLeft="5dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/openapsma_scriptdebugdata"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -402,4 +402,5 @@
|
||||||
<string name="long_avgdelta">Long avg. delta</string>
|
<string name="long_avgdelta">Long avg. delta</string>
|
||||||
<string name="array_of_elements">Array of %d elements.\nActual value:</string>
|
<string name="array_of_elements">Array of %d elements.\nActual value:</string>
|
||||||
<string name="openapsma_autosensdata_label">Autosens data</string>
|
<string name="openapsma_autosensdata_label">Autosens data</string>
|
||||||
|
<string name="openapsma_scriptdebugdata_label">Script debug</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue