diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java index 9462d3ebba..ef13548f97 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPlugin.java @@ -64,13 +64,10 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpDevice; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkPumpInfo; import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask; -import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor; import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil; import info.nightscout.androidaps.plugins.pump.omnipod.data.ActiveBolus; import info.nightscout.androidaps.plugins.pump.omnipod.data.RLHistoryItemOmnipod; import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodCommandType; -import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodCustomActionType; import info.nightscout.androidaps.plugins.pump.omnipod.definition.OmnipodStorageKeys; import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.action.service.ExpirationReminderBuilder; import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.message.response.podinfo.PodInfoRecentPulseLog; @@ -122,7 +119,6 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface, private final PodStateManager podStateManager; private final RileyLinkServiceData rileyLinkServiceData; - private final ServiceTaskExecutor serviceTaskExecutor; private final AapsOmnipodManager aapsOmnipodManager; private final AapsOmnipodUtil aapsOmnipodUtil; private final RileyLinkUtil rileyLinkUtil; @@ -140,8 +136,6 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface, private final ServiceConnection serviceConnection; private final PumpType pumpType = PumpType.Insulet_Omnipod; - private final List customActions = Collections.singletonList(new CustomAction( - R.string.omnipod_custom_action_reset_rileylink, OmnipodCustomActionType.RESET_RILEY_LINK_CONFIGURATION, R.drawable.icon_pod_activity_reset_rileylink_config, true)); private final CompositeDisposable disposables = new CompositeDisposable(); private final NSUpload nsUpload; @@ -174,7 +168,6 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface, CommandQueueProvider commandQueue, FabricPrivacy fabricPrivacy, RileyLinkServiceData rileyLinkServiceData, - ServiceTaskExecutor serviceTaskExecutor, DateUtil dateUtil, AapsOmnipodUtil aapsOmnipodUtil, RileyLinkUtil rileyLinkUtil, @@ -200,7 +193,6 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface, this.dateUtil = dateUtil; this.podStateManager = podStateManager; this.rileyLinkServiceData = rileyLinkServiceData; - this.serviceTaskExecutor = serviceTaskExecutor; this.aapsOmnipodManager = aapsOmnipodManager; this.aapsOmnipodUtil = aapsOmnipodUtil; this.rileyLinkUtil = rileyLinkUtil; @@ -482,8 +474,9 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface, @Override public boolean isHandshakeInProgress() { - if (displayConnectionMessages) + if (displayConnectionMessages) { aapsLogger.debug(LTag.PUMP, "isHandshakeInProgress [OmnipodPumpPlugin] - default (empty) implementation."); + } return false; } @@ -805,18 +798,12 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface, @Override public List getCustomActions() { - return customActions; + return Collections.emptyList(); } @Override public void executeCustomAction(CustomActionType customActionType) { - OmnipodCustomActionType omnipodCustomActionType = (OmnipodCustomActionType) customActionType; - - if (omnipodCustomActionType == OmnipodCustomActionType.RESET_RILEY_LINK_CONFIGURATION) { - serviceTaskExecutor.startTask(new ResetRileyLinkConfigurationTask(getInjector())); - } else { - aapsLogger.warn(LTag.PUMP, "Unknown custom action: " + omnipodCustomActionType); - } + aapsLogger.warn(LTag.PUMP, "Unknown custom action: " + customActionType); } @Override diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/definition/OmnipodCustomActionType.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/definition/OmnipodCustomActionType.java deleted file mode 100644 index 9d9fbf3f13..0000000000 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/definition/OmnipodCustomActionType.java +++ /dev/null @@ -1,17 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.omnipod.definition; - -import info.nightscout.androidaps.plugins.general.actions.defs.CustomActionType; - -/** - * Created by andy on 4.8.2019 - */ - -public enum OmnipodCustomActionType implements CustomActionType { - RESET_RILEY_LINK_CONFIGURATION; - - @Override - public String getKey() { - return this.name(); - } - -} diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/queue/command/OmnipodCustomCommandType.java b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/queue/command/OmnipodCustomCommandType.java index f5c787be26..f88777638e 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/queue/command/OmnipodCustomCommandType.java +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/queue/command/OmnipodCustomCommandType.java @@ -9,8 +9,7 @@ public enum OmnipodCustomCommandType { DEACTIVATE_POD("DEACTIVATE POD"), HANDLE_TIME_CHANGE("HANDLE TIME CHANGE"), UPDATE_ALERT_CONFIGURATION("UPDATE ALERT CONFIGURATION"), - PLAY_TEST_BEEP("PLAY TEST BEEP") - ; + PLAY_TEST_BEEP("PLAY TEST BEEP"); private final String description; diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt index 058a033d85..d877481c46 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt @@ -11,6 +11,8 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ResetRileyLinkConfigurationTask +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin import info.nightscout.androidaps.plugins.pump.omnipod.R import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.ActivationProgress @@ -50,6 +52,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() { @Inject lateinit var aapsOmnipodManager: AapsOmnipodManager @Inject lateinit var context: Context @Inject lateinit var omnipodPumpPlugin: OmnipodPumpPlugin + @Inject lateinit var serviceTaskExecutor: ServiceTaskExecutor private var disposables: CompositeDisposable = CompositeDisposable() @@ -80,6 +83,11 @@ class PodManagementActivity : NoSplashAppCompatActivity() { } } + omnipod_pod_management_button_reset_rileylink_config.setOnClickListener { + // TODO improvement: properly disable button until task is finished + serviceTaskExecutor.startTask(ResetRileyLinkConfigurationTask(injector)) + } + omnipod_pod_management_button_play_test_beep.setOnClickListener { omnipod_pod_management_button_play_test_beep.isEnabled = false omnipod_pod_management_button_play_test_beep.setText(R.string.omnipod_pod_management_button_playing_test_beep) diff --git a/omnipod/src/main/res/layout/omnipod_pod_management.xml b/omnipod/src/main/res/layout/omnipod_pod_management.xml index 72e18d2823..f7871be3f5 100644 --- a/omnipod/src/main/res/layout/omnipod_pod_management.xml +++ b/omnipod/src/main/res/layout/omnipod_pod_management.xml @@ -145,7 +145,7 @@ android:textAllCaps="false" /> Discard Pod Pod history RileyLink stats - Reest RileyLink Config + Reset RileyLink Config Read pulse log Reading pulse log… If you discard the Pod, you will not be able to communicate with it anymore. You should only do this when all communication with the Pod persistently fails. If you can still communicate with the Pod, please use the Deactivate Pod option.\n\nIf you wish to proceed, please make sure to remove the Pod from your body! @@ -254,7 +254,6 @@ Pump integration for Omnipod, requires RileyLink (with at least 2.0 firmware) device. - Reset RileyLink config uncertain Pulse log Pulse Log (copied to clipboard) diff --git a/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPluginTest.java b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPluginTest.java index 79d98aac0c..28af58b0d6 100644 --- a/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPluginTest.java +++ b/omnipod/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodPumpPluginTest.java @@ -59,7 +59,7 @@ public class OmnipodPumpPluginTest { PowerMockito.mockStatic(Looper.class); OmnipodPumpPlugin plugin = new OmnipodPumpPlugin(injector, aapsLogger, rxBusWrapper, null, resourceHelper, activePluginProvider, null, null, aapsOmnipodManager, commandQueueProvider, - null, null, null, null, null, + null, null, null, null, rileyLinkUtil, null, null, null ); when(activePluginProvider.getActiveTreatments().getTempBasalFromHistory(anyLong())).thenReturn(null);