From 5d426bf697b792bd72179164b0040709ce4e9b1c Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 21 Aug 2020 21:16:24 +0200 Subject: [PATCH 1/5] Add some methods to RileyLinkPumpDevice interface to replace access to PumpStatus in RileyLink module --- .../plugins/pump/common/data/PumpStatus.java | 17 ---- .../pump/medtronic/MedtronicPumpPlugin.java | 41 +++++----- .../comm/MedtronicCommunicationManager.java | 4 - .../medtronic/driver/MedtronicPumpStatus.java | 21 ----- .../service/RileyLinkMedtronicService.java | 1 + .../pump/omnipod/OmnipodPumpPlugin.java | 38 +++++---- .../comm/OmnipodCommunicationManager.java | 9 --- .../pump/omnipod/defs/PodResponseType.java | 6 +- .../omnipod/driver/OmnipodPumpStatus.java | 19 ----- .../pump/omnipod/driver/ui/OmnipodUITask.java | 6 +- .../service/RileyLinkOmnipodService.java | 1 + .../dialog/RileyLinkBLEScanActivity.java | 21 +---- .../RileyLinkCommunicationManager.java | 22 +++--- .../rileylink/defs/RileyLinkPumpDevice.java | 15 ++-- .../hw/rileylink/defs/RileyLinkPumpInfo.java | 31 ++++++++ .../rileylink/defs/RileyLinkTargetDevice.java | 3 - .../RileyLinkStatusGeneralFragment.java | 77 ++++--------------- .../rileylink/service/RileyLinkService.java | 5 -- .../tasks/DiscoverGattServicesTask.java | 2 - .../tasks/InitializePumpManagerTask.java | 1 - .../ResetRileyLinkConfigurationTask.java | 18 ++--- .../service/tasks/WakeAndTuneTask.java | 16 +--- rileylink/src/main/res/values/strings.xml | 12 --- 23 files changed, 125 insertions(+), 261 deletions(-) create mode 100644 rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpInfo.java diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java index 08c8e60d56..bd30efd423 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/data/PumpStatus.java @@ -19,8 +19,6 @@ public abstract class PumpStatus { public long previousConnection = 0L; // here should be stored last connection of previous session (so needs to be // read before lastConnection is modified for first time). - public long lastErrorConnection = 0L; - // last bolus public Date lastBolusTime; public Double lastBolusAmount; @@ -63,26 +61,11 @@ public abstract class PumpStatus { public abstract void initSettings(); - public void setLastCommunicationToNow() { this.lastDataTime = DateUtil.now(); this.lastConnection = System.currentTimeMillis(); } - - public void setLastFailedCommunicationToNow() { - this.lastErrorConnection = System.currentTimeMillis(); - } - - public abstract String getErrorInfo(); - - public abstract E getCustomData(String key, Class clazz); - - public String getCustomDataAsString(String key) { - return getCustomData(key, String.class); - } - - } diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java index 8363250cd5..ee58a61b6b 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java @@ -36,7 +36,6 @@ import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.TemporaryBasal; - import info.nightscout.androidaps.events.EventRefreshOverview; import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.interfaces.CommandQueueProvider; @@ -55,9 +54,11 @@ import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract; import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus; import info.nightscout.androidaps.plugins.pump.common.defs.PumpDriverState; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; +import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask; @@ -81,7 +82,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicUIRespons import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus; import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged; import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged; -import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState; import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil; @@ -236,21 +236,6 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter } - @Override - public void resetRileyLinkConfiguration() { - rileyLinkMedtronicService.resetRileyLinkConfiguration(); - } - - @Override - public boolean hasTuneUp() { - return true; - } - - @Override - public void doTuneUpDevice() { - rileyLinkMedtronicService.doTuneUpDevice(); - } - @Override public void triggerPumpConfigurationChangedEvent() { rxBus.send(new EventMedtronicPumpConfigurationChanged()); @@ -339,6 +324,22 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter return rileyLinkMedtronicService; } + @Override public RileyLinkPumpInfo getPumpInfo() { + String pumpDescription = pumpType.getDescription(); + String frequency = resourceHelper.gs(medtronicPumpStatus.pumpFrequency.equals("medtronic_pump_frequency_us_ca") ? R.string.medtronic_pump_frequency_us_ca : R.string.medtronic_pump_frequency_worldwide); + String model = medtronicPumpStatus.medtronicDeviceType == null ? "???" : "Medtronic " + medtronicPumpStatus.medtronicDeviceType.getPumpModel(); + String serialNumber = medtronicPumpStatus.serialNumber; + return new RileyLinkPumpInfo(pumpDescription, frequency, model, serialNumber); + } + + @Override public long getLastConnectionTimeMillis() { + return medtronicPumpStatus.lastConnection; + } + + @Override public void setLastCommunicationToNow() { + medtronicPumpStatus.setLastCommunicationToNow(); + } + @Override public boolean isInitialized() { if (displayConnectionMessages) @@ -348,8 +349,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter @Override - public void setIsBusy(boolean isBusy_) { - isBusy = isBusy_; + public void setBusy(boolean busy) { + isBusy = busy; } @Override @@ -774,7 +775,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter if ((clock.localDeviceTime.getYear() <= 2015) || (timeDiff <= 24 * 60 * 60)) { - aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Set time on pump." , timeDiff); + aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::checkTimeAndOptionallySetTime - Time difference is {} s. Set time on pump.", timeDiff); rileyLinkMedtronicService.getMedtronicUIComm().executeCommand(MedtronicCommandType.SetRealTimeClock); diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java index 0a0fb98e22..3c1c4b35e1 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/comm/MedtronicCommunicationManager.java @@ -916,8 +916,4 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager return false; } - - @Override public PumpStatus getPumpStatus() { - return medtronicPumpStatus; - } } diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java index 1dcf799a2e..9d9a86b735 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/driver/MedtronicPumpStatus.java @@ -165,27 +165,6 @@ public class MedtronicPumpStatus extends info.nightscout.androidaps.plugins.pump return (errorDescription == null) ? "-" : errorDescription; } - @Override - public E getCustomData(String key, Class clazz) { - switch(key) { - case "SERIAL_NUMBER": - return (E)serialNumber; - - case "PUMP_FREQUENCY": - return (E)pumpFrequency; - - case "PUMP_MODEL": { - if (medtronicDeviceType==null) - return null; - else - return (E)medtronicDeviceType.getPumpModel(); - } - - - default: - return null; - } - } public PumpDeviceState getPumpDeviceState() { return pumpDeviceState; diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java index 636d138a6f..b40f9389b5 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java @@ -29,6 +29,7 @@ import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIPost import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData; import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType; import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus; +import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil; diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index e82d8aeffc..e9c4c4af0f 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -49,8 +49,10 @@ import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract; import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus; import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; +import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor; @@ -339,24 +341,10 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump return false; } - @Override - public void resetRileyLinkConfiguration() { - rileyLinkOmnipodService.resetRileyLinkConfiguration(); - } - - @Override - public boolean hasTuneUp() { - return false; - } - - @Override - public void doTuneUpDevice() { - //rileyLinkOmnipodService.doTuneUpDevice(); - } - @Override public void triggerPumpConfigurationChangedEvent() { rxBus.send(new EventOmnipodPumpValuesChanged()); + rxBus.send(new EventRileyLinkDeviceStatusChange()); } @Override @@ -364,6 +352,22 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump return rileyLinkOmnipodService; } + @Override public RileyLinkPumpInfo getPumpInfo() { + String pumpDescription = "Eros"; + String frequency = resourceHelper.gs(R.string.omnipod_frequency); + String connectedModel = podStateManager.isPodInitialized() ? "Eros Pod" : "-"; + String serialNumber = podStateManager.isPodInitialized() ? String.valueOf(podStateManager.getAddress()) : "-"; + return new RileyLinkPumpInfo(connectedModel, pumpDescription, serialNumber, frequency); + } + + @Override public long getLastConnectionTimeMillis() { + return omnipodPumpStatus.lastConnection; + } + + @Override public void setLastCommunicationToNow() { + omnipodPumpStatus.setLastCommunicationToNow(); + } + public OmnipodUIComm getDeviceCommandExecutor() { return rileyLinkOmnipodService.getDeviceCommandExecutor(); } @@ -478,8 +482,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump } } - public void setIsBusy(boolean isBusy) { - this.isBusy = isBusy; + public void setBusy(boolean busy) { + this.isBusy = busy; } private void getPodPumpStatus() { diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java index 48cd74016c..ae8538cd3e 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodCommunicationManager.java @@ -81,19 +81,10 @@ public class OmnipodCommunicationManager extends RileyLinkCommunicationManager { return new byte[0]; } - @Override public PumpStatus getPumpStatus() { - return null; - } - @Override public boolean isDeviceReachable() { return false; } - @Override - public boolean hasTunning() { - return false; - } - @Override public RLMessage createResponseMessage(byte[] payload) { return new OmnipodPacket(payload); diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodResponseType.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodResponseType.java index 7314ae9591..ef65ae8d96 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodResponseType.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/defs/PodResponseType.java @@ -5,5 +5,9 @@ public enum PodResponseType { Acknowledgment, // set commands would just acknowledge if data was sent Data, // query commands would return data Error, // communication/response produced an error - Invalid // invalid response (not supported, should never be returned) + Invalid; // invalid response (not supported, should never be returned) + + public boolean isError() { + return this == Error || this == Invalid; + } } diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java index c7d9f24da1..f1c0474829 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/OmnipodPumpStatus.java @@ -80,25 +80,6 @@ public class OmnipodPumpStatus extends PumpStatus { return this.rileyLinkErrorDescription; } - @Override - public E getCustomData(String key, Class clazz) { - switch (key) { - // TODO - /* - case "POD_LOT_NUMBER": - return (E) podLotNumber; - - case "POD_AVAILABLE": - return (E) podAvailable; - */ - - default: - return null; - } - - } - - // public boolean setNotInPreInit() { // this.inPreInit = false; // diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java index a059596cd6..140f1de335 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java @@ -200,11 +200,7 @@ public class OmnipodUITask { aapsLogger.debug(LTag.PUMP, "OmnipodUITask: @@@ postProcess. responseType={}", responseType); - if (responseType == PodResponseType.Invalid) { - omnipodPumpStatus.setLastFailedCommunicationToNow(); - } else if (responseType == PodResponseType.Error) { - omnipodPumpStatus.setLastFailedCommunicationToNow(); - } else { + if (!responseType.isError()) { omnipodPumpStatus.setLastCommunicationToNow(); } } diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java index 58e35dd8fd..4f0e1150d7 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java @@ -12,6 +12,7 @@ import javax.inject.Inject; import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState; +import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java index fc7c868fc7..4c48e4181f 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java @@ -24,7 +24,6 @@ import android.widget.Toast; import androidx.appcompat.widget.Toolbar; - import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; @@ -35,16 +34,12 @@ import java.util.Map; import javax.inject.Inject; - import info.nightscout.androidaps.activities.NoSplashAppCompatActivity; import info.nightscout.androidaps.interfaces.ActivePluginProvider; -import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; -import info.nightscout.androidaps.plugins.common.ManufacturerType; import info.nightscout.androidaps.plugins.pump.common.R; import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck; -import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.GattAttributes; @@ -110,20 +105,8 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity { sp.putString(RileyLinkConst.Prefs.RileyLinkAddress, bleAddress); - PumpInterface activePump = activePlugin.getActivePump(); - - if (activePump.manufacturer() == ManufacturerType.Medtronic) { - RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePump; - rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address - - rileyLinkPump.triggerPumpConfigurationChangedEvent(); - - } else if (activePlugin.getActivePump().manufacturer() == ManufacturerType.Insulet) { - RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePump; - rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address - - rileyLinkPump.triggerPumpConfigurationChangedEvent(); - } + RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePlugin.getActivePump(); + rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address finish(); }); diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java index 729ecf9f1a..3d7acfc167 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/RileyLinkCommunicationManager.java @@ -3,9 +3,9 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink; import javax.inject.Inject; import dagger.android.HasAndroidInjector; +import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; -import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus; import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkCommunicationException; @@ -17,6 +17,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.Radi import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.data.RadioResponse; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RLMessageType; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkBLEError; +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.WakeAndTuneTask; @@ -37,6 +38,7 @@ public abstract class RileyLinkCommunicationManager { @Inject protected ServiceTaskExecutor serviceTaskExecutor; @Inject protected RFSpy rfspy; @Inject protected HasAndroidInjector injector; + @Inject protected ActivePluginProvider activePluginProvider; private final int SCAN_TIMEOUT = 1500; private final int ALLOWED_PUMP_UNREACHABLE = 10 * 60 * 1000; // 10 minutes @@ -44,7 +46,6 @@ public abstract class RileyLinkCommunicationManager { protected int receiverDeviceAwakeForMinutes = 1; // override this in constructor of specific implementation protected String receiverDeviceID; // String representation of receiver device (ex. Pump (xxxxxx) or Pod (yyyyyy)) protected long lastGoodReceiverCommunicationTime = 0; - // protected PumpStatus pumpStatus; private long nextWakeUpRequired = 0L; private int timeoutCount = 0; @@ -89,10 +90,10 @@ public abstract class RileyLinkCommunicationManager { rfSpyResponse.wasTimeout(), rfSpyResponse.isUnknownCommand(), rfSpyResponse.isInvalidParam()); if (rfSpyResponse.wasTimeout()) { - if (hasTunning()) { + if (rileyLinkServiceData.targetDevice.isTuneUpEnabled()) { timeoutCount++; - long diff = System.currentTimeMillis() - getPumpStatus().lastConnection; + long diff = System.currentTimeMillis() - getPumpDevice().getLastConnectionTimeMillis(); if (diff > ALLOWED_PUMP_UNREACHABLE) { aapsLogger.warn(LTag.PUMPCOMM, "We reached max time that Pump can be unreachable. Starting Tuning."); @@ -130,10 +131,6 @@ public abstract class RileyLinkCommunicationManager { return rfspy != null ? rfspy.notConnectedCount : 0; } - public boolean hasTunning() { - return true; - } - // FIXME change wakeup // TODO we might need to fix this. Maybe make pump awake for shorter time (battery factor for pump) - Andy @@ -404,11 +401,8 @@ public abstract class RileyLinkCommunicationManager { lastGoodReceiverCommunicationTime = System.currentTimeMillis(); sp.putLong(RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, lastGoodReceiverCommunicationTime); - PumpStatus pumpStatus = getPumpStatus(); - if(pumpStatus != null) { - pumpStatus.setLastCommunicationToNow(); - } + getPumpDevice().setLastCommunicationToNow(); } @@ -429,7 +423,9 @@ public abstract class RileyLinkCommunicationManager { } } - public abstract PumpStatus getPumpStatus(); + private RileyLinkPumpDevice getPumpDevice() { + return (RileyLinkPumpDevice) activePluginProvider.getActivePump(); + } public abstract boolean isDeviceReachable(); } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java index 71c2b5d20a..996eb5a358 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpDevice.java @@ -4,18 +4,15 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley public interface RileyLinkPumpDevice { - void setIsBusy(boolean isBusy_); - - boolean isBusy(); - - void resetRileyLinkConfiguration(); - - boolean hasTuneUp(); - - void doTuneUpDevice(); + void setBusy(boolean busy); void triggerPumpConfigurationChangedEvent(); RileyLinkService getRileyLinkService(); + RileyLinkPumpInfo getPumpInfo(); + + long getLastConnectionTimeMillis(); + + void setLastCommunicationToNow(); } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpInfo.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpInfo.java new file mode 100644 index 0000000000..9759a9adc7 --- /dev/null +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkPumpInfo.java @@ -0,0 +1,31 @@ +package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs; + +public class RileyLinkPumpInfo { + private final String connectedDeviceModel; + private final String pumpDescription; + private final String connectedDeviceSerialNumber; + private final String pumpFrequency; + + public RileyLinkPumpInfo(String pumpDescription, String pumpFrequency, String connectedDeviceModel, String connectedDeviceSerialNumber) { + this.pumpDescription = pumpDescription; + this.pumpFrequency = pumpFrequency; + this.connectedDeviceModel = connectedDeviceModel; + this.connectedDeviceSerialNumber = connectedDeviceSerialNumber; + } + + public String getConnectedDeviceModel() { + return connectedDeviceModel; + } + + public String getPumpDescription() { + return pumpDescription; + } + + public String getConnectedDeviceSerialNumber() { + return connectedDeviceSerialNumber; + } + + public String getPumpFrequency() { + return pumpFrequency; + } +} diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkTargetDevice.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkTargetDevice.java index 99b4ecd40a..8934ae555b 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkTargetDevice.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/defs/RileyLinkTargetDevice.java @@ -15,18 +15,15 @@ public enum RileyLinkTargetDevice { private int resourceId; private boolean tuneUpEnabled; - RileyLinkTargetDevice(int resourceId, boolean tuneUpEnabled) { this.resourceId = resourceId; this.tuneUpEnabled = tuneUpEnabled; } - public boolean isTuneUpEnabled() { return tuneUpEnabled; } - public int getResourceId() { return resourceId; } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java index 49094c3bcc..42f303b3cf 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/dialog/RileyLinkStatusGeneralFragment.java @@ -15,13 +15,11 @@ import javax.inject.Inject; import dagger.android.support.DaggerFragment; import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.logging.AAPSLogger; -import info.nightscout.androidaps.plugins.common.ManufacturerType; -import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract; import info.nightscout.androidaps.plugins.pump.common.R; -import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus; -import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.dialog.RefreshableInterface; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion; +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData; import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil; @@ -121,65 +119,24 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re } - PumpPluginAbstract pumpPlugin = (PumpPluginAbstract) activePlugin.getActivePump(); + RileyLinkPumpDevice pumpPlugin = (RileyLinkPumpDevice) activePlugin.getActivePump(); + RileyLinkPumpInfo pumpInfo = pumpPlugin.getPumpInfo(); + this.deviceType.setText(rileyLinkServiceData.targetDevice.getResourceId()); + this.deviceModel.setText(pumpInfo.getPumpDescription()); + this.serialNumber.setText(pumpInfo.getConnectedDeviceSerialNumber()); + this.pumpFrequency.setText(pumpInfo.getPumpFrequency()); + this.connectedDevice.setText(pumpInfo.getConnectedDeviceModel()); - if (pumpPlugin.manufacturer() == ManufacturerType.Medtronic) { - //MedtronicPumpStatus medtronicPumpStatus = (MedtronicPumpStatus)pumpPlugin.getPumpStatusData(); + if (rileyLinkServiceData.lastGoodFrequency != null) { + this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz", + rileyLinkServiceData.lastGoodFrequency)); + } - PumpStatus pumpStatusData = pumpPlugin.getPumpStatusData(); - - this.deviceType.setText(resourceHelper.gs(RileyLinkTargetDevice.MedtronicPump.getResourceId())); - this.deviceModel.setText(pumpPlugin.getPumpType().getDescription()); - this.serialNumber.setText(pumpStatusData.getCustomDataAsString("SERIAL_NUMBER")); // medtronicPumpStatus.serialNumber); - this.pumpFrequency.setText(resourceHelper.gs(pumpStatusData.getCustomDataAsString("PUMP_FREQUENCY").equals("medtronic_pump_frequency_us_ca") ? R.string.medtronic_pump_frequency_us_ca : R.string.medtronic_pump_frequency_worldwide)); - - if (pumpStatusData.getCustomDataAsString("PUMP_MODEL") != null) - this.connectedDevice.setText("Medtronic " + pumpStatusData.getCustomDataAsString("PUMP_MODEL")); - else - this.connectedDevice.setText("???"); - - if (rileyLinkServiceData.lastGoodFrequency != null) - this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz", - rileyLinkServiceData.lastGoodFrequency)); - - if (pumpStatusData.lastConnection != 0) - this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime( - pumpStatusData.lastDataTime))); - else - this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never)); + long lastConnectionTimeMillis = pumpPlugin.getLastConnectionTimeMillis(); + if (lastConnectionTimeMillis == 0) { + this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never)); } else { - - //OmnipodPumpStatus omnipodPumpStatus = (OmnipodPumpStatus)pumpPlugin.getPumpStatusData(); - PumpStatus pumpStatusData = pumpPlugin.getPumpStatusData(); - - this.deviceType.setText(resourceHelper.gs(RileyLinkTargetDevice.Omnipod.getResourceId())); - this.deviceModel.setText("Eros"); - - this.pumpFrequency.setText(resourceHelper.gs(R.string.omnipod_frequency)); - - if (pumpStatusData != null) { - - // TODO show info about active Pod - /* - if (pumpStatusData.getCustomData("POD_AVAILABLE", Boolean.class)) { - this.serialNumber.setText(pumpStatusData.getCustomDataAsString("POD_LOT_NUMBER")); - this.connectedDevice.setText(pumpStatusData.pumpType == PumpType.Insulet_Omnipod ? "Eros Pod" : "Dash Pod"); - } else { - this.serialNumber.setText("??"); - this.connectedDevice.setText("-"); - } - */ - - if (rileyLinkServiceData.lastGoodFrequency != null) - this.lastUsedFrequency.setText(String.format(Locale.ENGLISH, "%.2f MHz", - rileyLinkServiceData.lastGoodFrequency)); - - if (pumpStatusData.lastConnection != 0) - this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime( - pumpStatusData.lastDataTime))); - else - this.lastDeviceContact.setText(resourceHelper.gs(R.string.common_never)); - } + this.lastDeviceContact.setText(StringUtil.toDateTimeString(dateUtil, new LocalDateTime(lastConnectionTimeMillis))); } } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java index 986bbf4d9d..0df109268d 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java @@ -3,7 +3,6 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service; import android.bluetooth.BluetoothAdapter; import android.content.Context; import android.content.Intent; -import android.content.IntentFilter; import org.jetbrains.annotations.NotNull; @@ -185,13 +184,9 @@ public abstract class RileyLinkService extends DaggerService { } } - public void sendServiceTransportResponse(ServiceTransport transport, ServiceResult serviceResult) { } - - - // FIXME: This needs to be run in a session so that is interruptable, has a separate thread, etc. public void doTuneUpDevice() { diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java index b958ad9a1f..74396ec4a1 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java @@ -5,8 +5,6 @@ import javax.inject.Inject; import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.logging.AAPSLogger; -import info.nightscout.androidaps.logging.LTag; -import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; /** diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java index 73aab9c4f9..70e6440f0f 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/InitializePumpManagerTask.java @@ -9,7 +9,6 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.common.ManufacturerType; -import info.nightscout.androidaps.plugins.pump.common.PumpPluginAbstract; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java index 3263253e5e..da8db8fee4 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/ResetRileyLinkConfigurationTask.java @@ -6,8 +6,8 @@ import dagger.android.HasAndroidInjector; import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState; +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport; /** * Created by andy on 9/16/18. @@ -16,29 +16,23 @@ public class ResetRileyLinkConfigurationTask extends PumpTask { @Inject ActivePluginProvider activePlugin; @Inject RxBusWrapper rxBus; + @Inject RFSpy rfSpy; public ResetRileyLinkConfigurationTask(HasAndroidInjector injector) { super(injector); } - - public ResetRileyLinkConfigurationTask(HasAndroidInjector injector, ServiceTransport transport) { - super(injector, transport); - } - - @Override public void run() { - RileyLinkPumpDevice pumpAbstract = (RileyLinkPumpDevice) activePlugin.getActivePump(); + RileyLinkPumpDevice rileyLinkPumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump(); rxBus.send(new EventRefreshButtonState(false)); - pumpAbstract.setIsBusy(true); - pumpAbstract.resetRileyLinkConfiguration(); - pumpAbstract.setIsBusy(false); + rileyLinkPumpDevice.setBusy(true); + rfSpy.resetRileyLinkConfiguration(); + rileyLinkPumpDevice.setBusy(false); rxBus.send(new EventRefreshButtonState(true)); } - } diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java index d3011eede2..0411903fe2 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/WakeAndTuneTask.java @@ -7,7 +7,6 @@ import info.nightscout.androidaps.interfaces.ActivePluginProvider; import info.nightscout.androidaps.plugins.bus.RxBusWrapper; import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.data.ServiceTransport; /** * Created by geoff on 7/16/16. @@ -19,24 +18,17 @@ public class WakeAndTuneTask extends PumpTask { private static final String TAG = "WakeAndTuneTask"; - public WakeAndTuneTask(HasAndroidInjector injector) { super(injector); } - - public WakeAndTuneTask(HasAndroidInjector injector, ServiceTransport transport) { - super(injector, transport); - } - - @Override public void run() { - RileyLinkPumpDevice pumpDevice = (RileyLinkPumpDevice)activePlugin.getActivePump(); + RileyLinkPumpDevice pumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump(); rxBus.send(new EventRefreshButtonState(false)); - pumpDevice.setIsBusy(true); - pumpDevice.doTuneUpDevice(); - pumpDevice.setIsBusy(false); + pumpDevice.setBusy(true); + pumpDevice.getRileyLinkService().doTuneUpDevice(); + pumpDevice.setBusy(false); rxBus.send(new EventRefreshButtonState(true)); } } diff --git a/rileylink/src/main/res/values/strings.xml b/rileylink/src/main/res/values/strings.xml index 8e7445464b..8f4d134211 100644 --- a/rileylink/src/main/res/values/strings.xml +++ b/rileylink/src/main/res/values/strings.xml @@ -57,11 +57,6 @@ Medtronic Pump Omnipod - - Omnipod (433.91 MHz) - US & Canada (916 MHz) - Worldwide (868 Mhz) - medtronic_pump_encoding_4b6b_local medtronic_pump_encoding_4b6b_rileylink @@ -70,9 +65,6 @@ %1$.1f %2$s (%3$s) - - - %1$d day %1$d days @@ -81,10 +73,6 @@ %1$d hour %1$d hours - - - - \ No newline at end of file From ea1be41a0df20ef24c0aebf1cccba8914d08aac0 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 21 Aug 2020 21:27:51 +0200 Subject: [PATCH 2/5] Restore accidentally removed statement --- .../plugins/pump/common/dialog/RileyLinkBLEScanActivity.java | 1 + 1 file changed, 1 insertion(+) diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java index 4c48e4181f..4f4d13e287 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/dialog/RileyLinkBLEScanActivity.java @@ -107,6 +107,7 @@ public class RileyLinkBLEScanActivity extends NoSplashAppCompatActivity { RileyLinkPumpDevice rileyLinkPump = (RileyLinkPumpDevice) activePlugin.getActivePump(); rileyLinkPump.getRileyLinkService().verifyConfiguration(); // force reloading of address + rileyLinkPump.triggerPumpConfigurationChangedEvent(); finish(); }); From 28f1dbb47fd92afc7aa1f391793a51f8cbb6593e Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 21 Aug 2020 22:28:42 +0200 Subject: [PATCH 3/5] Correctly display Omnipod information in RL stats --- .../androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index e9c4c4af0f..1b4aa096d1 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -357,7 +357,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump String frequency = resourceHelper.gs(R.string.omnipod_frequency); String connectedModel = podStateManager.isPodInitialized() ? "Eros Pod" : "-"; String serialNumber = podStateManager.isPodInitialized() ? String.valueOf(podStateManager.getAddress()) : "-"; - return new RileyLinkPumpInfo(connectedModel, pumpDescription, serialNumber, frequency); + return new RileyLinkPumpInfo(pumpDescription, frequency, connectedModel, serialNumber); } @Override public long getLastConnectionTimeMillis() { From 883bdb660e8af0c7095f2f1d14931bd5055270e1 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 21 Aug 2020 22:38:24 +0200 Subject: [PATCH 4/5] Remove unused import --- .../plugins/pump/omnipod/service/RileyLinkOmnipodService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java index 4f0e1150d7..58e35dd8fd 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java @@ -12,7 +12,6 @@ import javax.inject.Inject; import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState; -import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType; From 5b6ba9ea6d94e7d248abefd4d92b6eecf7512b5a Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 21 Aug 2020 22:52:35 +0200 Subject: [PATCH 5/5] Remove unused methods --- .../medtronic/service/RileyLinkMedtronicService.java | 11 ----------- .../pump/omnipod/service/RileyLinkOmnipodService.java | 4 ---- .../common/hw/rileylink/service/RileyLinkService.java | 3 --- 3 files changed, 18 deletions(-) diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java index b40f9389b5..b2bcc6c5d4 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/service/RileyLinkMedtronicService.java @@ -1,7 +1,6 @@ package info.nightscout.androidaps.plugins.pump.medtronic.service; import android.content.Intent; -import android.content.IntentFilter; import android.content.res.Configuration; import android.os.Binder; import android.os.IBinder; @@ -14,10 +13,8 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpDeviceState; import info.nightscout.androidaps.plugins.pump.common.defs.PumpType; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkConst; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency; -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.service.RileyLinkService; import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; @@ -26,10 +23,8 @@ import info.nightscout.androidaps.plugins.pump.medtronic.R; import info.nightscout.androidaps.plugins.pump.medtronic.comm.MedtronicCommunicationManager; import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIComm; import info.nightscout.androidaps.plugins.pump.medtronic.comm.ui.MedtronicUIPostprocessor; -import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData; import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType; import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus; -import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst; import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil; @@ -111,12 +106,6 @@ public class RileyLinkMedtronicService extends RileyLinkService { aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed"); } - - public void resetRileyLinkConfiguration() { - rfspy.resetRileyLinkConfiguration(); - } - - public MedtronicCommunicationManager getDeviceCommunicationManager() { return this.medtronicCommunicationManager; } diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java index 58e35dd8fd..90612bc815 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java @@ -103,10 +103,6 @@ public class RileyLinkOmnipodService extends RileyLinkService { return this.omnipodUIComm; } - public void resetRileyLinkConfiguration() { - rfspy.resetRileyLinkConfiguration(); - } - @Override public RileyLinkCommunicationManager getDeviceCommunicationManager() { return omnipodCommunicationManager; diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java index 0df109268d..0e340918c8 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/RileyLinkService.java @@ -184,9 +184,6 @@ public abstract class RileyLinkService extends DaggerService { } } - public void sendServiceTransportResponse(ServiceTransport transport, ServiceResult serviceResult) { - } - // FIXME: This needs to be run in a session so that is interruptable, has a separate thread, etc. public void doTuneUpDevice() {