From 4120a4ad81145445683886edb095d424627d1f65 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 11 Nov 2022 18:09:17 +0100 Subject: [PATCH] remove Command dependency --- .../androidaps/queue/commands/Command.kt | 16 ++-------------- .../queue/CommandQueueImplementation.kt | 1 + .../queue/commands/CommandBolus.kt | 10 ++++++++-- .../queue/commands/CommandCancelExtendedBolus.kt | 8 ++++++-- .../queue/commands/CommandCancelTempBasal.kt | 8 ++++++-- .../queue/commands/CommandCustomCommand.kt | 8 ++++++-- .../queue/commands/CommandExtendedBolus.kt | 8 ++++++-- .../CommandInsightSetTBROverNotification.kt | 6 ++++++ .../queue/commands/CommandLoadEvents.kt | 5 +++++ .../queue/commands/CommandLoadHistory.kt | 5 +++++ .../queue/commands/CommandLoadTDDs.kt | 8 ++++++-- .../queue/commands/CommandReadStatus.kt | 11 +++++++---- .../queue/commands/CommandSMBBolus.kt | 6 ++++++ .../queue/commands/CommandSetProfile.kt | 6 ++++++ .../queue/commands/CommandSetUserSettings.kt | 5 +++++ .../queue/commands/CommandStartPump.kt | 6 ++++++ .../queue/commands/CommandStopPump.kt | 6 ++++++ .../queue/commands/CommandTempBasalAbsolute.kt | 5 +++++ .../queue/commands/CommandTempBasalPercent.kt | 5 +++++ 19 files changed, 103 insertions(+), 30 deletions(-) diff --git a/core/core-main/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt b/core/core-main/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt index 20ebdcb05d..9c864f9bf5 100644 --- a/core/core-main/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt +++ b/core/core-main/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt @@ -1,13 +1,9 @@ package info.nightscout.androidaps.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.core.main.R -import info.nightscout.androidaps.data.PumpEnactResultObject -import info.nightscout.database.impl.AppRepository -import info.nightscout.shared.interfaces.ResourceHelper import info.nightscout.interfaces.queue.Callback import info.nightscout.rx.logging.AAPSLogger -import info.nightscout.rx.logging.LTag +import info.nightscout.shared.interfaces.ResourceHelper import javax.inject.Inject abstract class Command( @@ -18,7 +14,6 @@ abstract class Command( @Inject lateinit var aapsLogger: AAPSLogger @Inject lateinit var rh: ResourceHelper - @Inject lateinit var repository: AppRepository enum class CommandType { BOLUS, @@ -46,12 +41,5 @@ abstract class Command( abstract fun execute() abstract fun status(): String abstract fun log(): String - - fun cancel() { - val result = PumpEnactResultObject(injector) - result.success = false - result.comment = rh.gs(R.string.connectiontimedout) - aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") - callback?.result(result)?.run() - } + abstract fun cancel() } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt index 9ec92c0377..a1ccabd571 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/CommandQueueImplementation.kt @@ -190,6 +190,7 @@ class CommandQueueImplementation @Inject constructor( synchronized(queue) { for (i in queue.indices) { queue[i].cancel() + } queue.clear() } diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt index b29702ebea..6558ea5e66 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt @@ -1,13 +1,14 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector -import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.dialogs.BolusProgressDialog import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.plugins.general.overview.events.EventDismissBolusProgressIfRunning -import info.nightscout.interfaces.queue.Callback import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R +import info.nightscout.interfaces.pump.DetailedBolusInfo +import info.nightscout.interfaces.queue.Callback import info.nightscout.rx.bus.RxBus import info.nightscout.rx.logging.LTag import javax.inject.Inject @@ -41,4 +42,9 @@ class CommandBolus( return (if (detailedBolusInfo.insulin > 0) "BOLUS " + rh.gs(R.string.formatinsulinunits, detailedBolusInfo.insulin) else "") + if (detailedBolusInfo.carbs > 0) "CARBS " + rh.gs(R.string.format_carbs, detailedBolusInfo.carbs.toInt()) else "" } + + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCancelExtendedBolus.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCancelExtendedBolus.kt index aa361c385e..5c99fa9c04 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCancelExtendedBolus.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCancelExtendedBolus.kt @@ -1,12 +1,12 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.interfaces.queue.Callback import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R +import info.nightscout.interfaces.queue.Callback import info.nightscout.rx.logging.LTag - import javax.inject.Inject class CommandCancelExtendedBolus constructor( @@ -25,4 +25,8 @@ class CommandCancelExtendedBolus constructor( override fun status(): String = rh.gs(R.string.uel_cancel_extended_bolus) override fun log(): String = "CANCEL EXTENDEDBOLUS" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCancelTempBasal.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCancelTempBasal.kt index 421f24acf8..b5894fc402 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCancelTempBasal.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCancelTempBasal.kt @@ -1,12 +1,12 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.interfaces.queue.Callback import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R +import info.nightscout.interfaces.queue.Callback import info.nightscout.rx.logging.LTag - import javax.inject.Inject class CommandCancelTempBasal( @@ -26,4 +26,8 @@ class CommandCancelTempBasal( override fun status(): String = rh.gs(R.string.uel_accepts_temp_basal) override fun log(): String = "CANCEL TEMPBASAL" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCustomCommand.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCustomCommand.kt index ee338cbada..5fc133d68d 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCustomCommand.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandCustomCommand.kt @@ -1,12 +1,12 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.interfaces.queue.Callback import info.nightscout.androidaps.queue.commands.Command +import info.nightscout.interfaces.queue.Callback import info.nightscout.interfaces.queue.CustomCommand import info.nightscout.rx.logging.LTag - import javax.inject.Inject class CommandCustomCommand( @@ -27,4 +27,8 @@ class CommandCustomCommand( override fun status(): String = customCommand.statusDescription override fun log(): String = customCommand.statusDescription + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandExtendedBolus.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandExtendedBolus.kt index 07b072e0a3..f64e87a61e 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandExtendedBolus.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandExtendedBolus.kt @@ -1,12 +1,12 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.interfaces.queue.Callback import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R +import info.nightscout.interfaces.queue.Callback import info.nightscout.rx.logging.LTag - import javax.inject.Inject class CommandExtendedBolus constructor( @@ -27,4 +27,8 @@ class CommandExtendedBolus constructor( override fun status(): String = rh.gs(R.string.extended_bolus_u_min, insulin, durationInMinutes) override fun log(): String = "EXTENDEDBOLUS $insulin U $durationInMinutes min" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandInsightSetTBROverNotification.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandInsightSetTBROverNotification.kt index 4fe4b8c174..1073645081 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandInsightSetTBROverNotification.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandInsightSetTBROverNotification.kt @@ -1,11 +1,13 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R import info.nightscout.interfaces.pump.Insight import info.nightscout.interfaces.queue.Callback +import info.nightscout.rx.logging.LTag import javax.inject.Inject class CommandInsightSetTBROverNotification constructor( @@ -28,4 +30,8 @@ class CommandInsightSetTBROverNotification constructor( @Suppress("SpellCheckingInspection") override fun log(): String = "INSIGHTSETTBROVERNOTIFICATION" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadEvents.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadEvents.kt index c2927375d4..282f6c61bb 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadEvents.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadEvents.kt @@ -1,6 +1,7 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R @@ -37,4 +38,8 @@ class CommandLoadEvents( override fun status(): String = rh.gs(R.string.load_events) override fun log(): String = "LOAD EVENTS" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadHistory.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadHistory.kt index 128d7df3bd..19deca464b 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadHistory.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadHistory.kt @@ -1,6 +1,7 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R @@ -38,4 +39,8 @@ class CommandLoadHistory( override fun status(): String = rh.gs(R.string.load_history, type.toInt()) override fun log(): String = "LOAD HISTORY $type" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadTDDs.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadTDDs.kt index 7483ed784b..c2dd6781da 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadTDDs.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandLoadTDDs.kt @@ -1,12 +1,12 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin -import info.nightscout.interfaces.queue.Callback import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R +import info.nightscout.interfaces.queue.Callback import info.nightscout.rx.logging.LTag - import javax.inject.Inject class CommandLoadTDDs( @@ -26,4 +26,8 @@ class CommandLoadTDDs( override fun status(): String = rh.gs(R.string.load_tdds) override fun log(): String = "LOAD TDDs" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandReadStatus.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandReadStatus.kt index eecc6de25d..0d7d7a9950 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandReadStatus.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandReadStatus.kt @@ -3,13 +3,12 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin +import info.nightscout.androidaps.queue.commands.Command +import info.nightscout.implementation.R import info.nightscout.interfaces.LocalAlertUtils import info.nightscout.interfaces.queue.Callback -import info.nightscout.androidaps.queue.commands.Command -import info.nightscout.shared.utils.T -import info.nightscout.implementation.R import info.nightscout.rx.logging.LTag - +import info.nightscout.shared.utils.T import javax.inject.Inject class CommandReadStatus( @@ -35,4 +34,8 @@ class CommandReadStatus( override fun status(): String = rh.gs(R.string.read_status, reason) override fun log(): String = "READSTATUS $reason" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSMBBolus.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSMBBolus.kt index 8353083118..fa4a7561c7 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSMBBolus.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSMBBolus.kt @@ -4,6 +4,7 @@ import dagger.android.HasAndroidInjector import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.queue.commands.Command +import info.nightscout.database.impl.AppRepository import info.nightscout.implementation.R import info.nightscout.interfaces.pump.DetailedBolusInfo import info.nightscout.interfaces.pump.PumpEnactResult @@ -21,6 +22,7 @@ class CommandSMBBolus( @Inject lateinit var dateUtil: DateUtil @Inject lateinit var activePlugin: ActivePlugin + @Inject lateinit var repository: AppRepository override fun execute() { val r: PumpEnactResult @@ -42,4 +44,8 @@ class CommandSMBBolus( override fun status(): String = rh.gs(R.string.smb_bolus_u, detailedBolusInfo.insulin) override fun log(): String = "SMB BOLUS ${rh.gs(R.string.formatinsulinunits, detailedBolusInfo.insulin)}" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt index 5d73868598..6ae5f57208 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetProfile.kt @@ -5,6 +5,7 @@ import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.interfaces.CommandQueue import info.nightscout.androidaps.queue.commands.Command +import info.nightscout.database.impl.AppRepository import info.nightscout.database.impl.ValueWrapper import info.nightscout.implementation.R import info.nightscout.interfaces.Config @@ -28,6 +29,7 @@ class CommandSetProfile constructor( @Inject lateinit var dateUtil: DateUtil @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var config: Config + @Inject lateinit var repository: AppRepository override fun execute() { if (commandQueue.isThisProfileSet(profile) && repository.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet() is ValueWrapper.Existing) { @@ -49,4 +51,8 @@ class CommandSetProfile constructor( override fun status(): String = rh.gs(R.string.set_profile) override fun log(): String = "SET PROFILE" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetUserSettings.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetUserSettings.kt index 2ccb6a1a76..36e88055ac 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetUserSettings.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSetUserSettings.kt @@ -1,6 +1,7 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R @@ -35,4 +36,8 @@ class CommandSetUserSettings( override fun status(): String = rh.gs(R.string.set_user_settings) override fun log(): String = "SET USER SETTINGS" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandStartPump.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandStartPump.kt index 3f4863dbbb..80546a7230 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandStartPump.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandStartPump.kt @@ -1,11 +1,13 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R import info.nightscout.interfaces.pump.Insight import info.nightscout.interfaces.queue.Callback +import info.nightscout.rx.logging.LTag import javax.inject.Inject class CommandStartPump( @@ -26,4 +28,8 @@ class CommandStartPump( override fun status(): String = rh.gs(R.string.start_pump) override fun log(): String = "START PUMP" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandStopPump.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandStopPump.kt index e2c64a1031..a6813d5c0e 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandStopPump.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandStopPump.kt @@ -1,11 +1,13 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R import info.nightscout.interfaces.pump.Insight import info.nightscout.interfaces.queue.Callback +import info.nightscout.rx.logging.LTag import javax.inject.Inject class CommandStopPump( @@ -26,4 +28,8 @@ class CommandStopPump( override fun status(): String = rh.gs(R.string.stop_pump) override fun log(): String = "STOP PUMP" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalAbsolute.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalAbsolute.kt index fa1bcf0b22..5086ed8841 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalAbsolute.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalAbsolute.kt @@ -1,6 +1,7 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R @@ -31,4 +32,8 @@ class CommandTempBasalAbsolute( override fun status(): String = rh.gs(R.string.temp_basal_absolute, absoluteRate, durationInMinutes) override fun log(): String = "TEMP BASAL $absoluteRate U/h $durationInMinutes min" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalPercent.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalPercent.kt index cf01966ccc..04cdb5aace 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalPercent.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandTempBasalPercent.kt @@ -1,6 +1,7 @@ package info.nightscout.implementation.queue.commands import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.data.PumpEnactResultObject import info.nightscout.androidaps.interfaces.ActivePlugin import info.nightscout.androidaps.queue.commands.Command import info.nightscout.implementation.R @@ -35,4 +36,8 @@ class CommandTempBasalPercent( override fun status(): String = rh.gs(R.string.temp_basal_percent, percent, durationInMinutes) override fun log(): String = "TEMP BASAL $percent% $durationInMinutes min" + override fun cancel() { + aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") + callback?.result(PumpEnactResultObject(injector).success(false).comment(info.nightscout.core.main.R.string.connectiontimedout))?.run() + } } \ No newline at end of file