Small Dagger improvements

This commit is contained in:
Bart Sopers 2020-08-18 23:47:58 +02:00
parent 963f0ca851
commit e39c222203
4 changed files with 8 additions and 14 deletions

View file

@ -74,8 +74,8 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
private boolean doWakeUpBeforeCommand = true; private boolean doWakeUpBeforeCommand = true;
public MedtronicCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) { public MedtronicCommunicationManager(HasAndroidInjector injector) {
super(injector, rfspy); super(injector);
medtronicPumpStatus.previousConnection = sp.getLong( medtronicPumpStatus.previousConnection = sp.getLong(
RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L); RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L);
} }

View file

@ -103,7 +103,7 @@ public class RileyLinkMedtronicService extends RileyLinkService {
rfspy.startReader(); rfspy.startReader();
// init rileyLinkCommunicationManager // init rileyLinkCommunicationManager
medtronicCommunicationManager = new MedtronicCommunicationManager(injector, rfspy); medtronicCommunicationManager = new MedtronicCommunicationManager(injector);
medtronicUIComm = new MedtronicUIComm(injector, aapsLogger, medtronicUtil, medtronicUIPostprocessor, medtronicCommunicationManager); medtronicUIComm = new MedtronicUIComm(injector, aapsLogger, medtronicUtil, medtronicUIPostprocessor, medtronicCommunicationManager);
aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed"); aapsLogger.debug(LTag.PUMPCOMM, "RileyLinkMedtronicService newly constructed");

View file

@ -53,15 +53,11 @@ import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
// TODO make singleton and rename to OmnipodRileyLinkCommunicationManager // TODO make singleton and rename to OmnipodRileyLinkCommunicationManager
public class OmnipodCommunicationManager extends RileyLinkCommunicationManager { public class OmnipodCommunicationManager extends RileyLinkCommunicationManager {
@Inject public AAPSLogger aapsLogger;
@Inject OmnipodPumpStatus omnipodPumpStatus; @Inject OmnipodPumpStatus omnipodPumpStatus;
//@Inject OmnipodPumpPlugin omnipodPumpPlugin;
//@Inject RileyLinkServiceData rileyLinkServiceData;
//@Inject ServiceTaskExecutor serviceTaskExecutor;
@Inject @Inject
public OmnipodCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) { public OmnipodCommunicationManager(HasAndroidInjector injector) {
super(injector, rfspy); super(injector);
} }
@Inject @Inject

View file

@ -35,26 +35,24 @@ public abstract class RileyLinkCommunicationManager {
@Inject protected SP sp; @Inject protected SP sp;
@Inject protected RileyLinkServiceData rileyLinkServiceData; @Inject protected RileyLinkServiceData rileyLinkServiceData;
@Inject protected ServiceTaskExecutor serviceTaskExecutor; @Inject protected ServiceTaskExecutor serviceTaskExecutor;
@Inject protected RFSpy rfspy;
private final int SCAN_TIMEOUT = 1500; private final int SCAN_TIMEOUT = 1500;
private final int ALLOWED_PUMP_UNREACHABLE = 10 * 60 * 1000; // 10 minutes private final int ALLOWED_PUMP_UNREACHABLE = 10 * 60 * 1000; // 10 minutes
public final HasAndroidInjector injector; public final HasAndroidInjector injector;
protected final RFSpy rfspy;
protected int receiverDeviceAwakeForMinutes = 1; // override this in constructor of specific implementation 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 String receiverDeviceID; // String representation of receiver device (ex. Pump (xxxxxx) or Pod (yyyyyy))
protected long lastGoodReceiverCommunicationTime = 0; protected long lastGoodReceiverCommunicationTime = 0;
// protected PumpStatus pumpStatus; // protected PumpStatus pumpStatus;
private long nextWakeUpRequired = 0L; private long nextWakeUpRequired = 0L;
private int timeoutCount = 0; private int timeoutCount = 0;
public RileyLinkCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) { public RileyLinkCommunicationManager(HasAndroidInjector injector) {
this.injector = injector; this.injector = injector;
this.injector.androidInjector().inject(this); this.injector.androidInjector().inject(this);
this.rfspy = rfspy;
} }