Improve information on Pod tab
This commit is contained in:
parent
4724cf6048
commit
8ed802d91b
|
@ -22,10 +22,8 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
|
|||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodStatusRequest
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodDeviceState
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodAcknowledgeAlertsChanged
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange
|
||||
|
@ -245,46 +243,30 @@ class OmnipodFragment : DaggerFragment() {
|
|||
|
||||
aapsLogger.info(LTag.PUMP, "getDriverState: [driverState={}]", driverState)
|
||||
|
||||
// FIXME for displaying pod info, we should look at PodStateManager instead of this driverState,
|
||||
// because that way, we can also show the Pod info when the RL isn't initialized yet
|
||||
if (driverState == OmnipodDriverState.NotInitalized) {
|
||||
omnipod_pod_address.text = resourceHelper.gs(R.string.omnipod_pod_name_no_info)
|
||||
omnipod_pod_lot.text = "-"
|
||||
omnipod_pod_tid.text = "-"
|
||||
omnipod_pod_fw_version.text = "-"
|
||||
omnipod_pod_expiry.text = "-"
|
||||
omnipod_pod_status.text = resourceHelper.gs(R.string.omnipod_pod_not_initalized)
|
||||
omnipodPumpStatus.podAvailable = false
|
||||
omnipodPumpStatus.podNumber == null
|
||||
} else if (driverState == OmnipodDriverState.Initalized_NoPod) {
|
||||
omnipod_pod_address.text = resourceHelper.gs(R.string.omnipod_pod_name_no_info)
|
||||
omnipod_pod_lot.text = "-"
|
||||
omnipod_pod_tid.text = "-"
|
||||
omnipod_pod_fw_version.text = "-"
|
||||
omnipod_pod_expiry.text = "-"
|
||||
omnipod_pod_status.text = resourceHelper.gs(R.string.omnipod_pod_no_pod_connected)
|
||||
omnipodPumpStatus.podAvailable = false
|
||||
omnipodPumpStatus.podNumber == null
|
||||
} else if (driverState == OmnipodDriverState.Initalized_PodInitializing) {
|
||||
if (!podStateManager.hasState() || !podStateManager.isPaired) {
|
||||
if (podStateManager.hasState()) {
|
||||
omnipod_pod_address.text = podStateManager.address.toString()
|
||||
} else {
|
||||
omnipod_pod_address.text = "-"
|
||||
}
|
||||
omnipod_pod_lot.text = "-"
|
||||
omnipod_pod_tid.text = "-"
|
||||
omnipod_pod_fw_version.text = "-"
|
||||
omnipod_pod_expiry.text = "-"
|
||||
omnipod_pod_status.text = resourceHelper.gs(R.string.omnipod_pod_status_initalizing) + " (" + podStateManager.getSetupProgress().name + ")"
|
||||
if (podStateManager.hasState()) {
|
||||
omnipod_pod_status.text = resourceHelper.gs(R.string.omnipod_pod_status_not_initalized)
|
||||
} else {
|
||||
omnipod_pod_status.text = resourceHelper.gs(R.string.omnipod_pod_status_no_pod_connected)
|
||||
}
|
||||
omnipodPumpStatus.podAvailable = false
|
||||
omnipodPumpStatus.podNumber == podStateManager.address.toString()
|
||||
omnipodPumpStatus.podNumber == null
|
||||
} else {
|
||||
omnipodPumpStatus.podLotNumber = "" + podStateManager.lot
|
||||
omnipodPumpStatus.podAvailable = true
|
||||
omnipodPumpStatus.podAvailable = podStateManager.isSetupCompleted
|
||||
omnipod_pod_address.text = podStateManager.address.toString()
|
||||
omnipod_pod_lot.text = if (podStateManager.lot == null) "" else podStateManager.lot.toString()
|
||||
omnipod_pod_tid.text = if (podStateManager.tid == null) "" else podStateManager.tid.toString()
|
||||
if (podStateManager.pmVersion == null || podStateManager.piVersion == null) {
|
||||
omnipod_pod_fw_version.text = ""
|
||||
} else {
|
||||
omnipod_pod_lot.text = podStateManager.lot.toString()
|
||||
omnipod_pod_tid.text = podStateManager.tid.toString()
|
||||
omnipod_pod_fw_version.text = podStateManager.pmVersion.toString() + " / " + podStateManager.piVersion.toString()
|
||||
}
|
||||
omnipod_pod_expiry.text = podStateManager.expiryDateAsString
|
||||
omnipodPumpStatus.podNumber = podStateManager.address.toString()
|
||||
|
||||
|
@ -292,52 +274,18 @@ class OmnipodFragment : DaggerFragment() {
|
|||
|
||||
var stateText: String?
|
||||
|
||||
// FIXME this PodDeviceState doesn't make much sense. We should use info from PodStateManager
|
||||
when (podDeviceState) {
|
||||
null,
|
||||
PodDeviceState.Sleeping -> stateText = "{fa-bed} " // + pumpStatus.pumpDeviceState.name());
|
||||
PodDeviceState.NeverContacted,
|
||||
PodDeviceState.WakingUp,
|
||||
PodDeviceState.PumpUnreachable,
|
||||
PodDeviceState.ErrorWhenCommunicating,
|
||||
PodDeviceState.TimeoutWhenCommunicating,
|
||||
PodDeviceState.InvalidConfiguration -> stateText = " " + resourceHelper.gs(podDeviceState.resourceId)
|
||||
|
||||
PodDeviceState.Active -> {
|
||||
stateText = resourceHelper.gs(R.string.omnipod_pod_status_active)
|
||||
// val cmd = OmnipodUtil.getCurrentCommand()
|
||||
// if (cmd == null)
|
||||
// omnipod_pod_status.text = " " + resourceHelper.gs(pumpStatus.pumpDeviceState.resourceId)
|
||||
// else {
|
||||
// aapsLogger.debug(LTag.PUMP,"Command: " + cmd)
|
||||
// val cmdResourceId = cmd.resourceId
|
||||
// if (cmd == MedtronicCommandType.GetHistoryData) {
|
||||
// omnipod_pod_status.text = OmnipodUtil.frameNumber?.let {
|
||||
// resourceHelper.gs(cmdResourceId, OmnipodUtil.pageNumber, OmnipodUtil.frameNumber)
|
||||
// }
|
||||
// ?: resourceHelper.gs(R.string.medtronic_cmd_desc_get_history_request, OmnipodUtil.pageNumber)
|
||||
// } else {
|
||||
// omnipod_pod_status.text = " " + (cmdResourceId?.let { resourceHelper.gs(it) }
|
||||
// ?: cmd.getCommandDescription())
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
else -> {
|
||||
aapsLogger.warn(LTag.PUMP, "Unknown pump state: " + omnipodPumpStatus.podDeviceState)
|
||||
stateText = resourceHelper.gs(R.string.omnipod_pod_status_unknown)
|
||||
}
|
||||
}
|
||||
|
||||
if (podStateManager.isSetupCompleted) {
|
||||
if(podStateManager.hasFaultEvent()) {
|
||||
val faultEventCode = podStateManager.faultEvent.faultEventCode
|
||||
stateText = resourceHelper.gs(R.string.omnipod_pod_status_pod_fault) + " ("+ faultEventCode.value +" "+ faultEventCode.name +")"
|
||||
} else if (podStateManager.isSetupCompleted) {
|
||||
stateText = resourceHelper.gs(R.string.omnipod_pod_status_pod_running)
|
||||
if (podStateManager.lastDeliveryStatus != null) {
|
||||
stateText += " (last delivery status: " + podStateManager.lastDeliveryStatus.name + ")"
|
||||
}
|
||||
} else {
|
||||
if (podStateManager.isPaired) {
|
||||
stateText = resourceHelper.gs(R.string.omnipod_pod_setup_in_progress)
|
||||
stateText += " (setup progress: " + podStateManager.setupProgress.name + ")"
|
||||
}
|
||||
}
|
||||
|
||||
omnipod_pod_status.text = stateText
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public class OmnipodPumpStatus extends PumpStatus {
|
|||
|
||||
public String podNumber;
|
||||
public PodDeviceState podDeviceState = PodDeviceState.NeverContacted;
|
||||
// FIXME replace with method calls on PodStateManager
|
||||
public boolean podAvailable = false;
|
||||
public boolean podAvailibityChecked = false;
|
||||
public boolean ackAlertsAvailable = false;
|
||||
|
|
|
@ -1863,9 +1863,11 @@
|
|||
<string name="omnipod_reservoir_over50">Over 50 U</string>
|
||||
<string name="omnipod_pod_address">Pod Address</string>
|
||||
<string name="omnipod_pod_expiry">Pod Expires</string>
|
||||
<string name="omnipod_pod_name_no_info">No info</string>
|
||||
<string name="omnipod_pod_no_pod_connected">No Pod connected</string>
|
||||
<string name="omnipod_pod_not_initalized">Not initialized</string>
|
||||
<string name="omnipod_pod_status_no_pod_connected">No Pod connected</string>
|
||||
<string name="omnipod_pod_setup_in_progress">Pod setup in progress</string>
|
||||
<string name="omnipod_pod_status_not_initalized">Pod not initialized</string>
|
||||
<string name="omnipod_pod_status_pod_fault">!!! Pod Fault</string>
|
||||
<string name="omnipod_pod_status_pod_running">Pod running</string>
|
||||
<string name="omnipod_pod_active_alerts">Active Pod Alerts</string>
|
||||
<string name="omnipod_ack_short">Ack Alerts</string>
|
||||
<string name="omnipod_last_bolus" translatable="false">%1$.2f %2$s (%3$s)</string>
|
||||
|
|
Loading…
Reference in a new issue