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;
public MedtronicCommunicationManager(HasAndroidInjector injector, RFSpy rfspy) {
super(injector, rfspy);
public MedtronicCommunicationManager(HasAndroidInjector injector) {
super(injector);
medtronicPumpStatus.previousConnection = sp.getLong(
RileyLinkConst.Prefs.LastGoodDeviceCommunicationTime, 0L);
}

View file

@ -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");

View file

@ -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

View file

@ -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;
}