- added battery display, should be done
This commit is contained in:
parent
09d7ab01fb
commit
ba8c436136
6 changed files with 88 additions and 11 deletions
|
@ -328,5 +328,27 @@ class MedtronicFragment : DaggerFragment() {
|
||||||
|
|
||||||
medtronicPumpPlugin.rileyLinkService?.verifyConfiguration()
|
medtronicPumpPlugin.rileyLinkService?.verifyConfiguration()
|
||||||
binding.errors.text = medtronicPumpStatus.errorInfo
|
binding.errors.text = medtronicPumpStatus.errorInfo
|
||||||
|
|
||||||
|
var showRileyLinkBatteryLevel: Boolean = medtronicPumpStatus.showRileyLinkBatteryLevel
|
||||||
|
|
||||||
|
if (showRileyLinkBatteryLevel) {
|
||||||
|
binding.rlBatteryView.visibility = View.VISIBLE
|
||||||
|
binding.rlBatteryLabel.visibility = View.VISIBLE
|
||||||
|
binding.rlBatteryState.visibility = View.VISIBLE
|
||||||
|
binding.rlBatteryLayout.visibility = View.VISIBLE
|
||||||
|
binding.rlBatterySemicolon.visibility = View.VISIBLE
|
||||||
|
if (rileyLinkServiceData.batteryLevel == null) {
|
||||||
|
binding.rlBatteryState.text = " ?"
|
||||||
|
} else {
|
||||||
|
binding.rlBatteryState.text = "{fa-battery-" + rileyLinkServiceData.batteryLevel / 25 + "} " + rileyLinkServiceData.batteryLevel + "%"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
binding.rlBatteryView.visibility = View.GONE
|
||||||
|
binding.rlBatteryLabel.visibility = View.GONE
|
||||||
|
binding.rlBatteryState.visibility = View.GONE
|
||||||
|
binding.rlBatteryLayout.visibility = View.GONE
|
||||||
|
binding.rlBatterySemicolon.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,19 +14,18 @@ import javax.inject.Singleton;
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.data.RLHistoryItem;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BasalProfileStatus;
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BasalProfileStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType;
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType;
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 4/28/18.
|
* Created by andy on 4/28/18.
|
||||||
*/
|
*/
|
||||||
|
@ -44,6 +43,7 @@ public class MedtronicPumpStatus extends info.nightscout.androidaps.plugins.pump
|
||||||
public String pumpFrequency = null;
|
public String pumpFrequency = null;
|
||||||
public Double maxBolus;
|
public Double maxBolus;
|
||||||
public Double maxBasal;
|
public Double maxBasal;
|
||||||
|
public boolean showRileyLinkBatteryLevel;
|
||||||
|
|
||||||
// statuses
|
// statuses
|
||||||
private PumpDeviceState pumpDeviceState = PumpDeviceState.NeverContacted;
|
private PumpDeviceState pumpDeviceState = PumpDeviceState.NeverContacted;
|
||||||
|
|
|
@ -317,6 +317,8 @@ public class RileyLinkMedtronicService extends RileyLinkService {
|
||||||
//boolean bolusDebug = bolusDebugEnabled != null && bolusDebugEnabled.equals(resourceHelper.gs(R.string.common_on));
|
//boolean bolusDebug = bolusDebugEnabled != null && bolusDebugEnabled.equals(resourceHelper.gs(R.string.common_on));
|
||||||
//MedtronicHistoryData.doubleBolusDebug = bolusDebug;
|
//MedtronicHistoryData.doubleBolusDebug = bolusDebug;
|
||||||
|
|
||||||
|
medtronicPumpStatus.showRileyLinkBatteryLevel = sp.getBoolean(RileyLinkConst.Prefs.ShowBatteryLevel, false);
|
||||||
|
|
||||||
reconfigureService(forceRileyLinkAddressRenewal);
|
reconfigureService(forceRileyLinkAddressRenewal);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -86,6 +86,58 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/rl_battery_view"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="2dip"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:background="@color/list_delimiter" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/rl_battery_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/rl_battery_label"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.5"
|
||||||
|
android:gravity="end"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:text="@string/rl_battery_label"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/rl_battery_semicolon"
|
||||||
|
android:layout_width="5dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:paddingStart="2dp"
|
||||||
|
android:paddingEnd="2dp"
|
||||||
|
android:text=":"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<com.joanzapata.iconify.widget.IconTextView
|
||||||
|
android:id="@+id/rl_battery_state"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="start"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:text=""
|
||||||
|
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"
|
||||||
|
|
|
@ -48,7 +48,8 @@
|
||||||
<string name="medtronic_pump_battery_nimh">NiMH (Extended view)</string>
|
<string name="medtronic_pump_battery_nimh">NiMH (Extended view)</string>
|
||||||
<string name="medtronic_bolus_debugging">Bolus/Treatments Debugging</string>
|
<string name="medtronic_bolus_debugging">Bolus/Treatments Debugging</string>
|
||||||
|
|
||||||
|
<!-- MDT Fragment -->
|
||||||
|
<string name="rl_battery_label">RileyLink Battery</string>
|
||||||
|
|
||||||
<!-- MDT Errors -->
|
<!-- MDT Errors -->
|
||||||
<string name="medtronic_errors">Errors</string>
|
<string name="medtronic_errors">Errors</string>
|
||||||
|
@ -79,8 +80,6 @@
|
||||||
<string name="medtronic_pump_history">Medtronic Pump History</string>
|
<string name="medtronic_pump_history">Medtronic Pump History</string>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <string name="medtronic_cmd_profile_not_set">Remote Basal profile setting is not supported. Please modify Basal profile on your pump manually.</string> -->
|
<!-- <string name="medtronic_cmd_profile_not_set">Remote Basal profile setting is not supported. Please modify Basal profile on your pump manually.</string> -->
|
||||||
<string name="medtronic_cmd_cancel_bolus_not_supported">You cancelled Bolus, after it was already set on Pump. Since Medtronic Pump doesn\'t support cancel, you will need to manually cancel it. Put the Pump into Suspend mode and then do Resume (if you still want to cancel). Application will pick up changes, on next update (in less than 5 minutes).</string>
|
<string name="medtronic_cmd_cancel_bolus_not_supported">You cancelled Bolus, after it was already set on Pump. Since Medtronic Pump doesn\'t support cancel, you will need to manually cancel it. Put the Pump into Suspend mode and then do Resume (if you still want to cancel). Application will pick up changes, on next update (in less than 5 minutes).</string>
|
||||||
<string name="medtronic_cmd_cant_read_tbr">Could not read current TBR.</string>
|
<string name="medtronic_cmd_cant_read_tbr">Could not read current TBR.</string>
|
||||||
|
@ -117,6 +116,7 @@
|
||||||
<string name="set_neutral_temps_title">Set neutral temp basals</string>
|
<string name="set_neutral_temps_title">Set neutral temp basals</string>
|
||||||
<string name="set_neutral_temps_summary">If enabled, it will cancel a temporary basal before the end of each hour. This method can help stop some pumps beeping/vibrating on the hour.</string>
|
<string name="set_neutral_temps_summary">If enabled, it will cancel a temporary basal before the end of each hour. This method can help stop some pumps beeping/vibrating on the hour.</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="sixdigitnumber" translatable="false">^\\d{6}</string>
|
<string name="sixdigitnumber" translatable="false">^\\d{6}</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -37,6 +37,7 @@ public class RileyLinkConst {
|
||||||
public static final String LastGoodDeviceCommunicationTime = Prefix + "lastGoodDeviceCommunicationTime";
|
public static final String LastGoodDeviceCommunicationTime = Prefix + "lastGoodDeviceCommunicationTime";
|
||||||
public static final String LastGoodDeviceFrequency = Prefix + "LastGoodDeviceFrequency";
|
public static final String LastGoodDeviceFrequency = Prefix + "LastGoodDeviceFrequency";
|
||||||
public static final int Encoding = R.string.key_medtronic_encoding;
|
public static final int Encoding = R.string.key_medtronic_encoding;
|
||||||
|
public static final int ShowBatteryLevel = R.string.key_riley_link_show_battery_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class IPC {
|
public static class IPC {
|
||||||
|
|
Loading…
Reference in a new issue