Merge pull request #1328 from Andries-Smit/feat/show-hide-battery-status-light

Feature: show/hide battery status light
This commit is contained in:
Milos Kozak 2022-03-13 10:39:25 +01:00 committed by GitHub
commit d5aece1ed8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 58 additions and 290 deletions

View file

@ -8,6 +8,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TableRow
import android.widget.TextView import android.widget.TextView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import dagger.android.support.DaggerFragment import dagger.android.support.DaggerFragment
@ -108,6 +109,7 @@ class ActionsFragment : DaggerFragment() {
private var insulinLevelLabel: TextView? = null private var insulinLevelLabel: TextView? = null
private var pbLevelLabel: TextView? = null private var pbLevelLabel: TextView? = null
private var cannulaOrPatch: TextView? = null private var cannulaOrPatch: TextView? = null
private var batteryLayout: TableRow? = null
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, inflater: LayoutInflater, container: ViewGroup?,
@ -143,7 +145,6 @@ class ActionsFragment : DaggerFragment() {
historyBrowser = view.findViewById(R.id.actions_historybrowser) historyBrowser = view.findViewById(R.id.actions_historybrowser)
tddStats = view.findViewById(R.id.actions_tddstats) tddStats = view.findViewById(R.id.actions_tddstats)
pumpBatteryChange = view.findViewById(R.id.actions_pumpbatterychange) pumpBatteryChange = view.findViewById(R.id.actions_pumpbatterychange)
cannulaAge = view.findViewById(R.id.cannula_age) cannulaAge = view.findViewById(R.id.cannula_age)
insulinAge = view.findViewById(R.id.insulin_age) insulinAge = view.findViewById(R.id.insulin_age)
reservoirLevel = view.findViewById(R.id.reservoir_level) reservoirLevel = view.findViewById(R.id.reservoir_level)
@ -155,6 +156,7 @@ class ActionsFragment : DaggerFragment() {
insulinLevelLabel = view.findViewById(R.id.insulin_level_label) insulinLevelLabel = view.findViewById(R.id.insulin_level_label)
pbLevelLabel = view.findViewById(R.id.pb_level_label) pbLevelLabel = view.findViewById(R.id.pb_level_label)
cannulaOrPatch = view.findViewById(R.id.cannula_or_patch) cannulaOrPatch = view.findViewById(R.id.cannula_or_patch)
batteryLayout = view.findViewById(R.id.battery_layout)
profileSwitch?.setOnClickListener { profileSwitch?.setOnClickListener {
activity?.let { activity -> activity?.let { activity ->
@ -327,18 +329,14 @@ class ActionsFragment : DaggerFragment() {
val activeBgSource = activePlugin.activeBgSource val activeBgSource = activePlugin.activeBgSource
historyBrowser?.visibility = (profile != null).toVisibility() historyBrowser?.visibility = (profile != null).toVisibility()
fill?.visibility = (pump.pumpDescription.isRefillingCapable && pump.isInitialized() && !pump.isSuspended()).toVisibility() fill?.visibility = (pump.pumpDescription.isRefillingCapable && pump.isInitialized() && !pump.isSuspended()).toVisibility()
if (pump is DiaconnG8Plugin) { pumpBatteryChange?.visibility = (pump.pumpDescription.isBatteryReplaceable || pump.isBatteryChangeLoggingEnabled()).toVisibility()
pumpBatteryChange?.visibility = (pump.pumpDescription.isBatteryReplaceable && !pump.isBatteryChangeLoggingEnabled()).toVisibility()
} else {
pumpBatteryChange?.visibility =
(pump.pumpDescription.isBatteryReplaceable || (pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel && pump.isBatteryChangeLoggingEnabled)).toVisibility()
}
tempTarget?.visibility = (profile != null && !loop.isDisconnected).toVisibility() tempTarget?.visibility = (profile != null && !loop.isDisconnected).toVisibility()
tddStats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility() tddStats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()
val isPatchPump = pump.pumpDescription.isPatchPump
cannulaOrPatch?.text = if (pump.pumpDescription.isPatchPump) rh.gs(R.string.patch_pump) else rh.gs(R.string.cannula) cannulaOrPatch?.text = if (isPatchPump) rh.gs(R.string.patch_pump) else rh.gs(R.string.cannula)
val imageResource = if (pump.pumpDescription.isPatchPump) R.drawable.ic_patch_pump_outline else R.drawable.ic_cp_age_cannula val imageResource = if (isPatchPump) R.drawable.ic_patch_pump_outline else R.drawable.ic_cp_age_cannula
cannulaOrPatch?.setCompoundDrawablesWithIntrinsicBounds(imageResource, 0, 0, 0) cannulaOrPatch?.setCompoundDrawablesWithIntrinsicBounds(imageResource, 0, 0, 0)
batteryLayout?.visibility = (!isPatchPump || pump.pumpDescription.useHardwareLink).toVisibility()
if (!config.NSCLIENT) { if (!config.NSCLIENT) {
statusLightHandler.updateStatusLights(cannulaAge, insulinAge, reservoirLevel, sensorAge, sensorLevel, pbAge, batteryLevel) statusLightHandler.updateStatusLights(cannulaAge, insulinAge, reservoirLevel, sensorAge, sensorLevel, pbAge, batteryLevel)

View file

@ -34,6 +34,7 @@ import info.nightscout.androidaps.database.entities.UserEntry.Action
import info.nightscout.androidaps.database.entities.UserEntry.Sources import info.nightscout.androidaps.database.entities.UserEntry.Sources
import info.nightscout.androidaps.database.interfaces.end import info.nightscout.androidaps.database.interfaces.end
import info.nightscout.androidaps.databinding.OverviewFragmentBinding import info.nightscout.androidaps.databinding.OverviewFragmentBinding
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
import info.nightscout.androidaps.dialogs.* import info.nightscout.androidaps.dialogs.*
import info.nightscout.androidaps.events.EventAcceptOpenLoopChange import info.nightscout.androidaps.events.EventAcceptOpenLoopChange
import info.nightscout.androidaps.events.EventInitializationChanged import info.nightscout.androidaps.events.EventInitializationChanged
@ -61,6 +62,7 @@ import info.nightscout.androidaps.plugins.general.overview.notifications.Notific
import info.nightscout.androidaps.plugins.general.wear.events.EventWearInitiateAction import info.nightscout.androidaps.plugins.general.wear.events.EventWearInitiateAction
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.plugins.source.DexcomPlugin import info.nightscout.androidaps.plugins.source.DexcomPlugin
import info.nightscout.androidaps.plugins.source.XdripPlugin import info.nightscout.androidaps.plugins.source.XdripPlugin
import info.nightscout.androidaps.skins.SkinProvider import info.nightscout.androidaps.skins.SkinProvider
@ -866,13 +868,19 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
fun updateTime(from: String) { fun updateTime(from: String) {
binding.infoLayout.time.text = dateUtil.timeString(dateUtil.now()) binding.infoLayout.time.text = dateUtil.timeString(dateUtil.now())
// Status lights // Status lights
val isPatchPump = activePlugin.activePump.pumpDescription.isPatchPump val pump = activePlugin.activePump
val isPatchPump = pump.pumpDescription.isPatchPump
binding.statusLightsLayout.apply { binding.statusLightsLayout.apply {
cannulaOrPatch.setImageResource(if (isPatchPump) R.drawable.ic_patch_pump_outline else R.drawable.ic_cp_age_cannula) cannulaOrPatch.setImageResource(if (isPatchPump) R.drawable.ic_patch_pump_outline else R.drawable.ic_cp_age_cannula)
cannulaOrPatch.contentDescription = rh.gs(if (isPatchPump) R.string.statuslights_patch_pump_age else R.string.statuslights_cannula_age) cannulaOrPatch.contentDescription = rh.gs(if (isPatchPump) R.string.statuslights_patch_pump_age else R.string.statuslights_cannula_age)
cannulaOrPatch.scaleX = if (isPatchPump) 1.4f else 2f cannulaOrPatch.scaleX = if (isPatchPump) 1.4f else 2f
cannulaOrPatch.scaleY = cannulaOrPatch.scaleX cannulaOrPatch.scaleY = cannulaOrPatch.scaleX
insulinAge.visibility = isPatchPump.not().toVisibility() insulinAge.visibility = isPatchPump.not().toVisibility()
batteryLayout.visibility = (!isPatchPump || pump.pumpDescription.useHardwareLink).toVisibility()
pbAge.visibility = (pump.pumpDescription.isBatteryReplaceable || pump.isBatteryChangeLoggingEnabled()).toVisibility()
val useBatteryLevel = (pump.model() == PumpType.OMNIPOD_EROS && pump is OmnipodErosPumpPlugin)
|| (pump.model() != PumpType.ACCU_CHEK_COMBO && pump.model() != PumpType.OMNIPOD_DASH)
batteryLevel.visibility = useBatteryLevel.toVisibility()
statusLights.visibility = (sp.getBoolean(R.string.key_show_statuslights, true) || config.NSCLIENT).toVisibility() statusLights.visibility = (sp.getBoolean(R.string.key_show_statuslights, true) || config.NSCLIENT).toVisibility()
} }
statusLightHandler.updateStatusLights( statusLightHandler.updateStatusLights(

View file

@ -1,7 +1,6 @@
package info.nightscout.androidaps.plugins.general.overview package info.nightscout.androidaps.plugins.general.overview
import android.graphics.Color import android.graphics.Color
import android.view.View
import android.widget.TextView import android.widget.TextView
import androidx.annotation.StringRes import androidx.annotation.StringRes
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
@ -42,7 +41,7 @@ class StatusLightHandler @Inject constructor(
handleAge(careportal_cannula_age, TherapyEvent.Type.CANNULA_CHANGE, R.string.key_statuslights_cage_warning, 48.0, R.string.key_statuslights_cage_critical, 72.0) handleAge(careportal_cannula_age, TherapyEvent.Type.CANNULA_CHANGE, R.string.key_statuslights_cage_warning, 48.0, R.string.key_statuslights_cage_critical, 72.0)
handleAge(careportal_insulin_age, TherapyEvent.Type.INSULIN_CHANGE, R.string.key_statuslights_iage_warning, 72.0, R.string.key_statuslights_iage_critical, 144.0) handleAge(careportal_insulin_age, TherapyEvent.Type.INSULIN_CHANGE, R.string.key_statuslights_iage_warning, 72.0, R.string.key_statuslights_iage_critical, 144.0)
handleAge(careportal_sensor_age, TherapyEvent.Type.SENSOR_CHANGE, R.string.key_statuslights_sage_warning, 216.0, R.string.key_statuslights_sage_critical, 240.0) handleAge(careportal_sensor_age, TherapyEvent.Type.SENSOR_CHANGE, R.string.key_statuslights_sage_warning, 216.0, R.string.key_statuslights_sage_critical, 240.0)
if (pump.pumpDescription.isBatteryReplaceable || (pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel && pump.isBatteryChangeLoggingEnabled)) { if (pump.pumpDescription.isBatteryReplaceable || pump.isBatteryChangeLoggingEnabled()) {
handleAge(careportal_pb_age, TherapyEvent.Type.PUMP_BATTERY_CHANGE, R.string.key_statuslights_bage_warning, 216.0, R.string.key_statuslights_bage_critical, 240.0) handleAge(careportal_pb_age, TherapyEvent.Type.PUMP_BATTERY_CHANGE, R.string.key_statuslights_bage_warning, 216.0, R.string.key_statuslights_bage_critical, 240.0)
} }
if (!config.NSCLIENT) { if (!config.NSCLIENT) {
@ -58,16 +57,16 @@ class StatusLightHandler @Inject constructor(
} }
if (!config.NSCLIENT) { if (!config.NSCLIENT) {
if (pump.model() == PumpType.OMNIPOD_DASH) { // The Omnipod Eros does not report its battery level. However, some RileyLink alternatives do.
// Omnipod Dash does not report its battery level // Depending on the user's configuration, we will either show the battery level reported by the RileyLink or "n/a"
// Pump instance check is needed because at startup, the pump can still be VirtualPumpPlugin and that will cause a crash
val erosBatteryLinkAvailable = pump.model() == PumpType.OMNIPOD_EROS && pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel
if (pump.model().supportBatteryLevel || erosBatteryLinkAvailable) {
handleLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")
} else {
careportal_battery_level?.text = rh.gs(R.string.notavailable) careportal_battery_level?.text = rh.gs(R.string.notavailable)
careportal_battery_level?.setTextColor(Color.WHITE) careportal_battery_level?.setTextColor(Color.WHITE)
} else if (pump.model() == PumpType.OMNIPOD_EROS && pump is OmnipodErosPumpPlugin) { // instance of check is needed because at startup, pump can still be VirtualPumpPlugin and that will cause a crash because of the class cast below
// The Omnipod Eros does not report its battery level. However, some RileyLink alternatives do.
// Depending on the user's configuration, we will either show the battery level reported by the RileyLink or "n/a"
handleOmnipodErosBatteryLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%", pump.isUseRileyLinkBatteryLevel)
} else if (pump.model() != PumpType.ACCU_CHEK_COMBO) {
handleLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")
} }
} }
} }
@ -104,13 +103,4 @@ class StatusLightHandler @Inject constructor(
} }
} }
@Suppress("SameParameterValue")
private fun handleOmnipodErosBatteryLevel(view: TextView?, criticalSetting: Int, criticalDefaultValue: Double, warnSetting: Int, warnDefaultValue: Double, level: Double, units: String, useRileyLinkBatteryLevel: Boolean) {
if (useRileyLinkBatteryLevel) {
handleLevel(view, criticalSetting, criticalDefaultValue, warnSetting, warnDefaultValue, level, units)
} else {
view?.text = rh.gs(R.string.notavailable)
view?.setTextColor(Color.WHITE)
}
}
} }

View file

@ -41,7 +41,6 @@
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textSize="14sp" /> android:textSize="14sp" />
<TextView <TextView
android:id="@+id/sensor_level_label" android:id="@+id/sensor_level_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -96,7 +95,6 @@
android:textSize="14sp" android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_insulin" /> app:drawableStartCompat="@drawable/ic_cp_age_insulin" />
<TextView <TextView
android:id="@+id/insulin_age_label" android:id="@+id/insulin_age_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -231,6 +229,7 @@
</TableRow> </TableRow>
<TableRow <TableRow
android:id="@+id/battery_layout"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:focusable="true"> android:focusable="true">
@ -246,7 +245,6 @@
android:textSize="14sp" android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_battery" /> app:drawableStartCompat="@drawable/ic_cp_age_battery" />
<TextView <TextView
android:id="@+id/pb_age_label" android:id="@+id/pb_age_label"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -290,20 +288,4 @@
</TableRow> </TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="5"
android:background="?android:attr/dividerHorizontal" />
</TableRow>
</TableLayout> </TableLayout>

View file

@ -1,232 +0,0 @@
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0,2,4"
tools:context=".plugins.general.actions.ActionsFragment">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingEnd="2dp"
android:text="@string/careportal_sensor_label"
android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_sensor" />
<TextView
android:id="@+id/sensor_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/sensor_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:gravity="center_vertical"
android:paddingStart="2dp"
android:textColor="@android:color/white"
android:textSize="14sp"
tools:ignore="RtlSymmetry" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="3"
android:background="?android:attr/dividerHorizontal" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="25dp"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingEnd="2dp"
android:text="@string/careportal_insulin_label"
android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_insulin" />
<TextView
android:id="@+id/insulin_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/reservoir_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:gravity="center_vertical"
android:paddingStart="2dp"
android:textColor="@android:color/white"
android:textSize="14sp"
tools:ignore="RtlSymmetry" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="3"
android:background="?android:attr/dividerHorizontal" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true">
<TextView
android:id="@+id/cannula_or_patch"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingEnd="2dp"
android:text="@string/cannula"
android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_cannula" />
<TextView
android:id="@+id/cannula_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:gravity="center_vertical"
android:paddingStart="2dp"
android:text=""
android:textColor="@android:color/white"
android:textSize="14sp"
tools:ignore="RtlSymmetry" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="3"
android:background="?android:attr/dividerHorizontal" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true">
<TextView
android:id="@+id/pb_label"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:gravity="center_vertical"
android:paddingStart="15dp"
android:paddingEnd="2dp"
android:text="@string/pump"
android:textSize="14sp"
app:drawableStartCompat="@drawable/ic_cp_age_battery" />
<TextView
android:id="@+id/pb_age"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:textColor="@android:color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/battery_level"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:gravity="center_vertical"
android:paddingStart="2dp"
android:textColor="@android:color/white"
android:textSize="14sp"
tools:ignore="RtlSymmetry" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_marginLeft="20dp"
android:layout_marginTop="2dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="2dp"
android:layout_span="3"
android:background="?android:attr/dividerHorizontal" />
</TableRow>
</TableLayout>

View file

@ -94,6 +94,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/battery_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_weight="1" android:layout_weight="1"

View file

@ -276,4 +276,9 @@ interface Pump {
* if true APS set 100% basal before full hour to avoid pump beeping * if true APS set 100% basal before full hour to avoid pump beeping
*/ */
fun setNeutralTempAtFullHour(): Boolean = false fun setNeutralTempAtFullHour(): Boolean = false
/**
* Pumps with a hardware link can set via config "Battery Change Logging"
*/
fun isBatteryChangeLoggingEnabled(): Boolean = false
} }

View file

@ -39,6 +39,7 @@ class PumpDescription() {
var needsManualTDDLoad = false var needsManualTDDLoad = false
var hasCustomUnreachableAlertCheck = false var hasCustomUnreachableAlertCheck = false
var isPatchPump = false var isPatchPump = false
var useHardwareLink = false
fun resetSettings() { fun resetSettings() {
isBolusCapable = true isBolusCapable = true
@ -68,6 +69,7 @@ class PumpDescription() {
supportsTDDs = false supportsTDDs = false
needsManualTDDLoad = true needsManualTDDLoad = true
hasCustomUnreachableAlertCheck = false hasCustomUnreachableAlertCheck = false
useHardwareLink = false
} }
fun fillFor(pumpType: PumpType) { fun fillFor(pumpType: PumpType) {
@ -105,6 +107,7 @@ class PumpDescription() {
is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min) is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min)
hasCustomUnreachableAlertCheck = pumpType.hasCustomUnreachableAlertCheck hasCustomUnreachableAlertCheck = pumpType.hasCustomUnreachableAlertCheck
isPatchPump = pumpType.isPatchPump isPatchPump = pumpType.isPatchPump
useHardwareLink = pumpType.useHardwareLink
} }
companion object { companion object {

View file

@ -52,7 +52,8 @@ enum class PumpType {
baseBasalStep = 0.01, baseBasalStep = 0.01,
baseBasalSpecialSteps = DoseStepSize.ComboBasal, baseBasalSpecialSteps = DoseStepSize.ComboBasal,
pumpCapability = PumpCapability.ComboCapabilities, pumpCapability = PumpCapability.ComboCapabilities,
source = Sources.Combo), source = Sources.Combo,
supportBatteryLevel = false),
ACCU_CHEK_SPIRIT(description = "Accu-Chek Spirit", ACCU_CHEK_SPIRIT(description = "Accu-Chek Spirit",
manufacturer = ManufacturerType.Roche, manufacturer = ManufacturerType.Roche,
model = "Spirit", model = "Spirit",
@ -185,6 +186,8 @@ enum class PumpType {
pumpCapability = PumpCapability.OmnipodCapabilities, pumpCapability = PumpCapability.OmnipodCapabilities,
hasCustomUnreachableAlertCheck = true, hasCustomUnreachableAlertCheck = true,
isPatchPump = true, isPatchPump = true,
useHardwareLink = true,
supportBatteryLevel = false,
source = Sources.OmnipodEros), source = Sources.OmnipodEros),
OMNIPOD_DASH(description = "Omnipod Dash", OMNIPOD_DASH(description = "Omnipod Dash",
manufacturer = ManufacturerType.Insulet, manufacturer = ManufacturerType.Insulet,
@ -201,7 +204,8 @@ enum class PumpType {
baseBasalSpecialSteps = null, baseBasalSpecialSteps = null,
isPatchPump = true, isPatchPump = true,
pumpCapability = PumpCapability.OmnipodCapabilities, pumpCapability = PumpCapability.OmnipodCapabilities,
hasCustomUnreachableAlertCheck = false), hasCustomUnreachableAlertCheck = false,
supportBatteryLevel = false),
MEDTRONIC_512_712(description = "Medtronic 512/712", MEDTRONIC_512_712(description = "Medtronic 512/712",
manufacturer = ManufacturerType.Medtronic, manufacturer = ManufacturerType.Medtronic,
model = "512/712", model = "512/712",
@ -313,7 +317,8 @@ enum class PumpType {
baseBasalStep = 0.01, baseBasalStep = 0.01,
baseBasalSpecialSteps = null, baseBasalSpecialSteps = null,
pumpCapability = PumpCapability.DanaWithHistoryCapabilities, pumpCapability = PumpCapability.DanaWithHistoryCapabilities,
source = Sources.DiaconnG8); source = Sources.DiaconnG8,
useHardwareLink = true);
val description: String val description: String
var manufacturer: ManufacturerType? = null var manufacturer: ManufacturerType? = null
@ -356,6 +361,10 @@ enum class PumpType {
private set private set
var isPatchPump = false var isPatchPump = false
private set private set
var supportBatteryLevel = true
private set
var useHardwareLink = false
private set
private var parent: PumpType? = null private var parent: PumpType? = null
val source: Sources val source: Sources
@ -424,6 +433,8 @@ enum class PumpType {
pumpCapability: PumpCapability, pumpCapability: PumpCapability,
hasCustomUnreachableAlertCheck: Boolean = false, hasCustomUnreachableAlertCheck: Boolean = false,
isPatchPump: Boolean = false, isPatchPump: Boolean = false,
supportBatteryLevel: Boolean = true,
useHardwareLink: Boolean = false,
source: Sources = Sources.VirtualPump) { source: Sources = Sources.VirtualPump) {
this.description = description this.description = description
this.manufacturer = manufacturer this.manufacturer = manufacturer
@ -441,6 +452,8 @@ enum class PumpType {
this.pumpCapability = pumpCapability this.pumpCapability = pumpCapability
this.hasCustomUnreachableAlertCheck = hasCustomUnreachableAlertCheck this.hasCustomUnreachableAlertCheck = hasCustomUnreachableAlertCheck
this.isPatchPump = isPatchPump this.isPatchPump = isPatchPump
this.supportBatteryLevel = supportBatteryLevel
this.useHardwareLink = useHardwareLink
this.source = source this.source = source
} }

View file

@ -542,7 +542,7 @@ class DiaconnG8Plugin @Inject constructor(
override fun executeCustomAction(customActionType: CustomActionType) {} override fun executeCustomAction(customActionType: CustomActionType) {}
override fun canHandleDST(): Boolean = false override fun canHandleDST(): Boolean = false
fun isBatteryChangeLoggingEnabled():Boolean { override fun isBatteryChangeLoggingEnabled():Boolean {
return sp.getBoolean(R.string.key_diaconn_g8_logbatterychange, false) return sp.getBoolean(R.string.key_diaconn_g8_logbatterychange, false)
} }

View file

@ -1083,7 +1083,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
return aapsOmnipodErosManager.isShowRileyLinkBatteryLevel(); return aapsOmnipodErosManager.isShowRileyLinkBatteryLevel();
} }
public boolean isBatteryChangeLoggingEnabled() { @Override public boolean isBatteryChangeLoggingEnabled() {
return aapsOmnipodErosManager.isBatteryChangeLoggingEnabled(); return aapsOmnipodErosManager.isBatteryChangeLoggingEnabled();
} }