battery and insulinstate
This commit is contained in:
parent
e34009271f
commit
2697ac9420
|
@ -19,6 +19,8 @@ public class PumpState {
|
|||
*/
|
||||
public String errorMsg;
|
||||
public boolean suspended;
|
||||
public boolean lowBattery;
|
||||
public int insulinState;
|
||||
|
||||
public PumpState tbrActive(boolean tbrActive) {
|
||||
this.tbrActive = tbrActive;
|
||||
|
@ -59,6 +61,8 @@ public class PumpState {
|
|||
", tbrRemainingDuration=" + tbrRemainingDuration +
|
||||
", errorMsg=" + errorMsg +
|
||||
", suspended=" + suspended +
|
||||
", lowBattery=" + lowBattery +
|
||||
", insulinState=" + insulinState +
|
||||
", timestamp=" + timestamp +
|
||||
'}';
|
||||
}
|
||||
|
|
|
@ -458,6 +458,8 @@ public class RuffyScripter {
|
|||
state.tbrRemainingDuration = durationMenuTime.getHour() * 60 + durationMenuTime.getMinute();
|
||||
state.tbrRate = ((double) menu.getAttribute(MenuAttribute.BASAL_RATE));
|
||||
}
|
||||
state.lowBattery = ((boolean) menu.getAttribute(MenuAttribute.LOW_BATTERY));
|
||||
state.insulinState = ((int) menu.getAttribute(MenuAttribute.INSULIN_STATE));
|
||||
// TODO v2, read current base basal rate, which is shown center when no TBR is active.
|
||||
// Check if that holds true when an extended bolus is running.
|
||||
// Add a field to PumpStatus, rather than renaming/overloading tbrRate to mean
|
||||
|
@ -466,6 +468,8 @@ public class RuffyScripter {
|
|||
state.errorMsg = (String) menu.getAttribute(MenuAttribute.MESSAGE);
|
||||
} else if (menuType == MenuType.STOP) {
|
||||
state.suspended = true;
|
||||
state.lowBattery = ((boolean) menu.getAttribute(MenuAttribute.LOW_BATTERY));
|
||||
state.insulinState = ((int) menu.getAttribute(MenuAttribute.INSULIN_STATE));
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (MenuAttribute menuAttribute : menu.attributes()) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.PumpCombo;
|
|||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -47,6 +48,9 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
|||
private TextView lastCmdResultText;
|
||||
|
||||
private TextView tbrCapabilityText;
|
||||
private TextView pumpstateBatteryText;
|
||||
private TextView insulinstateText;
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -67,6 +71,8 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
|||
lastCmdTimeText = (TextView) view.findViewById(R.id.combo_last_command_time);
|
||||
lastCmdResultText = (TextView) view.findViewById(R.id.combo_last_command_result);
|
||||
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);
|
||||
|
||||
refresh.setOnClickListener(this);
|
||||
updateCapabilities.setOnClickListener(this);
|
||||
|
@ -114,7 +120,7 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateCapabilities.setText("{fa-bluetooth}");
|
||||
updateCapabilities.setText("{fa-bluetooth spin}");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -172,6 +178,25 @@ public class ComboFragment extends Fragment implements View.OnClickListener {
|
|||
} else {
|
||||
lastCmdResultText.setText("");
|
||||
}
|
||||
if(getPlugin().pumpState.lowBattery){
|
||||
pumpstateBatteryText.setText("{fa-battery-empty}");
|
||||
pumpstateBatteryText.setTextColor(Color.RED);
|
||||
} else {
|
||||
pumpstateBatteryText.setText("{fa-battery-three-quarters}");
|
||||
pumpstateBatteryText.setTextColor(Color.WHITE);
|
||||
}
|
||||
switch (getPlugin().pumpState.insulinState){
|
||||
case 0: insulinstateText.setText("ok");
|
||||
insulinstateText.setTextColor(Color.WHITE);
|
||||
break;
|
||||
case 1: insulinstateText.setText("low");
|
||||
insulinstateText.setTextColor(Color.YELLOW);
|
||||
break;
|
||||
case 2: insulinstateText.setText("empty");
|
||||
insulinstateText.setTextColor(Color.RED);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
tbrCapabilityText.setText(getPlugin().getPumpDescription().maxTempPercent + "%");
|
||||
|
|
|
@ -427,7 +427,96 @@
|
|||
android:text="{fa-bluetooth-b}" />
|
||||
|
||||
</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="Battery"
|
||||
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" />
|
||||
|
||||
<com.joanzapata.iconify.widget.IconTextView
|
||||
android:id="@+id/combo_pumpstate_battery"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="20sp"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="start"
|
||||
android:text=" - " />
|
||||
|
||||
</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="Reservoir"
|
||||
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_insulinstate"
|
||||
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
|
||||
android:layout_width="fill_parent"
|
||||
|
|
Loading…
Reference in a new issue