From 14e66a230d2639c76ed4f5499d9379cfdc54f444 Mon Sep 17 00:00:00 2001 From: Andy Rozman Date: Fri, 24 Jan 2020 11:18:40 +0000 Subject: [PATCH] - fix for #28 serial number not shown in RL Stats dialog --- .../dialog/RileyLinkStatusGeneral.java | 14 ++++++++------ .../plugins/pump/omnipod/util/OmnipodUtil.java | 17 ++++++++++++++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneral.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneral.java index b8618470f0..66a5c69e58 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneral.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneral.java @@ -1,12 +1,13 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog; import android.os.Bundle; -import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; +import androidx.fragment.app.Fragment; + import org.joda.time.LocalDateTime; import java.util.Locale; @@ -99,7 +100,7 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter RileyLinkTargetDevice targetDevice = RileyLinkUtil.getTargetDevice(); - if (RileyLinkUtil.getServiceState()==null) + if (RileyLinkUtil.getServiceState() == null) this.connectionStatus.setText(MainApp.gs(RileyLinkServiceState.NotStarted.getResourceId(targetDevice))); else this.connectionStatus.setText(MainApp.gs(RileyLinkUtil.getServiceState().getResourceId(targetDevice))); @@ -113,7 +114,7 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter RileyLinkFirmwareVersion firmwareVersion = rileyLinkServiceData.versionCC110; - if (firmwareVersion==null) { + if (firmwareVersion == null) { this.firmwareVersion.setText("BLE113: -\nCC110: -"); } else { this.firmwareVersion.setText("BLE113: " + rileyLinkServiceData.versionBLE113 + // @@ -149,17 +150,18 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter } } else { + // if (OmnipodUtil.isOmnipodDash()) // TODO add handling for Omnipod Dash pump status this.omnipodPumpStatus = OmnipodUtil.getPumpStatus(); if (omnipodPumpStatus != null) { this.deviceType.setText(MainApp.gs(RileyLinkTargetDevice.Omnipod.getResourceId())); - this.deviceModel.setText(omnipodPumpStatus.pumpType== PumpType.Insulet_Omnipod ? "Eros" : "Dash"); + this.deviceModel.setText(omnipodPumpStatus.pumpType == PumpType.Insulet_Omnipod ? "Eros" : "Dash"); this.pumpFrequency.setText(MainApp.gs(R.string.omnipod_frequency)); if (omnipodPumpStatus.podAvailable) { - this.serialNumber.setText(omnipodPumpStatus.podNumber); - this.connectedDevice.setText(omnipodPumpStatus.pumpType== PumpType.Insulet_Omnipod ? "Eros Pod" : "Dash Pod"); + this.serialNumber.setText(omnipodPumpStatus.podSessionState.getLot()); + this.connectedDevice.setText(omnipodPumpStatus.pumpType == PumpType.Insulet_Omnipod ? "Eros Pod" : "Dash Pod"); } else { this.connectedDevice.setText("-"); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java index d4d4075ff0..09f0bde336 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/util/OmnipodUtil.java @@ -9,7 +9,6 @@ import com.google.gson.JsonPrimitive; import com.google.gson.JsonSerializer; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.format.ISODateTimeFormat; @@ -20,20 +19,22 @@ import java.util.List; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.bus.RxBus; 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.omnipod.OmnipodPumpPlugin; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommunicationManagerInterface; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPumpPluginInterface; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodDeviceState; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState; -import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus; -import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged; +import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService; +import info.nightscout.androidaps.plugins.pump.omnipod_dash.OmnipodDashPumpPlugin; import info.nightscout.androidaps.utils.OKDialog; /** @@ -205,4 +206,14 @@ public class OmnipodUtil extends RileyLinkUtil { public static PodSessionState getPodSessionState() { return omnipodPumpStatus.podSessionState; } + + public static boolean isOmnipodEros() { + return OmnipodPumpPlugin.getPlugin().isEnabled(PluginType.PUMP); + } + + public static boolean isOmnipodDash() { + return OmnipodDashPumpPlugin.getPlugin().isEnabled(PluginType.PUMP); + } + + }