- possible fix for pod not avilable notification

This commit is contained in:
Andy Rozman 2020-01-12 11:59:38 +01:00
parent 18145d91d9
commit be88aa69f1
3 changed files with 8 additions and 6 deletions

View file

@ -278,7 +278,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
private void doPodCheck() { private void doPodCheck() {
if (System.currentTimeMillis() > this.nextPodCheck) { if (System.currentTimeMillis() > this.nextPodCheck) {
if (!getPodPumpStatusObject().podAvailable) { if (!getPodPumpStatusObject().podAvailable && getPodPumpStatusObject().podAvailibityChecked) {
Notification notification = new Notification(Notification.OMNIPOD_POD_NOT_ATTACHED, MainApp.gs(R.string.omnipod_error_pod_not_attached), Notification.NORMAL); Notification notification = new Notification(Notification.OMNIPOD_POD_NOT_ATTACHED, MainApp.gs(R.string.omnipod_error_pod_not_attached), Notification.NORMAL);
RxBus.INSTANCE.send(new EventNewNotification(notification)); RxBus.INSTANCE.send(new EventNewNotification(notification));
} else { } else {

View file

@ -51,6 +51,7 @@ public class OmnipodPumpStatus extends PumpStatus {
public String podNumber; public String podNumber;
public PodDeviceState podDeviceState = PodDeviceState.NeverContacted; public PodDeviceState podDeviceState = PodDeviceState.NeverContacted;
public boolean podAvailable = false; public boolean podAvailable = false;
public boolean podAvailibityChecked = false;
public boolean ackAlertsAvailable = false; public boolean ackAlertsAvailable = false;
public String ackAlertsText = null; public String ackAlertsText = null;
@ -225,6 +226,6 @@ public class OmnipodPumpStatus extends PumpStatus {
", tempBasalRemainMin=" + tempBasalRemainMin + ", tempBasalRemainMin=" + tempBasalRemainMin +
", tempBasalStart=" + tempBasalStart + ", tempBasalStart=" + tempBasalStart +
", pumpDescription=" + pumpDescription + ", pumpDescription=" + pumpDescription +
"} " ; "} ";
} }
} }

View file

@ -23,12 +23,12 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
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.common.hw.rileylink.service.RileyLinkService; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin; import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService; import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService;
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.state.PodSessionState; import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
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.driver.comm.AapsOmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.utils.SP; import info.nightscout.androidaps.utils.SP;
@ -114,7 +114,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
} }
private void initializeErosOmnipodManager() { private void initializeErosOmnipodManager() {
if(AapsOmnipodManager.getInstance() == null) { if (AapsOmnipodManager.getInstance() == null) {
PodSessionState podState = null; PodSessionState podState = null;
if (SP.contains(OmnipodConst.Prefs.PodState)) { if (SP.contains(OmnipodConst.Prefs.PodState)) {
try { try {
@ -128,6 +128,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
} }
OmnipodCommunicationService omnipodCommunicationService = new OmnipodCommunicationService(rfspy); OmnipodCommunicationService omnipodCommunicationService = new OmnipodCommunicationService(rfspy);
omnipodCommunicationService.setPumpStatus(pumpStatus); omnipodCommunicationService.setPumpStatus(pumpStatus);
pumpStatus.podAvailibityChecked = true;
omnipodCommunicationManager = new AapsOmnipodManager(omnipodCommunicationService, podState, pumpStatus); omnipodCommunicationManager = new AapsOmnipodManager(omnipodCommunicationService, podState, pumpStatus);
} else { } else {
@ -143,11 +144,11 @@ public class RileyLinkOmnipodService extends RileyLinkService {
@Override @Override
public RileyLinkCommunicationManager getDeviceCommunicationManager() { public RileyLinkCommunicationManager getDeviceCommunicationManager() {
if(omnipodCommunicationManager instanceof AapsOmnipodManager) { // Eros if (omnipodCommunicationManager instanceof AapsOmnipodManager) { // Eros
return ((AapsOmnipodManager) omnipodCommunicationManager).getCommunicationService(); return ((AapsOmnipodManager) omnipodCommunicationManager).getCommunicationService();
} }
// FIXME is this correct for Dash? // FIXME is this correct for Dash?
return (RileyLinkCommunicationManager)omnipodCommunicationManager; return (RileyLinkCommunicationManager) omnipodCommunicationManager;
} }