- dagger fixes

This commit is contained in:
Andy Rozman 2020-04-27 17:21:46 +01:00
parent 0b8168a62f
commit f23680cee5
7 changed files with 42 additions and 13 deletions

View file

@ -46,6 +46,7 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.AutosensData
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOref1Thread import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobOref1Thread
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobThread import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobThread
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
import info.nightscout.androidaps.plugins.treatments.Treatment import info.nightscout.androidaps.plugins.treatments.Treatment
import info.nightscout.androidaps.queue.CommandQueue import info.nightscout.androidaps.queue.CommandQueue
import info.nightscout.androidaps.queue.commands.* import info.nightscout.androidaps.queue.commands.*
@ -275,6 +276,8 @@ open class AppModule {
@ContributesAndroidInjector fun encryptedPrefsFormatInjector(): EncryptedPrefsFormat @ContributesAndroidInjector fun encryptedPrefsFormatInjector(): EncryptedPrefsFormat
@ContributesAndroidInjector fun classicPrefsFormatInjector(): ClassicPrefsFormat @ContributesAndroidInjector fun classicPrefsFormatInjector(): ClassicPrefsFormat
@ContributesAndroidInjector fun aapsOmnipodManagerInjector(): AapsOmnipodManager
@Binds fun bindContext(mainApp: MainApp): Context @Binds fun bindContext(mainApp: MainApp): Context
@Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector @Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector

View file

@ -35,6 +35,7 @@ import info.nightscout.androidaps.plugins.pump.combo.ComboFragment
import info.nightscout.androidaps.plugins.pump.danaR.DanaRFragment import info.nightscout.androidaps.plugins.pump.danaR.DanaRFragment
import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment import info.nightscout.androidaps.plugins.pump.insight.LocalInsightFragment
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicFragment
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodFragment
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpFragment import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpFragment
import info.nightscout.androidaps.plugins.source.BGSourceFragment import info.nightscout.androidaps.plugins.source.BGSourceFragment
import info.nightscout.androidaps.plugins.treatments.TreatmentsFragment import info.nightscout.androidaps.plugins.treatments.TreatmentsFragment
@ -68,6 +69,7 @@ abstract class FragmentsModule {
@ContributesAndroidInjector abstract fun contributesLoopFragment(): LoopFragment @ContributesAndroidInjector abstract fun contributesLoopFragment(): LoopFragment
@ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment @ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment
@ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment @ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment
@ContributesAndroidInjector abstract fun contributesOmnipodFragment(): OmnipodFragment
@ContributesAndroidInjector abstract fun contributesNSProfileFragment(): NSProfileFragment @ContributesAndroidInjector abstract fun contributesNSProfileFragment(): NSProfileFragment
@ContributesAndroidInjector abstract fun contributesNSClientFragment(): NSClientFragment @ContributesAndroidInjector abstract fun contributesNSClientFragment(): NSClientFragment
@ContributesAndroidInjector abstract fun contributesSmsCommunicatorFragment(): SmsCommunicatorFragment @ContributesAndroidInjector abstract fun contributesSmsCommunicatorFragment(): SmsCommunicatorFragment

View file

@ -15,6 +15,7 @@ import info.nightscout.androidaps.plugins.pump.danaRv2.services.DanaRv2Execution
import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService import info.nightscout.androidaps.plugins.pump.insight.InsightAlertService
import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService import info.nightscout.androidaps.plugins.pump.insight.connection_service.InsightConnectionService
import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService import info.nightscout.androidaps.plugins.pump.medtronic.service.RileyLinkMedtronicService
import info.nightscout.androidaps.plugins.pump.omnipod.service.RileyLinkOmnipodService
import info.nightscout.androidaps.services.AlarmSoundService import info.nightscout.androidaps.services.AlarmSoundService
import info.nightscout.androidaps.services.DataService import info.nightscout.androidaps.services.DataService
import info.nightscout.androidaps.services.LocationService import info.nightscout.androidaps.services.LocationService
@ -39,4 +40,5 @@ abstract class ServicesModule {
@ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService @ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService
@ContributesAndroidInjector abstract fun contributesRileyLinkService(): RileyLinkService @ContributesAndroidInjector abstract fun contributesRileyLinkService(): RileyLinkService
@ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService @ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService
@ContributesAndroidInjector abstract fun contributesRileyLinkOmnipodService(): RileyLinkOmnipodService
} }

View file

@ -59,7 +59,7 @@ class OmnipodFragment : DaggerFragment() {
@Inject lateinit var rxBus: RxBusWrapper @Inject lateinit var rxBus: RxBusWrapper
@Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var activePlugin: ActivePluginProvider @Inject lateinit var activePlugin: ActivePluginProvider
@Inject lateinit var medtronicPumpPlugin: MedtronicPumpPlugin @Inject lateinit var omnipodPumpPlugin: OmnipodPumpPlugin
@Inject lateinit var warnColors: WarnColors @Inject lateinit var warnColors: WarnColors
private var disposable: CompositeDisposable = CompositeDisposable() private var disposable: CompositeDisposable = CompositeDisposable()
@ -370,7 +370,7 @@ class OmnipodFragment : DaggerFragment() {
// GUI functions // GUI functions
fun updateGUI() { fun updateGUI() {
val plugin = OmnipodPumpPlugin.getPlugin() val plugin = omnipodPumpPlugin
val pumpStatus = OmnipodUtil.getPumpStatus() val pumpStatus = OmnipodUtil.getPumpStatus()
var pumpType = OmnipodUtil.getPumpType() var pumpType = OmnipodUtil.getPumpType()

View file

@ -142,6 +142,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
); );
displayConnectionMessages = false; displayConnectionMessages = false;
OmnipodPumpPlugin.plugin = this;
//OmnipodUtil.setDriverState(); //OmnipodUtil.setDriverState();

View file

@ -85,14 +85,13 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.resources.ResourceHelper;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface { public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface {
@Inject AAPSLogger aapsLogger; AAPSLogger aapsLogger;
@Inject RxBusWrapper rxBus; RxBusWrapper rxBus;
@Inject ResourceHelper resourceHelper; ResourceHelper resourceHelper;
@Inject HasAndroidInjector injector; HasAndroidInjector injector;
@Inject ActivePluginProvider activePlugin; ActivePluginProvider activePlugin;
//private static final Logger LOG = LoggerFactory.getLogger(L.PUMP); //private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
private final OmnipodManager delegate; private final OmnipodManager delegate;
@ -107,13 +106,25 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
return instance; return instance;
} }
public AapsOmnipodManager(OmnipodCommunicationService communicationService, PodSessionState podState, OmnipodPumpStatus _pumpStatus) { public AapsOmnipodManager(OmnipodCommunicationService communicationService,
PodSessionState podState,
OmnipodPumpStatus _pumpStatus,
AAPSLogger aapsLogger,
RxBusWrapper rxBus,
ResourceHelper resourceHelper,
HasAndroidInjector injector,
ActivePluginProvider activePlugin) {
this.aapsLogger = aapsLogger;
this.rxBus = rxBus;
this.resourceHelper = resourceHelper;
this.injector = injector;
this.activePlugin = activePlugin;
this.pumpStatus = _pumpStatus;
delegate = new OmnipodManager(communicationService, podState, podSessionState -> { delegate = new OmnipodManager(communicationService, podState, podSessionState -> {
// Handle pod state changes // Handle pod state changes
OmnipodUtil.setPodSessionState(podSessionState); OmnipodUtil.setPodSessionState(podSessionState);
updatePumpStatus(podSessionState); updatePumpStatus(podSessionState);
}); });
this.pumpStatus = _pumpStatus;
instance = this; instance = this;
} }

View file

@ -14,10 +14,13 @@ import org.slf4j.LoggerFactory;
import javax.inject.Inject; import javax.inject.Inject;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
import info.nightscout.androidaps.logging.AAPSLogger; import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.logging.LTag; import info.nightscout.androidaps.logging.LTag;
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCommunicationManager; 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.RileyLinkConst;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
@ -37,6 +40,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager; import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
import info.nightscout.androidaps.utils.resources.ResourceHelper;
import info.nightscout.androidaps.utils.sharedPreferences.SP; import info.nightscout.androidaps.utils.sharedPreferences.SP;
@ -50,6 +54,11 @@ public class RileyLinkOmnipodService extends RileyLinkService {
// @Inject Context context; // @Inject Context context;
@Inject OmnipodPumpPlugin omnipodPumpPlugin; @Inject OmnipodPumpPlugin omnipodPumpPlugin;
// @Inject SP sp; // @Inject SP sp;
@Inject RxBusWrapper rxBus;
@Inject ActivePluginProvider activePlugin;
@Inject HasAndroidInjector injector;
@Inject ResourceHelper resourceHelper;
//private static final Logger LOG = LoggerFactory.getLogger(L.PUMPCOMM); //private static final Logger LOG = LoggerFactory.getLogger(L.PUMPCOMM);
@ -122,7 +131,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
if (isLogEnabled()) if (isLogEnabled())
aapsLogger.debug(LTag.PUMPCOMM,"RileyLinkOmnipodService newly constructed"); aapsLogger.debug(LTag.PUMPCOMM,"RileyLinkOmnipodService newly constructed");
OmnipodUtil.setOmnipodService(this); OmnipodUtil.setOmnipodService(this);
pumpStatus = (OmnipodPumpStatus) OmnipodPumpPlugin.getPlugin().getPumpStatusData(); pumpStatus = (OmnipodPumpStatus) omnipodPumpPlugin.getPumpStatusData();
//aapsLogger.debug(LTag.PUMPCOMM,"RRRRRRRRRR: " + pumpStatus); //aapsLogger.debug(LTag.PUMPCOMM,"RRRRRRRRRR: " + pumpStatus);
} }
@ -143,7 +152,8 @@ public class RileyLinkOmnipodService extends RileyLinkService {
OmnipodCommunicationService omnipodCommunicationService = new OmnipodCommunicationService(rfspy); OmnipodCommunicationService omnipodCommunicationService = new OmnipodCommunicationService(rfspy);
omnipodCommunicationService.setPumpStatus(pumpStatus); omnipodCommunicationService.setPumpStatus(pumpStatus);
omnipodCommunicationManager = new AapsOmnipodManager(omnipodCommunicationService, podState, pumpStatus); omnipodCommunicationManager = new AapsOmnipodManager(omnipodCommunicationService, podState, pumpStatus,
aapsLogger, rxBus, resourceHelper, injector, activePlugin);
} else { } else {
omnipodCommunicationManager = AapsOmnipodManager.getInstance(); omnipodCommunicationManager = AapsOmnipodManager.getInstance();
} }