- fix for #28 serial number not shown in RL Stats dialog

This commit is contained in:
Andy Rozman 2020-01-24 11:18:40 +00:00
parent d21339700d
commit 14e66a230d
2 changed files with 22 additions and 9 deletions

View file

@ -1,12 +1,13 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog; package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
import androidx.fragment.app.Fragment;
import org.joda.time.LocalDateTime; import org.joda.time.LocalDateTime;
import java.util.Locale; import java.util.Locale;
@ -99,7 +100,7 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
RileyLinkTargetDevice targetDevice = RileyLinkUtil.getTargetDevice(); RileyLinkTargetDevice targetDevice = RileyLinkUtil.getTargetDevice();
if (RileyLinkUtil.getServiceState()==null) if (RileyLinkUtil.getServiceState() == null)
this.connectionStatus.setText(MainApp.gs(RileyLinkServiceState.NotStarted.getResourceId(targetDevice))); this.connectionStatus.setText(MainApp.gs(RileyLinkServiceState.NotStarted.getResourceId(targetDevice)));
else else
this.connectionStatus.setText(MainApp.gs(RileyLinkUtil.getServiceState().getResourceId(targetDevice))); this.connectionStatus.setText(MainApp.gs(RileyLinkUtil.getServiceState().getResourceId(targetDevice)));
@ -113,7 +114,7 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
RileyLinkFirmwareVersion firmwareVersion = rileyLinkServiceData.versionCC110; RileyLinkFirmwareVersion firmwareVersion = rileyLinkServiceData.versionCC110;
if (firmwareVersion==null) { if (firmwareVersion == null) {
this.firmwareVersion.setText("BLE113: -\nCC110: -"); this.firmwareVersion.setText("BLE113: -\nCC110: -");
} else { } else {
this.firmwareVersion.setText("BLE113: " + rileyLinkServiceData.versionBLE113 + // this.firmwareVersion.setText("BLE113: " + rileyLinkServiceData.versionBLE113 + //
@ -149,17 +150,18 @@ public class RileyLinkStatusGeneral extends Fragment implements RefreshableInter
} }
} else { } else {
// if (OmnipodUtil.isOmnipodDash())
// TODO add handling for Omnipod Dash pump status // TODO add handling for Omnipod Dash pump status
this.omnipodPumpStatus = OmnipodUtil.getPumpStatus(); this.omnipodPumpStatus = OmnipodUtil.getPumpStatus();
if (omnipodPumpStatus != null) { if (omnipodPumpStatus != null) {
this.deviceType.setText(MainApp.gs(RileyLinkTargetDevice.Omnipod.getResourceId())); 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)); this.pumpFrequency.setText(MainApp.gs(R.string.omnipod_frequency));
if (omnipodPumpStatus.podAvailable) { if (omnipodPumpStatus.podAvailable) {
this.serialNumber.setText(omnipodPumpStatus.podNumber); this.serialNumber.setText(omnipodPumpStatus.podSessionState.getLot());
this.connectedDevice.setText(omnipodPumpStatus.pumpType== PumpType.Insulet_Omnipod ? "Eros Pod" : "Dash Pod"); this.connectedDevice.setText(omnipodPumpStatus.pumpType == PumpType.Insulet_Omnipod ? "Eros Pod" : "Dash Pod");
} else { } else {
this.connectedDevice.setText("-"); this.connectedDevice.setText("-");
} }

View file

@ -9,7 +9,6 @@ import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializer; import com.google.gson.JsonSerializer;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;
import org.joda.time.format.ISODateTimeFormat; import org.joda.time.format.ISODateTimeFormat;
@ -20,20 +19,22 @@ import java.util.List;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus; 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.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.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodCommandType; 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.OmnipodCommunicationManagerInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.OmnipodPodType; 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.OmnipodPumpPluginInterface;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodDeviceState; 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.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.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.service.RileyLinkOmnipodService;
import info.nightscout.androidaps.plugins.pump.omnipod_dash.OmnipodDashPumpPlugin;
import info.nightscout.androidaps.utils.OKDialog; import info.nightscout.androidaps.utils.OKDialog;
/** /**
@ -205,4 +206,14 @@ public class OmnipodUtil extends RileyLinkUtil {
public static PodSessionState getPodSessionState() { public static PodSessionState getPodSessionState() {
return omnipodPumpStatus.podSessionState; return omnipodPumpStatus.podSessionState;
} }
public static boolean isOmnipodEros() {
return OmnipodPumpPlugin.getPlugin().isEnabled(PluginType.PUMP);
}
public static boolean isOmnipodDash() {
return OmnipodDashPumpPlugin.getPlugin().isEnabled(PluginType.PUMP);
}
} }