From d6ade59cd3c6a1115620cdc190b47d6fd30d16c4 Mon Sep 17 00:00:00 2001 From: Philoul Date: Tue, 7 Dec 2021 00:40:13 +0100 Subject: [PATCH] Add untranslated status for logging in Command interface --- .../androidaps/queue/CommandQueueImplementation.kt | 2 +- .../java/info/nightscout/androidaps/queue/QueueThread.kt | 2 +- .../nightscout/androidaps/queue/commands/CommandBolus.kt | 5 +++++ .../androidaps/queue/commands/CommandCancelExtendedBolus.kt | 2 ++ .../androidaps/queue/commands/CommandCancelTempBasal.kt | 2 ++ .../androidaps/queue/commands/CommandCustomCommand.kt | 6 +++--- .../androidaps/queue/commands/CommandExtendedBolus.kt | 2 ++ .../queue/commands/CommandInsightSetTBROverNotification.kt | 2 ++ .../androidaps/queue/commands/CommandLoadEvents.kt | 2 ++ .../androidaps/queue/commands/CommandLoadHistory.kt | 2 ++ .../nightscout/androidaps/queue/commands/CommandLoadTDDs.kt | 2 ++ .../androidaps/queue/commands/CommandReadStatus.kt | 2 ++ .../nightscout/androidaps/queue/commands/CommandSMBBolus.kt | 2 ++ .../androidaps/queue/commands/CommandSetProfile.kt | 2 ++ .../androidaps/queue/commands/CommandSetUserSettings.kt | 2 ++ .../androidaps/queue/commands/CommandStartPump.kt | 2 ++ .../nightscout/androidaps/queue/commands/CommandStopPump.kt | 2 ++ .../androidaps/queue/commands/CommandTempBasalAbsolute.kt | 2 ++ .../androidaps/queue/commands/CommandTempBasalPercent.kt | 2 ++ .../info/nightscout/androidaps/queue/commands/Command.kt | 1 + 20 files changed, 41 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt index 6841ac4c25..29eb916b3c 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueueImplementation.kt @@ -144,7 +144,7 @@ class CommandQueueImplementation @Inject constructor( @Synchronized private fun add(command: Command) { - aapsLogger.debug(LTag.PUMPQUEUE, "Adding: " + command.javaClass.simpleName + " - " + command.status()) + aapsLogger.debug(LTag.PUMPQUEUE, "Adding: " + command.javaClass.simpleName + " - " + command.log()) synchronized(queue) { queue.add(command) } } diff --git a/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt b/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt index 88255e5b3b..aec3c01ea0 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/QueueThread.kt @@ -113,7 +113,7 @@ class QueueThread internal constructor( if (queue.size() > 0) { queue.pickup() val cont = queue.performing()?.let { - aapsLogger.debug(LTag.PUMPQUEUE, "performing " + it.status()) + aapsLogger.debug(LTag.PUMPQUEUE, "performing " + it.log()) rxBus.send(EventQueueChanged()) rxBus.send(EventPumpStatusChanged(it.status())) it.execute() diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt index 68d26d57c8..4943ca02c1 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandBolus.kt @@ -35,4 +35,9 @@ class CommandBolus( return (if (detailedBolusInfo.insulin > 0) rh.gs(R.string.bolus_u_min, detailedBolusInfo.insulin) else "") + if (detailedBolusInfo.carbs > 0) rh.gs(R.string.carbs_g, detailedBolusInfo.carbs.toInt()) else "" } + + override fun log(): String { + 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 "" + } } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelExtendedBolus.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelExtendedBolus.kt index a2053c1f45..d1979fc09d 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelExtendedBolus.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelExtendedBolus.kt @@ -21,4 +21,6 @@ class CommandCancelExtendedBolus constructor( } override fun status(): String = rh.gs(R.string.uel_cancel_extended_bolus) + + override fun log(): String = "CANCEL EXTENDEDBOLUS" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelTempBasal.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelTempBasal.kt index 2f27ec33f1..2738767bfd 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelTempBasal.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCancelTempBasal.kt @@ -22,4 +22,6 @@ class CommandCancelTempBasal( } override fun status(): String = rh.gs(R.string.uel_accepts_temp_basal) + + override fun log(): String = "CANCEL TEMPBASAL" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCustomCommand.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCustomCommand.kt index e9f058ece9..a295a70a6d 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCustomCommand.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandCustomCommand.kt @@ -20,7 +20,7 @@ class CommandCustomCommand( callback?.result(result)?.run() } - override fun status(): String { - return customCommand.statusDescription - } + override fun status(): String = customCommand.statusDescription + + override fun log(): String = customCommand.statusDescription } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandExtendedBolus.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandExtendedBolus.kt index e0fe72e4cc..22a2bb2564 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandExtendedBolus.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandExtendedBolus.kt @@ -23,4 +23,6 @@ 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" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandInsightSetTBROverNotification.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandInsightSetTBROverNotification.kt index 695f097004..7ea827e510 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandInsightSetTBROverNotification.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandInsightSetTBROverNotification.kt @@ -25,4 +25,6 @@ class CommandInsightSetTBROverNotification constructor( @Suppress("SpellCheckingInspection") override fun status(): String = rh.gs(R.string.insight_set_tbr_over_notification) + + override fun log(): String = "INSIGHTSETTBROVERNOTIFICATION" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt index 886027428b..65f46c6b2a 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadEvents.kt @@ -34,4 +34,6 @@ class CommandLoadEvents( } override fun status(): String = rh.gs(R.string.load_events) + + override fun log(): String = "LOAD EVENTS" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt index dd0694741e..65ad0d8364 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadHistory.kt @@ -35,4 +35,6 @@ class CommandLoadHistory( } override fun status(): String = rh.gs(R.string.load_history, type.toInt()) + + override fun log(): String = "LOAD HISTORY $type" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadTDDs.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadTDDs.kt index 3513e1efff..7157567725 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadTDDs.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandLoadTDDs.kt @@ -22,4 +22,6 @@ class CommandLoadTDDs( } override fun status(): String = rh.gs(R.string.load_tdds) + + override fun log(): String = "LOAD TDDs" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.kt index 78b8e80168..d732367dd6 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandReadStatus.kt @@ -31,4 +31,6 @@ class CommandReadStatus( } override fun status(): String = rh.gs(R.string.read_status, reason) + + override fun log(): String = "READSTATUS $reason" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSMBBolus.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSMBBolus.kt index e5ace367c0..22c833b457 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSMBBolus.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSMBBolus.kt @@ -38,4 +38,6 @@ 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)}" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.kt index 5eaca9aa0a..5ba15ebfcd 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetProfile.kt @@ -46,4 +46,6 @@ class CommandSetProfile constructor( } override fun status(): String = rh.gs(R.string.set_profile) + + override fun log(): String = "SET PROFILE" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt index c0fd30e315..a3735643ab 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.kt @@ -32,4 +32,6 @@ class CommandSetUserSettings( } override fun status(): String = rh.gs(R.string.set_user_settings) + + override fun log(): String = "SET USER SETTINGS" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStartPump.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStartPump.kt index 8444f5bc90..33b8296d05 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStartPump.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStartPump.kt @@ -23,4 +23,6 @@ class CommandStartPump( } override fun status(): String = rh.gs(R.string.start_pump) + + override fun log(): String = "START PUMP" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStopPump.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStopPump.kt index 3568d2656e..80fdd90702 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStopPump.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandStopPump.kt @@ -23,4 +23,6 @@ class CommandStopPump( } override fun status(): String = rh.gs(R.string.stop_pump) + + override fun log(): String = "STOP PUMP" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalAbsolute.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalAbsolute.kt index b87496af59..c51a4cd9ff 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalAbsolute.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalAbsolute.kt @@ -28,4 +28,6 @@ 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" } \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalPercent.kt b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalPercent.kt index 6b198cb40c..3dfb79982b 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalPercent.kt +++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandTempBasalPercent.kt @@ -32,4 +32,6 @@ class CommandTempBasalPercent( } override fun status(): String = rh.gs(R.string.temp_basal_percent, percent, durationInMinutes) + + override fun log(): String = "TEMP BASAL $percent% $durationInMinutes min" } \ No newline at end of file diff --git a/core/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt b/core/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt index 14596e50fe..c97f483d7f 100644 --- a/core/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt +++ b/core/src/main/java/info/nightscout/androidaps/queue/commands/Command.kt @@ -45,6 +45,7 @@ abstract class Command( abstract fun execute() abstract fun status(): String + abstract fun log(): String fun cancel() { val result = PumpEnactResult(injector)