diff --git a/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java b/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java
index f8757b0184..3f8a99f665 100644
--- a/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java
+++ b/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java
@@ -138,7 +138,7 @@ public class RuffyScripter {
private IRTHandler mHandler = new IRTHandler.Stub() {
@Override
public void log(String message) throws RemoteException {
- log.debug("Ruffy says: " + message);
+// log.debug("Ruffy says: " + message);
}
@Override
@@ -256,6 +256,7 @@ public class RuffyScripter {
synchronized (RuffyScripter.class) {
try {
+ long connectStart = System.currentTimeMillis();
activeCmd = cmd;
ensureConnected();
final RuffyScripter scripter = this;
@@ -317,6 +318,7 @@ public class RuffyScripter {
}
}
}, cmd.toString());
+ long executionStart = System.currentTimeMillis();
cmdThread.start();
// time out if nothing has been happening for more than 90s or after 4m
@@ -351,6 +353,10 @@ public class RuffyScripter {
if (returnable.cmdResult.state == null) {
returnable.cmdResult.state = readPumpState();
}
+ long connectDurationSec = (executionStart - connectStart) / 1000;
+ long now = System.currentTimeMillis();
+ long executionDurationSec = (now - executionStart) / 1000;
+ returnable.cmdResult.duration = "Connect: " + connectDurationSec + "s, execution: " + executionDurationSec + "s";
log.debug("Command result: " + returnable.cmdResult);
return returnable.cmdResult;
} catch (CommandException e) {
diff --git a/app/src/main/java/de/jotomo/ruffyscripter/commands/CommandResult.java b/app/src/main/java/de/jotomo/ruffyscripter/commands/CommandResult.java
index 296f61f056..ec9c444a97 100644
--- a/app/src/main/java/de/jotomo/ruffyscripter/commands/CommandResult.java
+++ b/app/src/main/java/de/jotomo/ruffyscripter/commands/CommandResult.java
@@ -15,6 +15,7 @@ public class CommandResult {
public PumpState state;
public History history;
public PumpCapabilities capabilities;
+ public String duration;
public CommandResult() {
}
@@ -34,6 +35,11 @@ public class CommandResult {
return this;
}
+ public CommandResult duration(String duration) {
+ this.duration = duration;
+ return this;
+ }
+
public CommandResult exception(Exception exception) {
this.exception = exception;
return this;
@@ -64,7 +70,8 @@ public class CommandResult {
return "CommandResult{" +
"success=" + success +
", enacted=" + enacted +
- ", completienTime=" + completionTime + "(" + new Date(completionTime) + ")" +
+ ", completionTime=" + completionTime + "(" + new Date(completionTime) + ")" +
+ "' duration=" + duration +
", exception=" + exception +
", message='" + message + '\'' +
", state=" + state +
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 403bbaf6e2..2ae111ab6b 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
@@ -46,6 +46,7 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
private TextView lastCmdText;
private TextView lastCmdTimeText;
private TextView lastCmdResultText;
+ private TextView lastCmdDurationText;
private TextView tbrCapabilityText;
private TextView pumpstateBatteryText;
@@ -70,6 +71,7 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
lastCmdText = (TextView) view.findViewById(R.id.combo_last_command);
lastCmdTimeText = (TextView) view.findViewById(R.id.combo_last_command_time);
lastCmdResultText = (TextView) view.findViewById(R.id.combo_last_command_result);
+ lastCmdDurationText = (TextView) view.findViewById(R.id.combo_last_command_duration);
tbrCapabilityText = (TextView) view.findViewById(R.id.combo_tbr_capability);
pumpstateBatteryText = (TextView) view.findViewById(R.id.combo_pumpstate_battery);
insulinstateText = (TextView) view.findViewById(R.id.combo_insulinstate);
@@ -193,8 +195,10 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
CommandResult lastCmdResult = getPlugin().lastCmdResult;
if (lastCmdResult != null && lastCmdResult.message != null) {
lastCmdResultText.setText(lastCmdResult.message);
+ lastCmdDurationText.setText(lastCmdResult.duration);
} else {
lastCmdResultText.setText("");
+ lastCmdDurationText.setText("");
}
}
tbrCapabilityText.setText(getPlugin().getPumpDescription().maxTempPercent + "%");
diff --git a/app/src/main/res/layout/combopump_fragment.xml b/app/src/main/res/layout/combopump_fragment.xml
index 0ac36b1a42..a4270240ef 100644
--- a/app/src/main/res/layout/combopump_fragment.xml
+++ b/app/src/main/res/layout/combopump_fragment.xml
@@ -373,6 +373,51 @@
+
+
+
+
+
+
+
+
+
+
+
+