- dagger fixes
This commit is contained in:
parent
0b8168a62f
commit
f23680cee5
7 changed files with 42 additions and 13 deletions
|
@ -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.IobCobOref1Thread
|
||||
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.queue.CommandQueue
|
||||
import info.nightscout.androidaps.queue.commands.*
|
||||
|
@ -275,6 +276,8 @@ open class AppModule {
|
|||
@ContributesAndroidInjector fun encryptedPrefsFormatInjector(): EncryptedPrefsFormat
|
||||
@ContributesAndroidInjector fun classicPrefsFormatInjector(): ClassicPrefsFormat
|
||||
|
||||
@ContributesAndroidInjector fun aapsOmnipodManagerInjector(): AapsOmnipodManager
|
||||
|
||||
@Binds fun bindContext(mainApp: MainApp): Context
|
||||
@Binds fun bindInjector(mainApp: MainApp): HasAndroidInjector
|
||||
|
||||
|
|
|
@ -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.insight.LocalInsightFragment
|
||||
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.source.BGSourceFragment
|
||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsFragment
|
||||
|
@ -68,6 +69,7 @@ abstract class FragmentsModule {
|
|||
@ContributesAndroidInjector abstract fun contributesLoopFragment(): LoopFragment
|
||||
@ContributesAndroidInjector abstract fun contributesMaintenanceFragment(): MaintenanceFragment
|
||||
@ContributesAndroidInjector abstract fun contributesMedtronicFragment(): MedtronicFragment
|
||||
@ContributesAndroidInjector abstract fun contributesOmnipodFragment(): OmnipodFragment
|
||||
@ContributesAndroidInjector abstract fun contributesNSProfileFragment(): NSProfileFragment
|
||||
@ContributesAndroidInjector abstract fun contributesNSClientFragment(): NSClientFragment
|
||||
@ContributesAndroidInjector abstract fun contributesSmsCommunicatorFragment(): SmsCommunicatorFragment
|
||||
|
|
|
@ -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.connection_service.InsightConnectionService
|
||||
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.DataService
|
||||
import info.nightscout.androidaps.services.LocationService
|
||||
|
@ -39,4 +40,5 @@ abstract class ServicesModule {
|
|||
@ContributesAndroidInjector abstract fun contributesInsightConnectionService(): InsightConnectionService
|
||||
@ContributesAndroidInjector abstract fun contributesRileyLinkService(): RileyLinkService
|
||||
@ContributesAndroidInjector abstract fun contributesRileyLinkMedtronicService(): RileyLinkMedtronicService
|
||||
@ContributesAndroidInjector abstract fun contributesRileyLinkOmnipodService(): RileyLinkOmnipodService
|
||||
}
|
|
@ -59,7 +59,7 @@ class OmnipodFragment : DaggerFragment() {
|
|||
@Inject lateinit var rxBus: RxBusWrapper
|
||||
@Inject lateinit var commandQueue: CommandQueueProvider
|
||||
@Inject lateinit var activePlugin: ActivePluginProvider
|
||||
@Inject lateinit var medtronicPumpPlugin: MedtronicPumpPlugin
|
||||
@Inject lateinit var omnipodPumpPlugin: OmnipodPumpPlugin
|
||||
@Inject lateinit var warnColors: WarnColors
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
@ -370,7 +370,7 @@ class OmnipodFragment : DaggerFragment() {
|
|||
|
||||
// GUI functions
|
||||
fun updateGUI() {
|
||||
val plugin = OmnipodPumpPlugin.getPlugin()
|
||||
val plugin = omnipodPumpPlugin
|
||||
val pumpStatus = OmnipodUtil.getPumpStatus()
|
||||
var pumpType = OmnipodUtil.getPumpType()
|
||||
|
||||
|
|
|
@ -142,6 +142,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
);
|
||||
|
||||
displayConnectionMessages = false;
|
||||
OmnipodPumpPlugin.plugin = this;
|
||||
|
||||
//OmnipodUtil.setDriverState();
|
||||
|
||||
|
|
|
@ -85,14 +85,13 @@ import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
|||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
|
||||
public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface {
|
||||
|
||||
@Inject AAPSLogger aapsLogger;
|
||||
@Inject RxBusWrapper rxBus;
|
||||
@Inject ResourceHelper resourceHelper;
|
||||
@Inject HasAndroidInjector injector;
|
||||
@Inject ActivePluginProvider activePlugin;
|
||||
AAPSLogger aapsLogger;
|
||||
RxBusWrapper rxBus;
|
||||
ResourceHelper resourceHelper;
|
||||
HasAndroidInjector injector;
|
||||
ActivePluginProvider activePlugin;
|
||||
|
||||
//private static final Logger LOG = LoggerFactory.getLogger(L.PUMP);
|
||||
private final OmnipodManager delegate;
|
||||
|
@ -107,13 +106,25 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
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 -> {
|
||||
// Handle pod state changes
|
||||
OmnipodUtil.setPodSessionState(podSessionState);
|
||||
updatePumpStatus(podSessionState);
|
||||
});
|
||||
this.pumpStatus = _pumpStatus;
|
||||
instance = this;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,10 +14,13 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
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.RileyLinkConst;
|
||||
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.util.OmnipodConst;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||
|
||||
|
||||
|
@ -50,6 +54,11 @@ public class RileyLinkOmnipodService extends RileyLinkService {
|
|||
// @Inject Context context;
|
||||
@Inject OmnipodPumpPlugin omnipodPumpPlugin;
|
||||
// @Inject SP sp;
|
||||
@Inject RxBusWrapper rxBus;
|
||||
@Inject ActivePluginProvider activePlugin;
|
||||
@Inject HasAndroidInjector injector;
|
||||
@Inject ResourceHelper resourceHelper;
|
||||
|
||||
|
||||
//private static final Logger LOG = LoggerFactory.getLogger(L.PUMPCOMM);
|
||||
|
||||
|
@ -122,7 +131,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
|
|||
if (isLogEnabled())
|
||||
aapsLogger.debug(LTag.PUMPCOMM,"RileyLinkOmnipodService newly constructed");
|
||||
OmnipodUtil.setOmnipodService(this);
|
||||
pumpStatus = (OmnipodPumpStatus) OmnipodPumpPlugin.getPlugin().getPumpStatusData();
|
||||
pumpStatus = (OmnipodPumpStatus) omnipodPumpPlugin.getPumpStatusData();
|
||||
//aapsLogger.debug(LTag.PUMPCOMM,"RRRRRRRRRR: " + pumpStatus);
|
||||
}
|
||||
|
||||
|
@ -143,7 +152,8 @@ public class RileyLinkOmnipodService extends RileyLinkService {
|
|||
OmnipodCommunicationService omnipodCommunicationService = new OmnipodCommunicationService(rfspy);
|
||||
omnipodCommunicationService.setPumpStatus(pumpStatus);
|
||||
|
||||
omnipodCommunicationManager = new AapsOmnipodManager(omnipodCommunicationService, podState, pumpStatus);
|
||||
omnipodCommunicationManager = new AapsOmnipodManager(omnipodCommunicationService, podState, pumpStatus,
|
||||
aapsLogger, rxBus, resourceHelper, injector, activePlugin);
|
||||
} else {
|
||||
omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue