Merge pull request #1042 from Philoul/Fix/FixTranslatedLoggingForCommandQueue

Add untranslated status for logging in Command interface
This commit is contained in:
Milos Kozak 2021-12-07 09:58:39 +01:00 committed by GitHub
commit 36a1fa15aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 41 additions and 5 deletions

View file

@ -144,7 +144,7 @@ class CommandQueueImplementation @Inject constructor(
@Synchronized @Synchronized
private fun add(command: Command) { 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) } synchronized(queue) { queue.add(command) }
} }

View file

@ -113,7 +113,7 @@ class QueueThread internal constructor(
if (queue.size() > 0) { if (queue.size() > 0) {
queue.pickup() queue.pickup()
val cont = queue.performing()?.let { val cont = queue.performing()?.let {
aapsLogger.debug(LTag.PUMPQUEUE, "performing " + it.status()) aapsLogger.debug(LTag.PUMPQUEUE, "performing " + it.log())
rxBus.send(EventQueueChanged()) rxBus.send(EventQueueChanged())
rxBus.send(EventPumpStatusChanged(it.status())) rxBus.send(EventPumpStatusChanged(it.status()))
it.execute() it.execute()

View file

@ -35,4 +35,9 @@ class CommandBolus(
return (if (detailedBolusInfo.insulin > 0) rh.gs(R.string.bolus_u_min, detailedBolusInfo.insulin) else "") + 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 "" 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 ""
}
} }

View file

@ -21,4 +21,6 @@ class CommandCancelExtendedBolus constructor(
} }
override fun status(): String = rh.gs(R.string.uel_cancel_extended_bolus) override fun status(): String = rh.gs(R.string.uel_cancel_extended_bolus)
override fun log(): String = "CANCEL EXTENDEDBOLUS"
} }

View file

@ -22,4 +22,6 @@ class CommandCancelTempBasal(
} }
override fun status(): String = rh.gs(R.string.uel_accepts_temp_basal) override fun status(): String = rh.gs(R.string.uel_accepts_temp_basal)
override fun log(): String = "CANCEL TEMPBASAL"
} }

View file

@ -20,7 +20,7 @@ class CommandCustomCommand(
callback?.result(result)?.run() callback?.result(result)?.run()
} }
override fun status(): String { override fun status(): String = customCommand.statusDescription
return customCommand.statusDescription
} override fun log(): String = customCommand.statusDescription
} }

View file

@ -23,4 +23,6 @@ class CommandExtendedBolus constructor(
} }
override fun status(): String = rh.gs(R.string.extended_bolus_u_min, insulin, durationInMinutes) override fun status(): String = rh.gs(R.string.extended_bolus_u_min, insulin, durationInMinutes)
override fun log(): String = "EXTENDEDBOLUS $insulin U $durationInMinutes min"
} }

View file

@ -25,4 +25,6 @@ class CommandInsightSetTBROverNotification constructor(
@Suppress("SpellCheckingInspection") @Suppress("SpellCheckingInspection")
override fun status(): String = rh.gs(R.string.insight_set_tbr_over_notification) override fun status(): String = rh.gs(R.string.insight_set_tbr_over_notification)
override fun log(): String = "INSIGHTSETTBROVERNOTIFICATION"
} }

View file

@ -34,4 +34,6 @@ class CommandLoadEvents(
} }
override fun status(): String = rh.gs(R.string.load_events) override fun status(): String = rh.gs(R.string.load_events)
override fun log(): String = "LOAD EVENTS"
} }

View file

@ -35,4 +35,6 @@ class CommandLoadHistory(
} }
override fun status(): String = rh.gs(R.string.load_history, type.toInt()) override fun status(): String = rh.gs(R.string.load_history, type.toInt())
override fun log(): String = "LOAD HISTORY $type"
} }

View file

@ -22,4 +22,6 @@ class CommandLoadTDDs(
} }
override fun status(): String = rh.gs(R.string.load_tdds) override fun status(): String = rh.gs(R.string.load_tdds)
override fun log(): String = "LOAD TDDs"
} }

View file

@ -31,4 +31,6 @@ class CommandReadStatus(
} }
override fun status(): String = rh.gs(R.string.read_status, reason) override fun status(): String = rh.gs(R.string.read_status, reason)
override fun log(): String = "READSTATUS $reason"
} }

View file

@ -38,4 +38,6 @@ class CommandSMBBolus(
} }
override fun status(): String = rh.gs(R.string.smb_bolus_u, detailedBolusInfo.insulin) 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)}"
} }

View file

@ -46,4 +46,6 @@ class CommandSetProfile constructor(
} }
override fun status(): String = rh.gs(R.string.set_profile) override fun status(): String = rh.gs(R.string.set_profile)
override fun log(): String = "SET PROFILE"
} }

View file

@ -32,4 +32,6 @@ class CommandSetUserSettings(
} }
override fun status(): String = rh.gs(R.string.set_user_settings) override fun status(): String = rh.gs(R.string.set_user_settings)
override fun log(): String = "SET USER SETTINGS"
} }

View file

@ -23,4 +23,6 @@ class CommandStartPump(
} }
override fun status(): String = rh.gs(R.string.start_pump) override fun status(): String = rh.gs(R.string.start_pump)
override fun log(): String = "START PUMP"
} }

View file

@ -23,4 +23,6 @@ class CommandStopPump(
} }
override fun status(): String = rh.gs(R.string.stop_pump) override fun status(): String = rh.gs(R.string.stop_pump)
override fun log(): String = "STOP PUMP"
} }

View file

@ -28,4 +28,6 @@ class CommandTempBasalAbsolute(
} }
override fun status(): String = rh.gs(R.string.temp_basal_absolute, absoluteRate, durationInMinutes) override fun status(): String = rh.gs(R.string.temp_basal_absolute, absoluteRate, durationInMinutes)
override fun log(): String = "TEMP BASAL $absoluteRate U/h $durationInMinutes min"
} }

View file

@ -32,4 +32,6 @@ class CommandTempBasalPercent(
} }
override fun status(): String = rh.gs(R.string.temp_basal_percent, percent, durationInMinutes) override fun status(): String = rh.gs(R.string.temp_basal_percent, percent, durationInMinutes)
override fun log(): String = "TEMP BASAL $percent% $durationInMinutes min"
} }

View file

@ -45,6 +45,7 @@ abstract class Command(
abstract fun execute() abstract fun execute()
abstract fun status(): String abstract fun status(): String
abstract fun log(): String
fun cancel() { fun cancel() {
val result = PumpEnactResult(injector) val result = PumpEnactResult(injector)