Apply several fixed from @andyrozman after Omnipod dagger merge
This commit is contained in:
parent
e20d8a1ff5
commit
53e6cd4ef2
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.dependencyInjection
|
|||
import dagger.Module
|
||||
import dagger.android.ContributesAndroidInjector
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.InitPodRefreshAction
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.ui.OmnipodUITask
|
||||
|
||||
|
@ -13,5 +14,6 @@ abstract class OmnipodModule {
|
|||
@ContributesAndroidInjector abstract fun omnipodCommunicationManagerProvider(): OmnipodCommunicationManager
|
||||
@ContributesAndroidInjector abstract fun omnipodUITaskProvider(): OmnipodUITask
|
||||
@ContributesAndroidInjector abstract fun aapsOmnipodManagerProvider(): AapsOmnipodManager
|
||||
@ContributesAndroidInjector abstract fun initPodRefreshAction(): InitPodRefreshAction
|
||||
|
||||
}
|
|
@ -3,15 +3,18 @@ package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.task
|
|||
import javax.inject.Inject;
|
||||
|
||||
import dagger.android.HasAndroidInjector;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil;
|
||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice;
|
||||
|
||||
/**
|
||||
* Created by geoff on 7/9/16.
|
||||
*/
|
||||
public class DiscoverGattServicesTask extends ServiceTask {
|
||||
|
||||
@Inject MedtronicPumpPlugin medtronicPumpPlugin;
|
||||
@Inject ActivePluginProvider activePlugin;
|
||||
@Inject AAPSLogger aapsLogger;
|
||||
|
||||
public boolean needToConnect = false;
|
||||
|
||||
|
@ -30,9 +33,17 @@ public class DiscoverGattServicesTask extends ServiceTask {
|
|||
@Override
|
||||
public void run() {
|
||||
|
||||
if (needToConnect)
|
||||
medtronicPumpPlugin.getRileyLinkService().getRileyLinkBLE().connectGatt();
|
||||
if (activePlugin.getActivePump().model() == PumpType.Insulet_Omnipod_Dash) {
|
||||
// TODO different init classes
|
||||
return;
|
||||
}
|
||||
|
||||
medtronicPumpPlugin.getRileyLinkService().getRileyLinkBLE().discoverServices();
|
||||
RileyLinkPumpDevice pumpDevice = (RileyLinkPumpDevice) activePlugin.getActivePump();
|
||||
|
||||
if (needToConnect) {
|
||||
pumpDevice.getRileyLinkService().getRileyLinkBLE().connectGatt();
|
||||
}
|
||||
|
||||
pumpDevice.getRileyLinkService().getRileyLinkBLE().discoverServices();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -619,11 +619,11 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
if (omnipodUtil.getPodSessionState() != null) {
|
||||
podSessionState = omnipodUtil.getPodSessionState();
|
||||
} else {
|
||||
String podState = sp.getString(OmnipodConst.Prefs.PodState, null);
|
||||
String podState = sp.getString(OmnipodConst.Prefs.PodState, "");
|
||||
|
||||
aapsLogger.info(LTag.PUMP, "PodSessionState-SP: loaded from SharedPreferences: " + podState);
|
||||
|
||||
if (podState != null) {
|
||||
if (StringUtils.isNotEmpty(podState)) {
|
||||
podSessionState = omnipodUtil.getGsonInstance().fromJson(podState, PodSessionState.class);
|
||||
podSessionState.injectDaggerClass(injector);
|
||||
omnipodUtil.setPodSessionState(podSessionState);
|
||||
|
|
|
@ -19,6 +19,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkCons
|
|||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RFSpy;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.RileyLinkBLE;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkEncodingType;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice;
|
||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkService;
|
||||
|
@ -88,6 +89,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
|
|||
public void initRileyLinkServiceData() {
|
||||
|
||||
rileyLinkServiceData.targetDevice = RileyLinkTargetDevice.Omnipod;
|
||||
rileyLinkServiceData.rileyLinkTargetFrequency = RileyLinkTargetFrequency.Omnipod;
|
||||
|
||||
// get most recently used RileyLink address
|
||||
rileyLinkServiceData.rileylinkAddress = sp.getString(RileyLinkConst.Prefs.RileyLinkAddress, "");
|
||||
|
@ -206,6 +208,7 @@ public class RileyLinkOmnipodService extends RileyLinkService {
|
|||
this.omnipodPumpStatus.beepTBREnabled = sp.getBoolean(OmnipodConst.Prefs.BeepTBREnabled, true);
|
||||
this.omnipodPumpStatus.podDebuggingOptionsEnabled = sp.getBoolean(OmnipodConst.Prefs.PodDebuggingOptionsEnabled, false);
|
||||
this.omnipodPumpStatus.timeChangeEventEnabled = sp.getBoolean(OmnipodConst.Prefs.TimeChangeEventEnabled, true);
|
||||
rileyLinkServiceData.rileyLinkTargetFrequency = RileyLinkTargetFrequency.Omnipod;
|
||||
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Beeps [basal={}, bolus={}, SMB={}, TBR={}]", this.omnipodPumpStatus.beepBasalEnabled, this.omnipodPumpStatus.beepBolusEnabled, this.omnipodPumpStatus.beepSMBEnabled, this.omnipodPumpStatus.beepTBREnabled);
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:validate="http://schemas.android.com/apk/res-auto">
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/omnipod_name"
|
||||
|
|
Loading…
Reference in a new issue