Show connection, execution time in combo fragment.
(cherry picked from commit 4078c23)
This commit is contained in:
parent
d100509648
commit
1d3411ba56
|
@ -138,7 +138,7 @@ public class RuffyScripter {
|
||||||
private IRTHandler mHandler = new IRTHandler.Stub() {
|
private IRTHandler mHandler = new IRTHandler.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void log(String message) throws RemoteException {
|
public void log(String message) throws RemoteException {
|
||||||
log.debug("Ruffy says: " + message);
|
// log.debug("Ruffy says: " + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -256,6 +256,7 @@ public class RuffyScripter {
|
||||||
|
|
||||||
synchronized (RuffyScripter.class) {
|
synchronized (RuffyScripter.class) {
|
||||||
try {
|
try {
|
||||||
|
long connectStart = System.currentTimeMillis();
|
||||||
activeCmd = cmd;
|
activeCmd = cmd;
|
||||||
ensureConnected();
|
ensureConnected();
|
||||||
final RuffyScripter scripter = this;
|
final RuffyScripter scripter = this;
|
||||||
|
@ -317,6 +318,7 @@ public class RuffyScripter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, cmd.toString());
|
}, cmd.toString());
|
||||||
|
long executionStart = System.currentTimeMillis();
|
||||||
cmdThread.start();
|
cmdThread.start();
|
||||||
|
|
||||||
// time out if nothing has been happening for more than 90s or after 4m
|
// 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) {
|
if (returnable.cmdResult.state == null) {
|
||||||
returnable.cmdResult.state = readPumpState();
|
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);
|
log.debug("Command result: " + returnable.cmdResult);
|
||||||
return returnable.cmdResult;
|
return returnable.cmdResult;
|
||||||
} catch (CommandException e) {
|
} catch (CommandException e) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ public class CommandResult {
|
||||||
public PumpState state;
|
public PumpState state;
|
||||||
public History history;
|
public History history;
|
||||||
public PumpCapabilities capabilities;
|
public PumpCapabilities capabilities;
|
||||||
|
public String duration;
|
||||||
|
|
||||||
public CommandResult() {
|
public CommandResult() {
|
||||||
}
|
}
|
||||||
|
@ -34,6 +35,11 @@ public class CommandResult {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CommandResult duration(String duration) {
|
||||||
|
this.duration = duration;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public CommandResult exception(Exception exception) {
|
public CommandResult exception(Exception exception) {
|
||||||
this.exception = exception;
|
this.exception = exception;
|
||||||
return this;
|
return this;
|
||||||
|
@ -64,7 +70,8 @@ public class CommandResult {
|
||||||
return "CommandResult{" +
|
return "CommandResult{" +
|
||||||
"success=" + success +
|
"success=" + success +
|
||||||
", enacted=" + enacted +
|
", enacted=" + enacted +
|
||||||
", completienTime=" + completionTime + "(" + new Date(completionTime) + ")" +
|
", completionTime=" + completionTime + "(" + new Date(completionTime) + ")" +
|
||||||
|
"' duration=" + duration +
|
||||||
", exception=" + exception +
|
", exception=" + exception +
|
||||||
", message='" + message + '\'' +
|
", message='" + message + '\'' +
|
||||||
", state=" + state +
|
", state=" + state +
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
||||||
private TextView lastCmdText;
|
private TextView lastCmdText;
|
||||||
private TextView lastCmdTimeText;
|
private TextView lastCmdTimeText;
|
||||||
private TextView lastCmdResultText;
|
private TextView lastCmdResultText;
|
||||||
|
private TextView lastCmdDurationText;
|
||||||
|
|
||||||
private TextView tbrCapabilityText;
|
private TextView tbrCapabilityText;
|
||||||
private TextView pumpstateBatteryText;
|
private TextView pumpstateBatteryText;
|
||||||
|
@ -70,6 +71,7 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
||||||
lastCmdText = (TextView) view.findViewById(R.id.combo_last_command);
|
lastCmdText = (TextView) view.findViewById(R.id.combo_last_command);
|
||||||
lastCmdTimeText = (TextView) view.findViewById(R.id.combo_last_command_time);
|
lastCmdTimeText = (TextView) view.findViewById(R.id.combo_last_command_time);
|
||||||
lastCmdResultText = (TextView) view.findViewById(R.id.combo_last_command_result);
|
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);
|
tbrCapabilityText = (TextView) view.findViewById(R.id.combo_tbr_capability);
|
||||||
pumpstateBatteryText = (TextView) view.findViewById(R.id.combo_pumpstate_battery);
|
pumpstateBatteryText = (TextView) view.findViewById(R.id.combo_pumpstate_battery);
|
||||||
insulinstateText = (TextView) view.findViewById(R.id.combo_insulinstate);
|
insulinstateText = (TextView) view.findViewById(R.id.combo_insulinstate);
|
||||||
|
@ -193,8 +195,10 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
||||||
CommandResult lastCmdResult = getPlugin().lastCmdResult;
|
CommandResult lastCmdResult = getPlugin().lastCmdResult;
|
||||||
if (lastCmdResult != null && lastCmdResult.message != null) {
|
if (lastCmdResult != null && lastCmdResult.message != null) {
|
||||||
lastCmdResultText.setText(lastCmdResult.message);
|
lastCmdResultText.setText(lastCmdResult.message);
|
||||||
|
lastCmdDurationText.setText(lastCmdResult.duration);
|
||||||
} else {
|
} else {
|
||||||
lastCmdResultText.setText("");
|
lastCmdResultText.setText("");
|
||||||
|
lastCmdDurationText.setText("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tbrCapabilityText.setText(getPlugin().getPumpDescription().maxTempPercent + "%");
|
tbrCapabilityText.setText(getPlugin().getPumpDescription().maxTempPercent + "%");
|
||||||
|
|
|
@ -373,6 +373,51 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="2dip"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:background="@color/listdelimiter" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:gravity="end"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:text="Command duration"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="5dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:paddingEnd="2dp"
|
||||||
|
android:paddingStart="2dp"
|
||||||
|
android:text=":"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/combo_last_command_duration"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="start"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="2dip"
|
android:layout_height="2dip"
|
||||||
|
|
Loading…
Reference in a new issue