diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/OmnipodModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/OmnipodModule.kt index a6253dd71d..cf406ec220 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/OmnipodModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/OmnipodModule.kt @@ -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 } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java index 383eb57cb6..8e6e394eb2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/service/tasks/DiscoverGattServicesTask.java @@ -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(); } -} +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index a6236b9f60..dd6d7295b7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -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); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java index 1902a1f7cd..6514384bf2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/service/RileyLinkOmnipodService.java @@ -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); diff --git a/app/src/main/res/xml/pref_omnipod.xml b/app/src/main/res/xml/pref_omnipod.xml index 5c1b137d15..6dc27a0731 100644 --- a/app/src/main/res/xml/pref_omnipod.xml +++ b/app/src/main/res/xml/pref_omnipod.xml @@ -1,7 +1,6 @@ + xmlns:app="http://schemas.android.com/apk/res-auto">