- RL status refresh

This commit is contained in:
Andy Rozman 2020-05-08 15:23:02 +01:00
parent 2243ec6061
commit 480aac2d18
5 changed files with 34 additions and 12 deletions

View file

@ -3,9 +3,11 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.common.ManufacturerType;
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.ble.defs.RileyLinkFirmwareVersion; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
@ -14,6 +16,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
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.medtronic.events.EventMedtronicDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodDeviceStatusChange;
/** /**
* Created by andy on 16/05/2018. * Created by andy on 16/05/2018.
@ -25,6 +28,7 @@ public class RileyLinkServiceData {
@Inject AAPSLogger aapsLogger; @Inject AAPSLogger aapsLogger;
@Inject RileyLinkUtil rileyLinkUtil; @Inject RileyLinkUtil rileyLinkUtil;
@Inject RxBusWrapper rxBus; @Inject RxBusWrapper rxBus;
@Inject ActivePluginProvider activePlugin;
boolean tuneUpDone = false; boolean tuneUpDone = false;
public RileyLinkError rileyLinkError; public RileyLinkError rileyLinkError;
@ -79,7 +83,10 @@ public class RileyLinkServiceData {
aapsLogger.info(LTag.PUMP, "RileyLink State Changed: {} {}", newState, errorCode == null ? "" : " - Error State: " + errorCode.name()); aapsLogger.info(LTag.PUMP, "RileyLink State Changed: {} {}", newState, errorCode == null ? "" : " - Error State: " + errorCode.name());
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(rileyLinkServiceState, errorCode, targetDevice)); rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(rileyLinkServiceState, errorCode, targetDevice));
if (activePlugin.getActivePump().manufacturer()== ManufacturerType.Medtronic)
rxBus.send(new EventMedtronicDeviceStatusChange(newState, errorCode)); rxBus.send(new EventMedtronicDeviceStatusChange(newState, errorCode));
else
rxBus.send(new EventOmnipodDeviceStatusChange(newState, errorCode));
return null; return null;
} else { } else {

View file

@ -203,6 +203,17 @@ class OmnipodFragment : DaggerFragment() {
loopHandler.removeCallbacks(refreshLoop) loopHandler.removeCallbacks(refreshLoop)
} }
@Synchronized
private fun setDeviceStatus(event : EventOmnipodDeviceStatusChange) {
}
@Synchronized @Synchronized
private fun setDeviceStatus() { private fun setDeviceStatus() {
//val omnipodPumpStatus: OmnipodPumpStatus = OmnipodUtil.getPumpStatus() //val omnipodPumpStatus: OmnipodPumpStatus = OmnipodUtil.getPumpStatus()

View file

@ -235,15 +235,6 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
CommandQueueProvider commandQueue, CommandQueueProvider commandQueue,
FabricPrivacy fabricPrivacy) { FabricPrivacy fabricPrivacy) {
super(pluginDescription, pumpType, injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy); super(pluginDescription, pumpType, injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy);
// this.rileyLinkUtil = rileyLinkUtil;
// this.medtronicUtil = medtronicUtil;
// this.sp = sp;
// this.medtronicPumpStatus = medtronicPumpStatus;
// this.medtronicHistoryData = medtronicHistoryData;
// this.rileyLinkServiceData = rileyLinkServiceData;
// this.serviceTaskExecutor = serviceTaskExecutor;
} }
@Deprecated @Deprecated
@ -424,7 +415,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
@Override @Override
public void doTuneUpDevice() { public void doTuneUpDevice() {
rileyLinkOmnipodService.doTuneUpDevice(); //rileyLinkOmnipodService.doTuneUpDevice();
} }

View file

@ -18,6 +18,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicDeviceStatusChange;
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.util.OmnipodConst; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP; import info.nightscout.androidaps.utils.sharedPreferences.SP;
@ -187,7 +188,7 @@ public class OmnipodPumpStatus extends PumpStatus {
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(pumpDeviceState, RileyLinkTargetDevice.Omnipod)); rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(pumpDeviceState, RileyLinkTargetDevice.Omnipod));
rxBus.send(new EventMedtronicDeviceStatusChange(pumpDeviceState)); rxBus.send(new EventOmnipodDeviceStatusChange(pumpDeviceState));
} }
} }

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.events
import info.nightscout.androidaps.events.Event import info.nightscout.androidaps.events.Event
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState
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
@ -16,6 +17,8 @@ class EventOmnipodDeviceStatusChange : Event {
var podSessionState: PodSessionState? = null var podSessionState: PodSessionState? = null
var errorDescription: String? = null var errorDescription: String? = null
var podDeviceState: PodDeviceState? = null var podDeviceState: PodDeviceState? = null
var pumpDeviceState: PumpDeviceState? = null
@JvmOverloads @JvmOverloads
constructor(rileyLinkServiceState: RileyLinkServiceState?, rileyLinkError: RileyLinkError? = null) { constructor(rileyLinkServiceState: RileyLinkServiceState?, rileyLinkError: RileyLinkError? = null) {
@ -36,6 +39,15 @@ class EventOmnipodDeviceStatusChange : Event {
this.errorDescription = errorDescription this.errorDescription = errorDescription
} }
constructor(pumpDeviceState: PumpDeviceState?) {
this.pumpDeviceState = pumpDeviceState
}
constructor(pumpDeviceState: PumpDeviceState?, errorDescription: String?) {
this.pumpDeviceState = pumpDeviceState
this.errorDescription = errorDescription
}
override fun toString(): String { override fun toString(): String {
return ("EventOmnipodDeviceStatusChange [" // return ("EventOmnipodDeviceStatusChange [" //
+ "rileyLinkServiceState=" + rileyLinkServiceState + "rileyLinkServiceState=" + rileyLinkServiceState