From e39c222203f3f3e22d276fb94e6d80ec77a953f2 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Tue, 18 Aug 2020 23:47:58 +0200 Subject: [PATCH] Small Dagger improvements --- .../medtronic/comm/MedtronicCommunicationManager.java | 4 ++-- .../pump/medtronic/service/RileyLinkMedtronicService.java | 2 +- .../pump/omnipod/comm/OmnipodCommunicationManager.java | 8 ++------ .../hw/rileylink/RileyLinkCommunicationManager.java | 8 +++----- 4 files changed, 8 insertions(+), 14 deletions(-) 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 b71dec4621..0742cb85c1 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 @@ -74,8 +74,8 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager private boolean doWakeUpBeforeCommand = true; - public MedtronicCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) { - super(injector, rfspy); + public MedtronicCommunicationManager(HasAndroidInjector injector) { + super(injector); medtronicPumpStatus.previousConnection = sp.getLong( RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L); } 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 9013b578f4..a75981d1f2 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 @@ -103,7 +103,7 @@ public class RileyLinkMedtronicService extends RileyLinkService { rfspy.startReader(); // init rileyLinkCommunicationManager - medtronicCommunicationManager = new MedtronicCommunicationManager(injector, rfspy); + medtronicCommunicationManager = new MedtronicCommunicationManager(injector); medtronicUIComm = new MedtronicUIComm(injector, aapsLogger, medtronicUtil, medtronicUIPostprocessor, medtronicCommunicationManager); aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed"); 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 abecf6689b..c75f5f01c5 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 @@ -53,15 +53,11 @@ import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; // TODO make singleton and rename to OmnipodRileyLinkCommunicationManager public class OmnipodCommunicationManager extends RileyLinkCommunicationManager { - @Inject public AAPSLogger aapsLogger; @Inject OmnipodPumpStatus omnipodPumpStatus; - //@Inject OmnipodPumpPlugin omnipodPumpPlugin; - //@Inject RileyLinkServiceData rileyLinkServiceData; - //@Inject ServiceTaskExecutor serviceTaskExecutor; @Inject - public OmnipodCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) { - super(injector, rfspy); + public OmnipodCommunicationManager(HasAndroidInjector injector) { + super(injector); } @Inject 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 60faf2c9aa..54cc23d779 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 @@ -35,26 +35,24 @@ public abstract class RileyLinkCommunicationManager { @Inject protected SP sp; @Inject protected RileyLinkServiceData rileyLinkServiceData; @Inject protected ServiceTaskExecutor serviceTaskExecutor; - + @Inject protected RFSpy rfspy; private final int SCAN_TIMEOUT = 1500; private final int ALLOWED_PUMP_UNREACHABLE = 10 * 60 * 1000; // 10 minutes public final HasAndroidInjector injector; - protected final RFSpy rfspy; + 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; - public RileyLinkCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) { + public RileyLinkCommunicationManager(HasAndroidInjector injector) { this.injector = injector; this.injector.androidInjector().inject(this); - this.rfspy = rfspy; }