Replace all remaining ValueWithUnit by XXXValueWithUnit and remove Deprecated uel.log functions
This commit is contained in:
parent
442e64e3f0
commit
dc87bfa303
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.activities
|
|||
import android.os.Bundle
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.databinding.ActivityStatsBinding
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.utils.ActivityMonitor
|
||||
|
@ -32,7 +33,7 @@ class StatsActivity : NoSplashAppCompatActivity() {
|
|||
binding.ok.setOnClickListener { finish() }
|
||||
binding.reset.setOnClickListener {
|
||||
OKDialog.showConfirmation(this, resourceHelper.gs(R.string.doyouwantresetstats)) {
|
||||
uel.log(Action.STAT_RESET)
|
||||
uel.log(Action.STAT_RESET, Sources.Stats)
|
||||
activityMonitor.reset()
|
||||
recreate()
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import androidx.fragment.app.FragmentActivity
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.events.EventAppInitialized
|
||||
import info.nightscout.androidaps.events.EventConfigBuilderChange
|
||||
import info.nightscout.androidaps.events.EventRebuildTabs
|
||||
|
@ -143,7 +144,7 @@ class ConfigBuilderPlugin @Inject constructor(
|
|||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.allow_hardware_pump_text), Runnable {
|
||||
performPluginSwitch(changedPlugin, newState, type)
|
||||
sp.putBoolean("allow_hardware_pump", true)
|
||||
uel.log(Action.HW_PUMP_ALLOWED)
|
||||
uel.log(Action.HW_PUMP_ALLOWED, Sources.ConfigBuilder)
|
||||
aapsLogger.debug(LTag.PUMP, "First time HW pump allowed!")
|
||||
}, Runnable {
|
||||
rxBus.send(EventConfigBuilderUpdateGui())
|
||||
|
|
|
@ -19,8 +19,6 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.databinding.ObjectivesFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.ObjectivesItemBinding
|
||||
|
@ -312,10 +310,8 @@ class ObjectivesFragment : DaggerFragment() {
|
|||
holder.binding.unstart.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.objectives), resourceHelper.gs(R.string.doyouwantresetstart), Runnable {
|
||||
//uel.log(Action.OBJECTIVE_UNSTARTED, XXXValueWithUnit.SimpleInt(position + 1))
|
||||
uel.log(Action.OBJECTIVE_UNSTARTED,
|
||||
ValueWithUnit(Sources.Objectives),
|
||||
ValueWithUnit(position + 1, Units.None))
|
||||
uel.log(Action.OBJECTIVE_UNSTARTED, Sources.Objectives,
|
||||
XXXValueWithUnit.SimpleInt(position + 1))
|
||||
objective.startedOn = 0
|
||||
scrollToCurrentObjective()
|
||||
rxBus.send(EventObjectivesUpdateGui())
|
||||
|
|
|
@ -9,7 +9,6 @@ import info.nightscout.androidaps.Config
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
|
@ -145,7 +144,7 @@ class ObjectivesPlugin @Inject constructor(
|
|||
sp.putLong("Objectives_" + "auto" + "_accomplished", DateUtil.now())
|
||||
setupObjectives()
|
||||
OKDialog.show(activity, resourceHelper.gs(R.string.objectives), resourceHelper.gs(R.string.codeaccepted))
|
||||
uel.log(Action.OBJECTIVES_SKIPPED, ValueWithUnit(Sources.Objectives))
|
||||
uel.log(Action.OBJECTIVES_SKIPPED, Sources.Objectives)
|
||||
} else {
|
||||
OKDialog.show(activity, resourceHelper.gs(R.string.objectives), resourceHelper.gs(R.string.codeinvalid))
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
}
|
||||
extendedBolusCancel?.setOnClickListener {
|
||||
if (activePlugin.activeTreatments.isInHistoryExtendedBolusInProgress) {
|
||||
uel.log(Action.CANCEL_EXTENDED_BOLUS, ValueWithUnit(Sources.Actions))
|
||||
uel.log(Action.CANCEL_EXTENDED_BOLUS, Sources.Actions)
|
||||
commandQueue.cancelExtended(object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
@ -172,7 +172,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
}
|
||||
cancelTempBasal?.setOnClickListener {
|
||||
if (activePlugin.activeTreatments.isTempBasalInProgress) {
|
||||
uel.log(Action.CANCEL_TEMP_BASAL, ValueWithUnit(Sources.Actions))
|
||||
uel.log(Action.CANCEL_TEMP_BASAL, Sources.Actions)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
|
|
@ -76,7 +76,7 @@ class FoodFragment : DaggerFragment() {
|
|||
binding.refreshFromNightscout.setOnClickListener {
|
||||
context?.let { context ->
|
||||
OKDialog.showConfirmation(context, resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", {
|
||||
uel.log(Action.FOOD, ValueWithUnit(Sources.Food))
|
||||
uel.log(Action.FOOD, Sources.Food)
|
||||
disposable += Completable.fromAction { repository.deleteAllFoods() }
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
|
@ -252,7 +252,7 @@ class FoodFragment : DaggerFragment() {
|
|||
val food = v.tag as Food
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord) + "\n" + food.name, {
|
||||
uel.log(Action.FOOD_REMOVED, food.name)
|
||||
uel.log(Action.FOOD_REMOVED, Sources.Food, food.name)
|
||||
disposable += repository.runTransactionForResult(InvalidateFoodTransaction(food.id))
|
||||
.subscribe(
|
||||
{ aapsLogger.error(LTag.DATABASE, "Invalidated food $it") },
|
||||
|
|
|
@ -18,7 +18,6 @@ import info.nightscout.androidaps.activities.PreferencesActivity
|
|||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.events.EventAppExit
|
||||
import info.nightscout.androidaps.interfaces.ConfigInterface
|
||||
import info.nightscout.androidaps.interfaces.ImportExportPrefsInterface
|
||||
|
@ -350,7 +349,7 @@ class ImportExportPrefs @Inject constructor(
|
|||
private fun restartAppAfterImport(context: Context) {
|
||||
sp.putBoolean(R.string.key_setupwizard_processed, true)
|
||||
OKDialog.show(context, resourceHelper.gs(R.string.setting_imported), resourceHelper.gs(R.string.restartingapp)) {
|
||||
uel.log(Action.IMPORT_SETTINGS, ValueWithUnit(Sources.Maintenance))
|
||||
uel.log(Action.IMPORT_SETTINGS, Sources.Maintenance)
|
||||
log.debug(LTag.CORE, "Exiting")
|
||||
rxBus.send(EventAppExit())
|
||||
if (context is AppCompatActivity) {
|
||||
|
|
|
@ -10,7 +10,6 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.databinding.MaintenanceFragmentBinding
|
||||
import info.nightscout.androidaps.events.EventNewBG
|
||||
import info.nightscout.androidaps.interfaces.DataSyncSelector
|
||||
|
@ -58,7 +57,7 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
super.onViewCreated(view, savedInstanceState)
|
||||
binding.logSend.setOnClickListener { maintenancePlugin.sendLogs() }
|
||||
binding.logDelete.setOnClickListener {
|
||||
uel.log(Action.DELETE_LOGS, ValueWithUnit(Sources.Maintenance))
|
||||
uel.log(Action.DELETE_LOGS, Sources.Maintenance)
|
||||
maintenancePlugin.deleteLogs()
|
||||
}
|
||||
binding.navResetdb.setOnClickListener {
|
||||
|
@ -77,19 +76,19 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
onComplete = { rxBus.send(EventNewBG(null)) }
|
||||
)
|
||||
)
|
||||
uel.log(Action.RESET_DATABASES, ValueWithUnit(Sources.Maintenance))
|
||||
uel.log(Action.RESET_DATABASES, Sources.Maintenance)
|
||||
})
|
||||
}
|
||||
}
|
||||
binding.navExport.setOnClickListener {
|
||||
uel.log(Action.EXPORT_SETTINGS, ValueWithUnit(Sources.Maintenance))
|
||||
uel.log(Action.EXPORT_SETTINGS, Sources.Maintenance)
|
||||
// start activity for checking permissions...
|
||||
importExportPrefs.verifyStoragePermissions(this) {
|
||||
importExportPrefs.exportSharedPreferences(this)
|
||||
}
|
||||
}
|
||||
binding.navImport.setOnClickListener {
|
||||
uel.log(Action.IMPORT_SETTINGS, ValueWithUnit(Sources.Maintenance))
|
||||
uel.log(Action.IMPORT_SETTINGS, Sources.Maintenance)
|
||||
// start activity for checking permissions...
|
||||
importExportPrefs.verifyStoragePermissions(this) {
|
||||
importExportPrefs.importSharedPreferences(this)
|
||||
|
@ -99,7 +98,7 @@ class MaintenanceFragment : DaggerFragment() {
|
|||
binding.exportCsv.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.ue_export_to_csv) + "?") {
|
||||
uel.log(Action.EXPORT_CSV, ValueWithUnit(Sources.Maintenance))
|
||||
uel.log(Action.EXPORT_CSV, Sources.Maintenance)
|
||||
importExportPrefs.exportUserEntriesCsv(activity, repository.getAllUserEntries())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,15 +6,13 @@ import androidx.work.Worker
|
|||
import androidx.work.WorkerParameters
|
||||
import androidx.work.workDataOf
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.transactions.SyncNsBolusTransaction
|
||||
import info.nightscout.androidaps.database.transactions.SyncNsCarbsTransaction
|
||||
import info.nightscout.androidaps.database.transactions.SyncNsTemporaryTargetTransaction
|
||||
|
@ -93,17 +91,15 @@ class NSClientAddUpdateWorker(
|
|||
.blockingGet()
|
||||
.also { result ->
|
||||
result.inserted.forEach {
|
||||
uel.log(Action.CAREPORTAL,
|
||||
ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.timestamp, UserEntry.Units.Timestamp, true),
|
||||
ValueWithUnit(it.amount, UserEntry.Units.U)
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
XXXValueWithUnit.Timestamp(it.timestamp),
|
||||
XXXValueWithUnit.Insulin(it.amount)
|
||||
)
|
||||
}
|
||||
result.invalidated.forEach {
|
||||
uel.log(Action.CAREPORTAL_REMOVED,
|
||||
ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.timestamp, UserEntry.Units.Timestamp, true),
|
||||
ValueWithUnit(it.amount, UserEntry.Units.U)
|
||||
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
|
||||
XXXValueWithUnit.Timestamp(it.timestamp),
|
||||
XXXValueWithUnit.Insulin(it.amount)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -119,17 +115,15 @@ class NSClientAddUpdateWorker(
|
|||
.blockingGet()
|
||||
.also { result ->
|
||||
result.inserted.forEach {
|
||||
uel.log(Action.CAREPORTAL,
|
||||
ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.timestamp, Units.Timestamp, true),
|
||||
ValueWithUnit(it.amount, Units.G)
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
XXXValueWithUnit.Timestamp(it.timestamp),
|
||||
XXXValueWithUnit.Gram(it.amount.toInt())
|
||||
)
|
||||
}
|
||||
result.invalidated.forEach {
|
||||
uel.log(Action.CAREPORTAL,
|
||||
ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.timestamp, Units.Timestamp, true),
|
||||
ValueWithUnit(it.amount, Units.G)
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
XXXValueWithUnit.Timestamp(it.timestamp),
|
||||
XXXValueWithUnit.Gram(it.amount.toInt())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -146,48 +140,28 @@ class NSClientAddUpdateWorker(
|
|||
}
|
||||
.blockingGet()
|
||||
.also { result ->
|
||||
/*result.inserted.forEach { tt ->
|
||||
uel.log(UserEntry.Action.TT_FROM_NS,
|
||||
result.inserted.forEach { tt ->
|
||||
uel.log(Action.TT, Sources.NSClient,
|
||||
XXXValueWithUnit.TherapyEventTTReason(tt.reason),
|
||||
XXXValueWithUnit.Mgdl(tt.lowTarget),
|
||||
XXXValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget },
|
||||
XXXValueWithUnit.Minute(tt.duration.toInt() / 60000)*/
|
||||
result.inserted.forEach {
|
||||
uel.log(Action.TT,
|
||||
ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.reason.text, Units.TherapyEvent),
|
||||
ValueWithUnit(it.lowTarget, Units.Mg_Dl, true),
|
||||
ValueWithUnit(it.highTarget, Units.Mg_Dl, it.lowTarget != it.highTarget),
|
||||
ValueWithUnit(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt(), Units.M, true)
|
||||
XXXValueWithUnit.fromGlucoseUnit(tt.lowTarget, Constants.MGDL),
|
||||
XXXValueWithUnit.fromGlucoseUnit(tt.highTarget, Constants.MGDL).takeIf { tt.lowTarget != tt.highTarget },
|
||||
XXXValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt())
|
||||
)
|
||||
}
|
||||
/*result.invalidated.forEach { tt ->
|
||||
uel.log(UserEntry.Action.TT_DELETED_FROM_NS,
|
||||
result.invalidated.forEach { tt ->
|
||||
uel.log(Action.TT_REMOVED, Sources.NSClient,
|
||||
XXXValueWithUnit.TherapyEventTTReason(tt.reason),
|
||||
XXXValueWithUnit.Mgdl(tt.lowTarget),
|
||||
XXXValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget },
|
||||
XXXValueWithUnit.Minute(tt.duration.toInt() / 60000)*/
|
||||
result.invalidated.forEach {
|
||||
uel.log(Action.TT_REMOVED, ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.reason.text, Units.TherapyEvent),
|
||||
ValueWithUnit(it.lowTarget, Units.Mg_Dl, true),
|
||||
ValueWithUnit(it.highTarget, Units.Mg_Dl, it.lowTarget != it.highTarget),
|
||||
ValueWithUnit(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt(), Units.M, true)
|
||||
XXXValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt())
|
||||
)
|
||||
}
|
||||
/*result.ended.forEach { tt ->
|
||||
uel.log(UserEntry.Action.TT_CANCELED_FROM_NS,
|
||||
result.ended.forEach { tt ->
|
||||
uel.log(Action.CANCEL_TT, Sources.NSClient,
|
||||
XXXValueWithUnit.TherapyEventTTReason(tt.reason),
|
||||
XXXValueWithUnit.Mgdl(tt.lowTarget),
|
||||
XXXValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget },
|
||||
XXXValueWithUnit.Minute(tt.duration.toInt() / 60000)
|
||||
*/
|
||||
result.ended.forEach {
|
||||
uel.log(Action.CANCEL_TT, ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.reason.text, Units.TherapyEvent),
|
||||
ValueWithUnit(it.lowTarget, Units.Mg_Dl, true),
|
||||
ValueWithUnit(it.highTarget, Units.Mg_Dl, it.lowTarget != it.highTarget),
|
||||
ValueWithUnit(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt(), Units.M, true)
|
||||
XXXValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -210,32 +184,18 @@ class NSClientAddUpdateWorker(
|
|||
}
|
||||
.blockingGet()
|
||||
.also { result ->
|
||||
/*result.inserted.forEach {
|
||||
uel.log(UserEntry.Action.CAREPORTAL_FROM_NS,
|
||||
result.inserted.forEach {
|
||||
uel.log(Action.CAREPORTAL, Sources.NSClient,
|
||||
it.note ?: "",
|
||||
XXXValueWithUnit.Timestamp(it.timestamp),
|
||||
XXXValueWithUnit.TherapyEventType(it.type)
|
||||
*/
|
||||
result.inserted.forEach {
|
||||
uel.log(Action.CAREPORTAL,
|
||||
it.note ?: "",
|
||||
ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.timestamp, Units.Timestamp, true),
|
||||
ValueWithUnit(it.type.text, Units.TherapyEvent)
|
||||
)
|
||||
}
|
||||
/*result.invalidated.forEach {
|
||||
uel.log(UserEntry.Action.CAREPORTAL_DELETED_FROM_NS,
|
||||
result.invalidated.forEach {
|
||||
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
|
||||
it.note ?: "",
|
||||
XXXValueWithUnit.Timestamp(it.timestamp),
|
||||
XXXValueWithUnit.TherapyEventType(it.type)
|
||||
*/
|
||||
result.invalidated.forEach {
|
||||
uel.log(UserEntry.Action.CAREPORTAL_REMOVED,
|
||||
it.note ?: "",
|
||||
ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.timestamp, Units.Timestamp, true),
|
||||
ValueWithUnit(it.type.text, Units.TherapyEvent)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@ import dagger.android.support.DaggerFragment
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.databinding.NsClientFragmentBinding
|
||||
import info.nightscout.androidaps.interfaces.DataSyncSelector
|
||||
import info.nightscout.androidaps.interfaces.UploadQueueAdminInterface
|
||||
|
@ -64,7 +62,7 @@ class NSClientFragment : DaggerFragment() {
|
|||
|
||||
binding.paused.isChecked = nsClientPlugin.paused
|
||||
binding.paused.setOnCheckedChangeListener { _, isChecked ->
|
||||
uel.log(if (isChecked) Action.NS_PAUSED else Action.NS_RESUME, ValueWithUnit(Sources.NSClient))
|
||||
uel.log(if (isChecked) Action.NS_PAUSED else Action.NS_RESUME, Sources.NSClient)
|
||||
nsClientPlugin.pause(isChecked)
|
||||
updateGui()
|
||||
}
|
||||
|
@ -77,7 +75,7 @@ class NSClientFragment : DaggerFragment() {
|
|||
binding.clearQueue.setOnClickListener {
|
||||
context?.let { context ->
|
||||
OKDialog.showConfirmation(context, resourceHelper.gs(R.string.nsclientinternal), resourceHelper.gs(R.string.clearqueueconfirm), Runnable {
|
||||
uel.log(Action.NS_QUEUE_CLEARED, ValueWithUnit(Sources.NSClient))
|
||||
uel.log(Action.NS_QUEUE_CLEARED, Sources.NSClient)
|
||||
uploadQueue.clearQueue()
|
||||
updateGui()
|
||||
})
|
||||
|
|
|
@ -10,8 +10,6 @@ import info.nightscout.androidaps.database.AppRepository
|
|||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.transactions.SyncNsBolusTransaction
|
||||
import info.nightscout.androidaps.database.transactions.SyncNsCarbsTransaction
|
||||
import info.nightscout.androidaps.database.transactions.SyncNsTemporaryTargetTransaction
|
||||
|
@ -73,23 +71,13 @@ class NSClientRemoveWorker(
|
|||
}
|
||||
.blockingGet()
|
||||
.also { result ->
|
||||
/*result.invalidated.forEach { tt ->
|
||||
result.invalidated.forEach { tt ->
|
||||
uel.log(
|
||||
UserEntry.Action.TT_DELETED_FROM_NS,
|
||||
Action.TT_REMOVED, Sources.NSClient,
|
||||
XXXValueWithUnit.TherapyEventTTReason(tt.reason),
|
||||
XXXValueWithUnit.Mgdl(tt.lowTarget),
|
||||
XXXValueWithUnit.Mgdl(tt.highTarget).takeIf { tt.lowTarget != tt.highTarget },
|
||||
XXXValueWithUnit.Minute(tt.duration.toInt() / 60000).takeIf { tt.duration != 0L }
|
||||
)
|
||||
}
|
||||
*/
|
||||
result.invalidated.forEach {
|
||||
uel.log(Action.TT_REMOVED,
|
||||
ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.reason.text, Units.TherapyEvent),
|
||||
ValueWithUnit(it.lowTarget, Units.Mg_Dl, true),
|
||||
ValueWithUnit(it.highTarget, Units.Mg_Dl, it.lowTarget != it.highTarget),
|
||||
ValueWithUnit(TimeUnit.MILLISECONDS.toMinutes(it.duration).toInt(), Units.M, it.duration != 0L)
|
||||
XXXValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt.duration).toInt()).takeIf { tt.duration != 0L }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -104,16 +92,10 @@ class NSClientRemoveWorker(
|
|||
.blockingGet()
|
||||
.also { result ->
|
||||
result.invalidated.forEach {
|
||||
/*uel.log(
|
||||
UserEntry.Action.CAREPORTAL_DELETED_FROM_NS, (it.note ?: ""),
|
||||
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
|
||||
(it.note ?: ""),
|
||||
XXXValueWithUnit.Timestamp(it.timestamp),
|
||||
XXXValueWithUnit.TherapyEventType(it.type))
|
||||
*/
|
||||
uel.log(Action.CAREPORTAL_REMOVED, (it.note ?: ""),
|
||||
ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.timestamp, Units.Timestamp, true),
|
||||
ValueWithUnit(it.type.text, Units.TherapyEvent))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,10 +109,9 @@ class NSClientRemoveWorker(
|
|||
.blockingGet()
|
||||
.also { result ->
|
||||
result.invalidated.forEach {
|
||||
uel.log(Action.CAREPORTAL_REMOVED,
|
||||
ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.timestamp, Units.Timestamp, true),
|
||||
ValueWithUnit(it.amount, Units.U))
|
||||
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
|
||||
XXXValueWithUnit.Timestamp(it.timestamp),
|
||||
XXXValueWithUnit.Insulin(it.amount))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,10 +125,9 @@ class NSClientRemoveWorker(
|
|||
.blockingGet()
|
||||
.also { result ->
|
||||
result.invalidated.forEach {
|
||||
uel.log(Action.CAREPORTAL_REMOVED,
|
||||
ValueWithUnit(Sources.NSClient),
|
||||
ValueWithUnit(it.timestamp, Units.Timestamp, true),
|
||||
ValueWithUnit(it.amount, Units.G))
|
||||
uel.log(Action.CAREPORTAL_REMOVED, Sources.NSClient,
|
||||
XXXValueWithUnit.Timestamp(it.timestamp),
|
||||
XXXValueWithUnit.Gram(it.amount.toInt()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.general.nsclient.data
|
|||
import android.content.Context
|
||||
import info.nightscout.androidaps.Config
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
|
@ -246,7 +247,7 @@ class NSSettingsStatus @Inject constructor(
|
|||
getExtendedWarnValue("sage", "urgent")?.let { sp.putDouble(R.string.key_statuslights_sage_critical, it) }
|
||||
getExtendedWarnValue("bage", "warn")?.let { sp.putDouble(R.string.key_statuslights_bage_warning, it) }
|
||||
getExtendedWarnValue("bage", "urgent")?.let { sp.putDouble(R.string.key_statuslights_bage_critical, it) }
|
||||
uel.log(Action.NS_SETTINGS_COPIED)
|
||||
uel.log(Action.NS_SETTINGS_COPIED, UserEntry.Sources.NSClient)
|
||||
}
|
||||
|
||||
if (context != null) OKDialog.showConfirmation(context, resourceHelper.gs(R.string.statuslights), resourceHelper.gs(R.string.copyexistingvalues), action)
|
||||
|
|
|
@ -31,7 +31,8 @@ import info.nightscout.androidaps.data.Profile
|
|||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.ValueWrapper
|
||||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.*
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.interfaces.end
|
||||
import info.nightscout.androidaps.databinding.OverviewFragmentBinding
|
||||
import info.nightscout.androidaps.dialogs.*
|
||||
|
@ -351,7 +352,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
protectionCheck.queryProtection(activity, ProtectionCheck.Protection.BOLUS, UIRunnable {
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.tempbasal_label), lastRun.constraintsProcessed?.toSpanned()
|
||||
?: "".toSpanned(), {
|
||||
uel.log(Action.ACCEPTS_TEMP_BASAL)
|
||||
uel.log(Action.ACCEPTS_TEMP_BASAL, Sources.Overview)
|
||||
binding.buttonsLayout.acceptTempButton.visibility = View.GONE
|
||||
(context?.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager).cancel(Constants.notificationID)
|
||||
rxBus.send(EventWearInitiateAction("cancelChangeRequest"))
|
||||
|
|
|
@ -21,8 +21,6 @@ import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
|||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
|
||||
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
|
@ -342,7 +340,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
uel.log(Action.LOOP_DISABLED, ValueWithUnit(Sources.SMS))
|
||||
uel.log(Action.LOOP_DISABLED, Sources.SMS)
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, false)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
|
@ -366,7 +364,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
uel.log(Action.LOOP_ENABLED, ValueWithUnit(Sources.SMS))
|
||||
uel.log(Action.LOOP_ENABLED, Sources.SMS)
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.smscommunicator_loophasbeenenabled)))
|
||||
rxBus.send(EventRefreshOverview("SMS_LOOP_START"))
|
||||
|
@ -393,7 +391,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
uel.log(Action.RESUME, ValueWithUnit(Sources.SMS))
|
||||
uel.log(Action.RESUME, Sources.SMS)
|
||||
loopPlugin.suspendTo(0L)
|
||||
rxBus.send(EventRefreshOverview("SMS_LOOP_RESUME"))
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
|
@ -426,7 +424,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction(duration) {
|
||||
override fun run() {
|
||||
uel.log(Action.SUSPEND, ValueWithUnit(Sources.SMS))
|
||||
uel.log(Action.SUSPEND, Sources.SMS)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (result.success) {
|
||||
|
@ -500,7 +498,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
uel.log(Action.RECONNECT, ValueWithUnit(Sources.SMS))
|
||||
uel.log(Action.RECONNECT, Sources.SMS)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
@ -529,7 +527,7 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
receivedSms.processed = true
|
||||
messageToConfirm = AuthRequest(injector, receivedSms, reply, passCode, object : SmsAction() {
|
||||
override fun run() {
|
||||
uel.log(Action.DISCONNECT, ValueWithUnit(Sources.SMS))
|
||||
uel.log(Action.DISCONNECT, Sources.SMS)
|
||||
val profile = profileFunction.getProfile()
|
||||
loopPlugin.disconnectPump(duration, profile)
|
||||
rxBus.send(EventRefreshOverview("SMS_PUMP_DISCONNECT"))
|
||||
|
@ -586,8 +584,8 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
activePlugin.activeTreatments.doProfileSwitch(store, list[pIndex - 1] as String, 0, finalPercentage, 0, DateUtil.now())
|
||||
val replyText = resourceHelper.gs(R.string.profileswitchcreated)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_PROFILE, XXXValueWithUnit.StringResource(R.string.profileswitchcreated))
|
||||
uel.log(Action.PROFILE_SWITCH, ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.profileswitchcreated, Units.R_String))
|
||||
uel.log(Action.PROFILE_SWITCH, Sources.SMS,
|
||||
XXXValueWithUnit.StringResource(R.string.profileswitchcreated))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -609,14 +607,14 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalcanceled)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalcanceled))
|
||||
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalcanceled, Units.R_String))
|
||||
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalcanceled))
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalcancelfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalcancelfailed))
|
||||
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalcancelfailed, Units.R_String))
|
||||
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalcancelfailed))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -645,17 +643,19 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
if (result.isPercent)
|
||||
//uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset_percent, listOf(XXXValueWithUnit.Percent(result.percent), XXXValueWithUnit.Minute(result.duration))) )
|
||||
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalset_percent, 2), ValueWithUnit(result.percent, Units.Percent), ValueWithUnit(result.duration, Units.M))
|
||||
uel.log(Action.TEMP_BASAL, Sources.SMS,
|
||||
activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset_percent, listOf(XXXValueWithUnit.Percent(result.percent), XXXValueWithUnit.Minute(result.duration))) )
|
||||
else
|
||||
//uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset, listOf( XXXValueWithUnit.UnitPerHour(result.absolute), XXXValueWithUnit.Minute(result.duration))))
|
||||
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalset, 2), ValueWithUnit(result.absolute, Units.U_H), ValueWithUnit(result.duration, Units.M))
|
||||
uel.log(Action.TEMP_BASAL, Sources.SMS,
|
||||
activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset, listOf( XXXValueWithUnit.UnitPerHour(result.absolute), XXXValueWithUnit.Minute(result.duration))))
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalfailed))
|
||||
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalfailed, Units.R_String))
|
||||
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalfailed))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -686,17 +686,17 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
if (result.isPercent)
|
||||
//uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset_percent, listOf(XXXValueWithUnit.Percent(result.percent), XXXValueWithUnit.Minute(result.duration))))
|
||||
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalset_percent, 2), ValueWithUnit(result.percent, Units.Percent), ValueWithUnit(result.duration, Units.M))
|
||||
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset_percent, listOf(XXXValueWithUnit.Percent(result.percent), XXXValueWithUnit.Minute(result.duration))))
|
||||
else
|
||||
//uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset, listOf(XXXValueWithUnit.UnitPerHour(result.absolute), XXXValueWithUnit.Minute(result.duration))))
|
||||
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalset, 2), ValueWithUnit(result.absolute, Units.U_H), ValueWithUnit(result.duration, Units.M))
|
||||
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalset, listOf(XXXValueWithUnit.UnitPerHour(result.absolute), XXXValueWithUnit.Minute(result.duration))))
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_tempbasalfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_BASAL, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalfailed))
|
||||
uel.log(Action.TEMP_BASAL, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_tempbasalfailed, Units.R_String))
|
||||
uel.log(Action.TEMP_BASAL, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_tempbasalfailed))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -723,8 +723,8 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
var replyText = resourceHelper.gs(R.string.smscommunicator_extendedcancelfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedcanceled))
|
||||
uel.log(Action.EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_extendedcanceled, Units.R_String))
|
||||
uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedcanceled))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -751,21 +751,18 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
if (config.APS)
|
||||
//uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedset, listOf(XXXValueWithUnit.Insulin(aDouble
|
||||
// ?: 0.0), XXXValueWithUnit.Minute(duration))), XXXValueWithUnit.StringResource(R.string.loopsuspended))
|
||||
uel.log(Action.EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_extendedset, 2), ValueWithUnit(aDouble
|
||||
?: 0.0, Units.U), ValueWithUnit(duration, Units.M), ValueWithUnit(R.string.loopsuspended, Units.R_String))
|
||||
uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedset, listOf(XXXValueWithUnit.Insulin(aDouble ?: 0.0), XXXValueWithUnit.Minute(duration))),
|
||||
XXXValueWithUnit.StringResource(R.string.loopsuspended))
|
||||
else
|
||||
//uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedset, listOf( XXXValueWithUnit.Insulin(aDouble
|
||||
// ?: 0.0), XXXValueWithUnit.Minute(duration))))
|
||||
uel.log(Action.EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_extendedset, 2), ValueWithUnit(aDouble
|
||||
?: 0.0, Units.U), ValueWithUnit(duration, Units.M))
|
||||
uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedset, listOf( XXXValueWithUnit.Insulin(aDouble ?: 0.0), XXXValueWithUnit.Minute(duration))))
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_extendedfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedfailed))
|
||||
uel.log(Action.EXTENDED_BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_extendedfailed, Units.R_String))
|
||||
uel.log(Action.EXTENDED_BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_extendedfailed))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -837,13 +834,13 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
}
|
||||
}
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
uel.log(Action.BOLUS, replyText, ValueWithUnit(Sources.SMS))
|
||||
uel.log(Action.BOLUS, Sources.SMS, replyText)
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_bolusfailed)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_BOLUS, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_bolusfailed))
|
||||
uel.log(Action.BOLUS, activePlugin.activePump.shortStatus(true), ValueWithUnit(Sources.SMS), ValueWithUnit(R.string.smscommunicator_bolusfailed, Units.R_String))
|
||||
uel.log(Action.BOLUS, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_bolusfailed))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -881,23 +878,14 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
var replyText = String.format(resourceHelper.gs(R.string.smscommunicator_carbsset), anInteger)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_CARBS, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_carbsset, listOf(XXXValueWithUnit.Gram(anInteger ?: 0))))
|
||||
uel.log(Action.CARBS,
|
||||
activePlugin.activePump.shortStatus(true),
|
||||
ValueWithUnit(Sources.SMS),
|
||||
ValueWithUnit(R.string.smscommunicator_carbsset, 1),
|
||||
ValueWithUnit(anInteger ?: 0, Units.G))
|
||||
uel.log(Action.CARBS, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_carbsset, listOf(XXXValueWithUnit.Gram(anInteger ?: 0))))
|
||||
} else {
|
||||
var replyText = resourceHelper.gs(R.string.smscommunicator_carbsfailed, anInteger)
|
||||
replyText += "\n" + activePlugin.activePump.shortStatus(true)
|
||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_CARBS, activePlugin.activePump.shortStatus(true), XXXValueWithUnit.StringResource(R.string.smscommunicator_carbsfailed, listOf(XXXValueWithUnit.Gram(anInteger
|
||||
// ?: 0))))
|
||||
uel.log(Action.CARBS,
|
||||
activePlugin.activePump.shortStatus(true),
|
||||
ValueWithUnit(Sources.SMS),
|
||||
ValueWithUnit(R.string.smscommunicator_carbsfailed, 1),
|
||||
ValueWithUnit(anInteger ?: 0, Units.G))
|
||||
uel.log(Action.CARBS, Sources.SMS, activePlugin.activePump.shortStatus(true),
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_carbsfailed, listOf(XXXValueWithUnit.Gram(anInteger ?: 0))))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -968,12 +956,9 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
val ttString = if (units == Constants.MMOL) DecimalFormatter.to1Decimal(tt) else DecimalFormatter.to0Decimal(tt)
|
||||
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_tt_set), ttString, ttDuration)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_TT, ValueWithUnit(R.string.smscommunicator_tt_set, 2), ValueWithUnit(tt, units), ValueWithUnit(ttDuration, Units.M))
|
||||
//uel.log(Action.SMS_TT, XXXValueWithUnit.fromGlucoseUnit(tt, units), XXXValueWithUnit.Minute(ttDuration))
|
||||
uel.log(Action.TT,
|
||||
ValueWithUnit(Sources.SMS),
|
||||
ValueWithUnit(tt, units),
|
||||
ValueWithUnit(ttDuration, Units.M))
|
||||
uel.log(Action.TT, Sources.SMS,
|
||||
XXXValueWithUnit.fromGlucoseUnit(tt, units),
|
||||
XXXValueWithUnit.Minute(ttDuration))
|
||||
}
|
||||
})
|
||||
} else if (isStop) {
|
||||
|
@ -990,10 +975,8 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
})
|
||||
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_tt_canceled))
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_TT, XXXValueWithUnit.StringResource(R.string.smscommunicator_tt_canceled))
|
||||
uel.log(Action.CANCEL_TT,
|
||||
ValueWithUnit(Sources.SMS),
|
||||
ValueWithUnit(R.string.smscommunicator_tt_canceled, Units.R_String))
|
||||
uel.log(Action.CANCEL_TT, Sources.SMS,
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_tt_canceled))
|
||||
}
|
||||
})
|
||||
} else
|
||||
|
@ -1012,10 +995,8 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
sp.putBoolean(R.string.key_smscommunicator_remotecommandsallowed, false)
|
||||
val replyText = String.format(resourceHelper.gs(R.string.smscommunicator_stoppedsms))
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
//uel.log(Action.SMS_SMS, XXXValueWithUnit.StringResource(R.string.smscommunicator_stoppedsms))
|
||||
uel.log(Action.STOP_SMS,
|
||||
ValueWithUnit(Sources.SMS),
|
||||
ValueWithUnit(R.string.smscommunicator_stoppedsms, Units.R_String))
|
||||
uel.log(Action.STOP_SMS, Sources.SMS,
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_stoppedsms))
|
||||
}
|
||||
})
|
||||
} else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
|
||||
|
@ -1034,15 +1015,11 @@ class SmsCommunicatorPlugin @Inject constructor(
|
|||
if (result) resourceHelper.gs(R.string.smscommunicator_calibrationsent) else resourceHelper.gs(R.string.smscommunicator_calibrationfailed)
|
||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||
if (result)
|
||||
//uel.log(Action.SMS_CAL, XXXValueWithUnit.StringResource(R.string.smscommunicator_calibrationsent))
|
||||
uel.log(Action.CALIBRATION,
|
||||
ValueWithUnit(Sources.SMS),
|
||||
ValueWithUnit(R.string.smscommunicator_calibrationsent, Units.R_String))
|
||||
uel.log(Action.CALIBRATION, Sources.SMS,
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_calibrationsent))
|
||||
else
|
||||
//uel.log(Action.SMS_CAL, XXXValueWithUnit.StringResource(R.string.smscommunicator_calibrationfailed))
|
||||
uel.log(Action.CALIBRATION,
|
||||
ValueWithUnit(Sources.SMS),
|
||||
ValueWithUnit(R.string.smscommunicator_calibrationfailed, Units.R_String))
|
||||
uel.log(Action.CALIBRATION, Sources.SMS,
|
||||
XXXValueWithUnit.StringResource(R.string.smscommunicator_calibrationfailed))
|
||||
}
|
||||
})
|
||||
} else sendSMS(Sms(receivedSms.phoneNumber, resourceHelper.gs(R.string.wrongformat)))
|
||||
|
|
|
@ -76,7 +76,7 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
|
|||
resourceHelper.gs(R.string.smscommunicator_otp_reset_title),
|
||||
resourceHelper.gs(R.string.smscommunicator_otp_reset_prompt),
|
||||
Runnable {
|
||||
uel.log(Action.OTP_RESET, ValueWithUnit(Sources.SMS))
|
||||
uel.log(Action.OTP_RESET, Sources.SMS)
|
||||
otp.ensureKey(true)
|
||||
updateGui()
|
||||
ToastUtils.Long.infoToast(this, resourceHelper.gs(R.string.smscommunicator_otp_reset_successful))
|
||||
|
@ -92,7 +92,7 @@ class SmsCommunicatorOtpActivity : NoSplashAppCompatActivity() {
|
|||
val clip = ClipData.newPlainText("OTP Secret", otp.provisioningSecret())
|
||||
clipboard.primaryClip = clip
|
||||
ToastUtils.Long.infoToast(this, resourceHelper.gs(R.string.smscommunicator_otp_export_successful))
|
||||
uel.log(Action.OTP_EXPORT, ValueWithUnit(Sources.SMS))
|
||||
uel.log(Action.OTP_EXPORT, Sources.SMS)
|
||||
})
|
||||
|
||||
true
|
||||
|
|
|
@ -20,6 +20,7 @@ import info.nightscout.androidaps.database.entities.UserEntry.Action
|
|||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.database.interfaces.end
|
||||
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
|
||||
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
|
||||
|
@ -570,10 +571,9 @@ class ActionStringHandler @Inject constructor(
|
|||
return
|
||||
}
|
||||
//send profile to pump
|
||||
uel.log(Action.PROFILE_SWITCH,
|
||||
ValueWithUnit(Sources.Wear),
|
||||
ValueWithUnit(percentage, Units.Percent),
|
||||
ValueWithUnit(timeshift, Units.H, timeshift != 0))
|
||||
uel.log(Action.PROFILE_SWITCH, Sources.Wear,
|
||||
XXXValueWithUnit.Percent(percentage),
|
||||
XXXValueWithUnit.Hour(timeshift).takeIf { timeshift != 0 })
|
||||
activePlugin.activeTreatments.doProfileSwitch(0, percentage, timeshift)
|
||||
}
|
||||
|
||||
|
@ -591,9 +591,11 @@ class ActionStringHandler @Inject constructor(
|
|||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
|
||||
})
|
||||
uel.log(Action.TT,
|
||||
ValueWithUnit(Sources.Wear),
|
||||
ValueWithUnit(TemporaryTarget.Reason.WEAR.text, Units.TherapyEvent), ValueWithUnit(low, profileFunction.getUnits()), ValueWithUnit(high, profileFunction.getUnits(), low!=high), ValueWithUnit(duration, Units.M))
|
||||
uel.log(Action.TT, Sources.Wear,
|
||||
XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.WEAR),
|
||||
XXXValueWithUnit.fromGlucoseUnit(low, profileFunction.getUnits()),
|
||||
XXXValueWithUnit.fromGlucoseUnit(high, profileFunction.getUnits()).takeIf { low != high },
|
||||
XXXValueWithUnit.Minute(duration))
|
||||
} else {
|
||||
disposable += repository.runTransactionForResult(CancelCurrentTemporaryTargetIfAnyTransaction(System.currentTimeMillis()))
|
||||
.subscribe({ result ->
|
||||
|
@ -601,9 +603,8 @@ class ActionStringHandler @Inject constructor(
|
|||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
|
||||
})
|
||||
uel.log(Action.CANCEL_TT,
|
||||
ValueWithUnit(Sources.Wear),
|
||||
ValueWithUnit(TemporaryTarget.Reason.WEAR.text, Units.TherapyEvent))
|
||||
uel.log(Action.CANCEL_TT, Sources.Wear,
|
||||
XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.WEAR))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -611,7 +612,8 @@ class ActionStringHandler @Inject constructor(
|
|||
val detailedBolusInfo = DetailedBolusInfo()
|
||||
detailedBolusInfo.insulin = amount
|
||||
detailedBolusInfo.bolusType = DetailedBolusInfo.BolusType.PRIMING
|
||||
uel.log(Action.PRIME_BOLUS, ValueWithUnit(Sources.Wear), ValueWithUnit(amount, Units.U, amount != 0.0))
|
||||
uel.log(Action.PRIME_BOLUS, Sources.Wear,
|
||||
XXXValueWithUnit.Insulin(amount).takeIf { amount != 0.0 })
|
||||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
@ -624,7 +626,10 @@ class ActionStringHandler @Inject constructor(
|
|||
}
|
||||
|
||||
private fun doECarbs(carbs: Int, time: Long, duration: Int) {
|
||||
uel.log(if (duration==0) Action.CARBS else Action.EXTENDED_CARBS, ValueWithUnit(Sources.Wear), ValueWithUnit(time, Units.Timestamp), ValueWithUnit(carbs, Units.G), ValueWithUnit(duration, Units.H, duration !=0))
|
||||
uel.log(if (duration==0) Action.CARBS else Action.EXTENDED_CARBS, Sources.Wear,
|
||||
XXXValueWithUnit.Timestamp(time),
|
||||
XXXValueWithUnit.Gram(carbs),
|
||||
XXXValueWithUnit.Hour(duration).takeIf { duration !=0 })
|
||||
doBolus(0.0, carbs, time, duration)
|
||||
}
|
||||
|
||||
|
@ -642,11 +647,10 @@ class ActionStringHandler @Inject constructor(
|
|||
carbsDuration>0 -> Action.EXTENDED_CARBS
|
||||
else -> Action.TREATMENT
|
||||
}
|
||||
uel.log(action,
|
||||
ValueWithUnit(Sources.Wear),
|
||||
ValueWithUnit(amount, Units.U, amount != 0.0),
|
||||
ValueWithUnit(carbs, Units.G, carbs != 0),
|
||||
ValueWithUnit(carbsDuration, Units.H, carbsDuration != 0))
|
||||
uel.log(action, Sources.Wear,
|
||||
XXXValueWithUnit.Insulin(amount).takeIf { amount != 0.0 },
|
||||
XXXValueWithUnit.Gram(carbs).takeIf { carbs != 0 },
|
||||
XXXValueWithUnit.Hour(carbsDuration).takeIf { carbsDuration != 0 })
|
||||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
|
|
|
@ -14,8 +14,7 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.data.Profile
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.databinding.LocalprofileFragmentBinding
|
||||
import info.nightscout.androidaps.dialogs.ProfileSwitchDialog
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
|
@ -166,7 +165,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (localProfilePlugin.isEdited) {
|
||||
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
|
||||
} else {
|
||||
uel.log(Action.NEW_PROFILE, ValueWithUnit(Sources.LocalProfile))
|
||||
uel.log(Action.NEW_PROFILE, Sources.LocalProfile)
|
||||
localProfilePlugin.addNewProfile()
|
||||
build()
|
||||
}
|
||||
|
@ -176,7 +175,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (localProfilePlugin.isEdited) {
|
||||
activity?.let { OKDialog.show(it, "", resourceHelper.gs(R.string.saveorresetchangesfirst)) }
|
||||
} else {
|
||||
uel.log(Action.CLONE_PROFILE, ValueWithUnit(Sources.LocalProfile), ValueWithUnit(localProfilePlugin.currentProfile()?.name ?: "", Units.None))
|
||||
uel.log(Action.CLONE_PROFILE, Sources.LocalProfile, XXXValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
|
||||
localProfilePlugin.cloneProfile()
|
||||
build()
|
||||
}
|
||||
|
@ -185,7 +184,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
binding.profileRemove.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.deletecurrentprofile), {
|
||||
uel.log(Action.PROFILE_REMOVED, ValueWithUnit(Sources.LocalProfile), ValueWithUnit(localProfilePlugin.currentProfile()?.name ?: "", Units.None))
|
||||
uel.log(Action.PROFILE_REMOVED, Sources.LocalProfile, XXXValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
|
||||
localProfilePlugin.removeCurrentProfile()
|
||||
build()
|
||||
}, null)
|
||||
|
@ -213,7 +212,7 @@ class LocalProfileFragment : DaggerFragment() {
|
|||
if (!localProfilePlugin.isValidEditState()) {
|
||||
return@setOnClickListener //Should not happen as saveButton should not be visible if not valid
|
||||
}
|
||||
uel.log(Action.STORE_PROFILE, ValueWithUnit(Sources.LocalProfile), ValueWithUnit(localProfilePlugin.currentProfile()?.name ?: "", Units.None))
|
||||
uel.log(Action.STORE_PROFILE, Sources.LocalProfile, XXXValueWithUnit.SimpleString(localProfilePlugin.currentProfile()?.name ?: ""))
|
||||
localProfilePlugin.storeSettings(activity)
|
||||
build()
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.databinding.NsprofileFragmentBinding
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
|
@ -66,11 +64,9 @@ class NSProfileFragment : DaggerFragment() {
|
|||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.nsprofile),
|
||||
resourceHelper.gs(R.string.activate_profile) + ": " + name + " ?", Runnable {
|
||||
//uel.log(Action.PROFILE_SWITCH, XXXValueWithUnit.SimpleString(name), XXXValueWithUnit.Percent(100))
|
||||
uel.log(Action.PROFILE_SWITCH,
|
||||
ValueWithUnit(Sources.NSProfile),
|
||||
ValueWithUnit(name, Units.None),
|
||||
ValueWithUnit(100, Units.Percent))
|
||||
uel.log(Action.PROFILE_SWITCH, Sources.NSProfile,
|
||||
XXXValueWithUnit.SimpleString(name),
|
||||
XXXValueWithUnit.Percent(100))
|
||||
treatmentsPlugin.doProfileSwitch(store, name, 0, 100, 0, DateUtil.now())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@ import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
|||
import info.nightscout.androidaps.database.entities.GlucoseValue
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.transactions.InvalidateGlucoseValueTransaction
|
||||
import info.nightscout.androidaps.databinding.BgsourceFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.BgsourceItemBinding
|
||||
|
@ -134,9 +132,8 @@ class BGSourceFragment : DaggerFragment() {
|
|||
val text = dateUtil.dateAndTimeString(glucoseValue.timestamp) + "\n" + glucoseValue.valueToUnitsString(profileFunction.getUnits())
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
//uel.log(Action.BG_REMOVED, XXXValueWithUnit.Timestamp(glucoseValue.timestamp))
|
||||
uel.log(Action.BG_REMOVED,
|
||||
ValueWithUnit(Sources.BG),
|
||||
ValueWithUnit(glucoseValue.timestamp, Units.Timestamp))
|
||||
uel.log(Action.BG_REMOVED, Sources.BG,
|
||||
XXXValueWithUnit.Timestamp(glucoseValue.timestamp))
|
||||
disposable += repository.runTransaction(InvalidateGlucoseValueTransaction(glucoseValue.id)).subscribe()
|
||||
})
|
||||
}
|
||||
|
|
|
@ -15,8 +15,7 @@ import info.nightscout.androidaps.database.entities.BolusCalculatorResult
|
|||
import info.nightscout.androidaps.database.entities.Carbs
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.database.transactions.InvalidateBolusCalculatorResultTransaction
|
||||
import info.nightscout.androidaps.database.transactions.InvalidateBolusTransaction
|
||||
import info.nightscout.androidaps.database.transactions.InvalidateCarbsTransaction
|
||||
|
@ -93,7 +92,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
|
|||
binding.refreshFromNightscout.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") {
|
||||
uel.log(Action.TREATMENTS_NS_REFRESH, ValueWithUnit(Sources.Treatments))
|
||||
uel.log(Action.TREATMENTS_NS_REFRESH, Sources.Treatments)
|
||||
disposable +=
|
||||
Completable.fromAction {
|
||||
repository.deleteAllBolusCalculatorResults()
|
||||
|
@ -113,7 +112,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
|
|||
binding.deleteFutureTreatments.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.overview_treatment_label), resourceHelper.gs(R.string.deletefuturetreatments) + "?", Runnable {
|
||||
uel.log(Action.DELETE_FUTURE_TREATMENTS, ValueWithUnit(Sources.Treatments))
|
||||
uel.log(Action.DELETE_FUTURE_TREATMENTS, Sources.Treatments)
|
||||
repository
|
||||
.getBolusesDataFromTime(dateUtil._now(), false)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
|
@ -336,11 +335,10 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
|
|||
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(bolus.timestamp)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
uel.log(
|
||||
Action.TREATMENT_REMOVED,
|
||||
ValueWithUnit(Sources.Treatments),
|
||||
ValueWithUnit(bolus.timestamp, Units.Timestamp),
|
||||
ValueWithUnit(bolus.amount, Units.U)
|
||||
// ValueWithUnit(mealLinkLoaded.carbs.toInt(), Units.G)
|
||||
Action.TREATMENT_REMOVED, Sources.Treatments,
|
||||
XXXValueWithUnit.Timestamp(bolus.timestamp),
|
||||
XXXValueWithUnit.Insulin(bolus.amount)
|
||||
//XXXValueWithUnit.Gram(mealLinkLoaded.carbs.toInt())
|
||||
)
|
||||
disposable += repository.runTransactionForResult(InvalidateBolusTransaction(bolus.id))
|
||||
.subscribe(
|
||||
|
@ -359,11 +357,9 @@ class TreatmentsBolusCarbsFragment : DaggerFragment() {
|
|||
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(carb.timestamp)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
uel.log(
|
||||
Action.TREATMENT_REMOVED,
|
||||
ValueWithUnit(Sources.Treatments),
|
||||
ValueWithUnit(carb.timestamp, Units.Timestamp),
|
||||
ValueWithUnit(carb.amount, Units.G)
|
||||
)
|
||||
Action.TREATMENT_REMOVED, Sources.Treatments,
|
||||
XXXValueWithUnit.Timestamp(carb.timestamp),
|
||||
XXXValueWithUnit.Gram(carb.amount.toInt()))
|
||||
disposable += repository.runTransactionForResult(InvalidateCarbsTransaction(carb.id))
|
||||
.subscribe(
|
||||
{ result -> result.invalidated.forEach { aapsLogger.debug(LTag.DATABASE, "Invalidated carbs $it") } },
|
||||
|
|
|
@ -14,8 +14,6 @@ import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
|||
import info.nightscout.androidaps.database.entities.TherapyEvent
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.transactions.InvalidateAAPSStartedTherapyEventTransaction
|
||||
import info.nightscout.androidaps.database.transactions.InvalidateTherapyEventTransaction
|
||||
import info.nightscout.androidaps.databinding.TreatmentsCareportalFragmentBinding
|
||||
|
@ -79,7 +77,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
|||
binding.refreshFromNightscout.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal), resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", Runnable {
|
||||
uel.log(Action.CAREPORTAL_NS_REFRESH, ValueWithUnit(Sources.Treatments))
|
||||
uel.log(Action.CAREPORTAL_NS_REFRESH, Sources.Treatments)
|
||||
disposable += Completable.fromAction { repository.deleteAllTherapyEventsEntries() }
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
|
@ -94,7 +92,7 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
|||
binding.removeAndroidapsStartedEvents.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal), resourceHelper.gs(R.string.careportal_removestartedevents), Runnable {
|
||||
uel.log(Action.RESTART_EVENTS_REMOVED, ValueWithUnit(Sources.Treatments))
|
||||
uel.log(Action.RESTART_EVENTS_REMOVED, Sources.Treatments)
|
||||
repository.runTransactionForResult(InvalidateAAPSStartedTherapyEventTransaction(resourceHelper.gs(R.string.androidaps_start)))
|
||||
.subscribe(
|
||||
{ result -> result.invalidated.forEach { aapsLogger.debug(LTag.DATABASE, "Invalidated therapy event $it") } },
|
||||
|
@ -190,8 +188,9 @@ class TreatmentsCareportalFragment : DaggerFragment() {
|
|||
?: "") + "\n" +
|
||||
resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(therapyEvent.timestamp)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord), text, Runnable {
|
||||
//uel.log(Action.CAREPORTAL_REMOVED, therapyEvent.note , XXXValueWithUnit.Timestamp(therapyEvent.timestamp), XXXValueWithUnit.TherapyEventType(therapyEvent.type))
|
||||
uel.log(Action.CAREPORTAL_REMOVED, therapyEvent.note, ValueWithUnit(Sources.Treatments), ValueWithUnit(therapyEvent.timestamp, Units.Timestamp), ValueWithUnit(therapyEvent.type.text, Units.TherapyEvent))
|
||||
uel.log(Action.CAREPORTAL_REMOVED, Sources.Treatments, therapyEvent.note ,
|
||||
XXXValueWithUnit.Timestamp(therapyEvent.timestamp),
|
||||
XXXValueWithUnit.TherapyEventType(therapyEvent.type))
|
||||
disposable += repository.runTransactionForResult(InvalidateTherapyEventTransaction(therapyEvent.id))
|
||||
.subscribe(
|
||||
{ result -> result.invalidated.forEach { aapsLogger.debug(LTag.DATABASE, "Invalidated therapy event $it") } },
|
||||
|
|
|
@ -14,7 +14,6 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.data.Intervals
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.databinding.TreatmentsExtendedbolusFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.TreatmentsExtendedbolusItemBinding
|
||||
import info.nightscout.androidaps.db.ExtendedBolus
|
||||
|
@ -125,7 +124,7 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment() {
|
|||
${resourceHelper.gs(R.string.extended_bolus)}
|
||||
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(extendedBolus.date)}
|
||||
""".trimIndent(), { _: DialogInterface, _: Int ->
|
||||
uel.log(Action.EXTENDED_BOLUS_REMOVED, ValueWithUnit(Sources.Treatments))
|
||||
uel.log(Action.EXTENDED_BOLUS_REMOVED, Sources.Treatments)
|
||||
val id = extendedBolus._id
|
||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||
else uploadQueue.removeByMongoId("dbAdd", id)
|
||||
|
|
|
@ -12,8 +12,6 @@ import info.nightscout.androidaps.R
|
|||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.databinding.TreatmentsProfileswitchFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.TreatmentsProfileswitchItemBinding
|
||||
import info.nightscout.androidaps.db.ProfileSwitch
|
||||
|
@ -75,7 +73,7 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
|
||||
binding.refreshFromNightscout.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
uel.log(Action.PROFILE_SWITCH_NS_REFRESH, ValueWithUnit(Sources.Treatments))
|
||||
uel.log(Action.PROFILE_SWITCH_NS_REFRESH, Sources.Treatments)
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.refresheventsfromnightscout) + "?") {
|
||||
databaseHelper.resetProfileSwitch()
|
||||
rxBus.send(EventNSClientRestart())
|
||||
|
@ -152,8 +150,8 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord),
|
||||
resourceHelper.gs(R.string.careportal_profileswitch) + ": " + profileSwitch.profileName +
|
||||
"\n" + resourceHelper.gs(R.string.date) + ": " + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
|
||||
//uel.log(Action.PROFILE_SWITCH_REMOVED, profileSwitch.profileName, XXXValueWithUnit.Timestamp(profileSwitch.date))
|
||||
uel.log(Action.PROFILE_SWITCH_REMOVED, ValueWithUnit(Sources.Treatments), ValueWithUnit(profileSwitch.date, Units.Timestamp), ValueWithUnit(profileSwitch.profileName, Units.None))
|
||||
uel.log(Action.PROFILE_SWITCH_REMOVED, Sources.Treatments, profileSwitch.profileName,
|
||||
XXXValueWithUnit.Timestamp(profileSwitch.date))
|
||||
val id = profileSwitch._id
|
||||
if (NSUpload.isIdValid(id)) nsUpload.removeCareportalEntryFromNS(id)
|
||||
else uploadQueue.removeByMongoId("dbAdd", id)
|
||||
|
@ -166,12 +164,10 @@ class TreatmentsProfileSwitchFragment : DaggerFragment() {
|
|||
val profileSwitch = it.tag as ProfileSwitch
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.careportal_profileswitch), resourceHelper.gs(R.string.copytolocalprofile) + "\n" + profileSwitch.customizedName + "\n" + dateUtil.dateAndTimeString(profileSwitch.date), Runnable {
|
||||
profileSwitch.profileObject?.let {
|
||||
//uel.log(Action.PROFILE_SWITCH_CLONED, XXXValueWithUnit.Timestamp(profileSwitch.date), XXXValueWithUnit.SimpleString(profileSwitch.profileName))
|
||||
uel.log(Action.PROFILE_SWITCH_CLONED,
|
||||
uel.log(Action.PROFILE_SWITCH_CLONED, Sources.Treatments,
|
||||
profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_"),
|
||||
ValueWithUnit(Sources.Treatments),
|
||||
ValueWithUnit(profileSwitch.date, Units.Timestamp),
|
||||
ValueWithUnit(profileSwitch.profileName, Units.None))
|
||||
XXXValueWithUnit.Timestamp(profileSwitch.date),
|
||||
XXXValueWithUnit.SimpleString(profileSwitch.profileName))
|
||||
val nonCustomized = it.convertToNonCustomizedProfile()
|
||||
if (nonCustomized.isValid(resourceHelper.gs(R.string.careportal_profileswitch, false))) {
|
||||
localProfilePlugin.addProfile(localProfilePlugin.copyFrom(nonCustomized, profileSwitch.customizedName + " " + dateUtil.dateAndTimeString(profileSwitch.date).replace(".", "_")))
|
||||
|
|
|
@ -17,8 +17,6 @@ import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
|||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.interfaces.end
|
||||
import info.nightscout.androidaps.database.transactions.InvalidateTemporaryTargetTransaction
|
||||
import info.nightscout.androidaps.databinding.TreatmentsTemptargetFragmentBinding
|
||||
|
@ -88,7 +86,7 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
|
|||
binding.refreshFromNightscout.setOnClickListener {
|
||||
context?.let { context ->
|
||||
OKDialog.showConfirmation(context, resourceHelper.gs(R.string.refresheventsfromnightscout) + " ?", {
|
||||
uel.log(Action.TT_NS_REFRESH, ValueWithUnit(Sources.Treatments))
|
||||
uel.log(Action.TT_NS_REFRESH, Sources.Treatments)
|
||||
disposable += Completable.fromAction { repository.deleteAllTempTargetEntries() }
|
||||
.subscribeOn(aapsSchedulers.io)
|
||||
.observeOn(aapsSchedulers.main)
|
||||
|
@ -198,8 +196,12 @@ class TreatmentsTempTargetFragment : DaggerFragment() {
|
|||
${dateUtil.dateAndTimeString(tempTarget.timestamp)}
|
||||
""".trimIndent(),
|
||||
{ _: DialogInterface?, _: Int ->
|
||||
//uel.log(Action.TT_REMOVED, XXXValueWithUnit.Timestamp(tempTarget.timestamp), XXXValueWithUnit.TherapyEventTTReason(tempTarget.reason), XXXValueWithUnit.Mgdl(tempTarget.lowTarget), XXXValueWithUnit.Mgdl(tempTarget.highTarget).takeIf { tempTarget.lowTarget != tempTarget.highTarget }, XXXValueWithUnit.Minute(tempTarget.duration.toInt()))
|
||||
uel.log(Action.TT_REMOVED, ValueWithUnit(Sources.Treatments), ValueWithUnit(tempTarget.timestamp, Units.Timestamp), ValueWithUnit(tempTarget.reason.text, Units.TherapyEvent), ValueWithUnit(tempTarget.lowTarget, Units.Mg_Dl), ValueWithUnit(tempTarget.highTarget, Units.Mg_Dl, tempTarget.lowTarget != tempTarget.highTarget), ValueWithUnit(tempTarget.duration.toInt(), Units.M))
|
||||
uel.log(Action.TT_REMOVED, Sources.Treatments,
|
||||
XXXValueWithUnit.Timestamp(tempTarget.timestamp),
|
||||
XXXValueWithUnit.TherapyEventTTReason(tempTarget.reason),
|
||||
XXXValueWithUnit.Mgdl(tempTarget.lowTarget),
|
||||
XXXValueWithUnit.Mgdl(tempTarget.highTarget).takeIf { tempTarget.lowTarget != tempTarget.highTarget },
|
||||
XXXValueWithUnit.Minute(tempTarget.duration.toInt()))
|
||||
disposable += repository.runTransactionForResult(InvalidateTemporaryTargetTransaction(tempTarget.id))
|
||||
.subscribe(
|
||||
{ aapsLogger.debug(LTag.DATABASE, "Removed temp target $tempTarget") },
|
||||
|
|
|
@ -15,8 +15,6 @@ import info.nightscout.androidaps.data.IobTotal
|
|||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.databinding.TreatmentsTempbasalsFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.TreatmentsTempbasalsItemBinding
|
||||
import info.nightscout.androidaps.db.Source
|
||||
|
@ -168,8 +166,8 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment() {
|
|||
${resourceHelper.gs(R.string.date)}: ${dateUtil.dateAndTimeString(tempBasal.date)}
|
||||
""".trimIndent(),
|
||||
{ _: DialogInterface?, _: Int ->
|
||||
//uel.log(Action.TT_REMOVED, XXXValueWithUnit.Timestamp(tempBasal.date))
|
||||
uel.log(Action.TT_REMOVED, ValueWithUnit(Sources.Treatments), ValueWithUnit(tempBasal.date, Units.Timestamp))
|
||||
uel.log(Action.TT_REMOVED, Sources.Treatments,
|
||||
XXXValueWithUnit.Timestamp(tempBasal.date))
|
||||
activePlugin.activeTreatments.removeTempBasal(tempBasal)
|
||||
}, null)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import info.nightscout.androidaps.database.AppRepository
|
|||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.databinding.TreatmentsUserEntryFragmentBinding
|
||||
import info.nightscout.androidaps.databinding.TreatmentsUserEntryItemBinding
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
|
@ -68,7 +67,7 @@ class TreatmentsUserEntryFragment : DaggerFragment() {
|
|||
binding.ueExportToXml.setOnClickListener {
|
||||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.ue_export_to_csv) + "?") {
|
||||
uel.log(Action.EXPORT_CSV, ValueWithUnit(Sources.Treatments))
|
||||
uel.log(Action.EXPORT_CSV, Sources.Treatments)
|
||||
importExportPrefs.exportUserEntriesCsv(activity, repository.getAllUserEntries())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import info.nightscout.androidaps.automation.databinding.AutomationEventItemBind
|
|||
import info.nightscout.androidaps.automation.databinding.AutomationFragmentBinding
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog
|
||||
|
@ -219,7 +218,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
|
|||
holder.binding.iconTrash.setOnClickListener {
|
||||
OKDialog.showConfirmation(requireContext(), resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
|
||||
{
|
||||
uel.log(Action.AUTOMATION_REMOVED, automationPlugin.at(position).title, ValueWithUnit(Sources.Automation))
|
||||
uel.log(Action.AUTOMATION_REMOVED, Sources.Automation, automationPlugin.at(position).title)
|
||||
automationPlugin.removeAt(position)
|
||||
notifyItemRemoved(position)
|
||||
}, {
|
||||
|
@ -242,7 +241,7 @@ class AutomationFragment : DaggerFragment(), OnStartDragListener {
|
|||
activity?.let { activity ->
|
||||
OKDialog.showConfirmation(activity, resourceHelper.gs(R.string.removerecord) + " " + automationPlugin.at(position).title,
|
||||
Runnable {
|
||||
uel.log(Action.AUTOMATION_REMOVED, automationPlugin.at(position).title, ValueWithUnit(Sources.Automation))
|
||||
uel.log(Action.AUTOMATION_REMOVED, Sources.Automation, automationPlugin.at(position).title)
|
||||
automationPlugin.removeAt(position)
|
||||
notifyItemRemoved(position)
|
||||
rxBus.send(EventAutomationDataChanged())
|
||||
|
|
|
@ -6,7 +6,6 @@ import info.nightscout.androidaps.automation.R
|
|||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||
import info.nightscout.androidaps.interfaces.ConfigBuilderInterface
|
||||
|
@ -35,7 +34,7 @@ class ActionLoopDisable(injector: HasAndroidInjector) : Action(injector) {
|
|||
if ((loopPlugin as PluginBase).isEnabled()) {
|
||||
(loopPlugin as PluginBase).setPluginEnabled(PluginType.LOOP, false)
|
||||
configBuilderPlugin.storeSettings("ActionLoopDisable")
|
||||
uel.log(UserEntry.Action.LOOP_DISABLED, ValueWithUnit(Sources.Automation))
|
||||
uel.log(UserEntry.Action.LOOP_DISABLED, Sources.Automation)
|
||||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
rxBus.send(EventRefreshOverview("ActionLoopDisable"))
|
||||
|
|
|
@ -6,7 +6,6 @@ import info.nightscout.androidaps.automation.R
|
|||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||
import info.nightscout.androidaps.interfaces.ConfigBuilderInterface
|
||||
import info.nightscout.androidaps.interfaces.LoopInterface
|
||||
|
@ -35,7 +34,7 @@ class ActionLoopEnable(injector: HasAndroidInjector) : Action(injector) {
|
|||
(loopPlugin as PluginBase).setPluginEnabled(PluginType.LOOP, true)
|
||||
configBuilderPlugin.storeSettings("ActionLoopEnable")
|
||||
rxBus.send(EventRefreshOverview("ActionLoopEnable"))
|
||||
uel.log(UserEntry.Action.LOOP_ENABLED, ValueWithUnit(Sources.Automation))
|
||||
uel.log(UserEntry.Action.LOOP_ENABLED, Sources.Automation)
|
||||
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
|
||||
} else {
|
||||
callback.result(PumpEnactResult(injector).success(true).comment(R.string.alreadyenabled))?.run()
|
||||
|
|
|
@ -6,7 +6,6 @@ import info.nightscout.androidaps.automation.R
|
|||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||
import info.nightscout.androidaps.interfaces.ConfigBuilderInterface
|
||||
import info.nightscout.androidaps.interfaces.LoopInterface
|
||||
|
@ -33,7 +32,7 @@ class ActionLoopResume(injector: HasAndroidInjector) : Action(injector) {
|
|||
configBuilderPlugin.storeSettings("ActionLoopResume")
|
||||
loopPlugin.createOfflineEvent(0)
|
||||
rxBus.send(EventRefreshOverview("ActionLoopResume"))
|
||||
uel.log(UserEntry.Action.RESUME, ValueWithUnit(Sources.Automation))
|
||||
uel.log(UserEntry.Action.RESUME, Sources.Automation)
|
||||
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
|
||||
} else {
|
||||
callback.result(PumpEnactResult(injector).success(true).comment(R.string.notsuspended))?.run()
|
||||
|
|
|
@ -7,8 +7,7 @@ import info.nightscout.androidaps.automation.R
|
|||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||
import info.nightscout.androidaps.interfaces.LoopInterface
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
|
@ -38,7 +37,8 @@ class ActionLoopSuspend(injector: HasAndroidInjector) : Action(injector) {
|
|||
if (!loopPlugin.isSuspended) {
|
||||
loopPlugin.suspendLoop(minutes.getMinutes())
|
||||
rxBus.send(EventRefreshOverview("ActionLoopSuspend"))
|
||||
uel.log(UserEntry.Action.SUSPEND, ValueWithUnit(Sources.Automation), ValueWithUnit(minutes.getMinutes(), Units.M))
|
||||
uel.log(UserEntry.Action.SUSPEND, Sources.Automation,
|
||||
XXXValueWithUnit.StringResource(R.string.suspendloopforXmin, listOf(XXXValueWithUnit.Minute(minutes.getMinutes()))))
|
||||
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
|
||||
} else {
|
||||
callback.result(PumpEnactResult(injector).success(true).comment(R.string.alreadysuspended))?.run()
|
||||
|
|
|
@ -7,8 +7,7 @@ import info.nightscout.androidaps.automation.R
|
|||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
|
@ -59,7 +58,9 @@ class ActionProfileSwitch(injector: HasAndroidInjector) : Action(injector) {
|
|||
callback.result(PumpEnactResult(injector).success(false).comment(R.string.notexists))?.run()
|
||||
return
|
||||
}
|
||||
uel.log(UserEntry.Action.PROFILE_SWITCH, ValueWithUnit(Sources.Automation), ValueWithUnit(inputProfileName.value, Units.None), ValueWithUnit(100, Units.Percent))
|
||||
uel.log(UserEntry.Action.PROFILE_SWITCH, Sources.Automation,
|
||||
XXXValueWithUnit.SimpleString(inputProfileName.value),
|
||||
XXXValueWithUnit.Percent(100))
|
||||
activePlugin.activeTreatments.doProfileSwitch(profileStore, inputProfileName.value, 0, 100, 0, DateUtil.now())
|
||||
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@ import info.nightscout.androidaps.automation.R
|
|||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.plugins.general.automation.elements.Comparator
|
||||
|
@ -43,7 +42,9 @@ class ActionProfileSwitchPercent(injector: HasAndroidInjector) : Action(injector
|
|||
}
|
||||
|
||||
override fun doAction(callback: Callback) {
|
||||
uel.log(UserEntry.Action.PROFILE_SWITCH, ValueWithUnit(Sources.Automation), ValueWithUnit(pct.value.toInt(), Units.Percent), ValueWithUnit(duration.value, Units.M))
|
||||
uel.log(UserEntry.Action.PROFILE_SWITCH, Sources.Automation,
|
||||
if (duration.value == 0) XXXValueWithUnit.StringResource( R.string.startprofileforever, listOf(XXXValueWithUnit.Percent(pct.value.toInt())))
|
||||
else XXXValueWithUnit.StringResource( R.string.startprofile, listOf(XXXValueWithUnit.Percent(pct.value.toInt()), XXXValueWithUnit.Minute(duration.value))))
|
||||
activePlugin.activeTreatments.doProfileSwitch(duration.value, pct.value.toInt(), 0)
|
||||
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
|
||||
}
|
||||
|
|
|
@ -11,8 +11,7 @@ import info.nightscout.androidaps.database.AppRepository
|
|||
import info.nightscout.androidaps.database.entities.TemporaryTarget
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.entities.XXXValueWithUnit
|
||||
import info.nightscout.androidaps.database.transactions.InsertTemporaryTargetAndCancelCurrentTransaction
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
|
@ -62,7 +61,11 @@ class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) {
|
|||
.subscribe({ result ->
|
||||
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") }
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
|
||||
uel.log(UserEntry.Action.TT, ValueWithUnit(Sources.Automation), ValueWithUnit(TemporaryTarget.Reason.AUTOMATION.text, Units.TherapyEvent), ValueWithUnit(tt().lowTarget, Units.Mg_Dl), ValueWithUnit(tt().highTarget, Units.Mg_Dl, tt().lowTarget!=tt().highTarget), ValueWithUnit(TimeUnit.MILLISECONDS.toMinutes(tt().duration).toInt(), Units.M))
|
||||
uel.log(UserEntry.Action.TT, Sources.Automation,
|
||||
XXXValueWithUnit.TherapyEventTTReason(TemporaryTarget.Reason.AUTOMATION),
|
||||
XXXValueWithUnit.fromGlucoseUnit(tt().lowTarget, Constants.MGDL),
|
||||
XXXValueWithUnit.fromGlucoseUnit(tt().highTarget, Constants.MGDL).takeIf { tt().lowTarget != tt().highTarget },
|
||||
XXXValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt().duration).toInt()))
|
||||
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
|
||||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
|
||||
|
|
|
@ -6,7 +6,6 @@ import info.nightscout.androidaps.data.PumpEnactResult
|
|||
import info.nightscout.androidaps.database.AppRepository
|
||||
import info.nightscout.androidaps.database.entities.UserEntry
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.database.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
|
@ -33,7 +32,7 @@ class ActionStopTempTarget(injector: HasAndroidInjector) : Action(injector) {
|
|||
override fun doAction(callback: Callback) {
|
||||
disposable += repository.runTransactionForResult(CancelCurrentTemporaryTargetIfAnyTransaction(dateUtil._now()))
|
||||
.subscribe({ result ->
|
||||
uel.log(UserEntry.Action.CANCEL_TT, ValueWithUnit(Sources.Automation))
|
||||
uel.log(UserEntry.Action.CANCEL_TT, Sources.Automation)
|
||||
result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }
|
||||
}, {
|
||||
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
|
||||
|
|
|
@ -13,8 +13,6 @@ import info.nightscout.androidaps.core.R
|
|||
import info.nightscout.androidaps.core.databinding.DialogErrorBinding
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
|
||||
|
@ -63,15 +61,15 @@ class ErrorDialog : DaggerDialogFragment() {
|
|||
|
||||
binding.title.text = title
|
||||
binding.ok.setOnClickListener {
|
||||
uel.log(Action.ERROR_DIALOG_OK, ValueWithUnit(Sources.Maintenance))
|
||||
uel.log(Action.ERROR_DIALOG_OK, Sources.Unknown)
|
||||
dismiss()
|
||||
}
|
||||
binding.mute.setOnClickListener {
|
||||
uel.log(Action.ERROR_DIALOG_MUTE, ValueWithUnit(Sources.Maintenance))
|
||||
uel.log(Action.ERROR_DIALOG_MUTE, Sources.Unknown)
|
||||
stopAlarm()
|
||||
}
|
||||
binding.mute5min.setOnClickListener {
|
||||
uel.log(Action.ERROR_DIALOG_MUTE_5MIN, ValueWithUnit(Sources.Maintenance))
|
||||
uel.log(Action.ERROR_DIALOG_MUTE_5MIN, Sources.Unknown)
|
||||
stopAlarm()
|
||||
loopHandler.postDelayed(this::startAlarm, T.mins(5).msecs())
|
||||
}
|
||||
|
|
|
@ -22,17 +22,6 @@ class UserEntryLogger @Inject constructor(
|
|||
|
||||
private val compositeDisposable = CompositeDisposable()
|
||||
|
||||
@Deprecated("Use XXXValueWithUnits")
|
||||
fun log(action: Action, s: String? ="", vararg listvalues: ValueWithUnit) {
|
||||
}
|
||||
|
||||
@Deprecated("Use XXXValueWithUnits")
|
||||
fun log(action: Action, vararg listValues: ValueWithUnit) {
|
||||
}
|
||||
|
||||
@Deprecated("Use XXXValueWithUnits")
|
||||
fun log(action: Action, s: String? = "") {}
|
||||
|
||||
fun log(action: Action, source: Sources, note: String? ="", vararg listvalues: XXXValueWithUnit?) = log(action, source, note, listvalues.toList())
|
||||
|
||||
fun log(action: Action, source: Sources, vararg listvalues: XXXValueWithUnit?) = log(action, source,"", listvalues.toList())
|
||||
|
|
|
@ -68,6 +68,9 @@ class UserEntryPresentationHelper @Inject constructor(
|
|||
Sources.Treatments -> R.drawable.ic_treatments
|
||||
Sources.Wear -> R.drawable.ic_watch
|
||||
Sources.Food -> R.drawable.ic_food
|
||||
Sources.Stats -> R.drawable.ic_cp_stats
|
||||
Sources.ConfigBuilder -> R.drawable.ic_generic_icon
|
||||
Sources.Overview -> R.drawable.ic_generic_icon
|
||||
Sources.Unknown -> R.drawable.ic_generic_icon
|
||||
}
|
||||
|
||||
|
@ -90,7 +93,7 @@ class UserEntryPresentationHelper @Inject constructor(
|
|||
is XXXValueWithUnit.UnitPerHour -> DecimalFormatter.to2Decimal(valueWithUnit.value) + translator.translate(UserEntry.Units.U_H)
|
||||
is XXXValueWithUnit.SimpleInt -> valueWithUnit.value.toString()
|
||||
is XXXValueWithUnit.SimpleString -> valueWithUnit.value
|
||||
is XXXValueWithUnit.StringResource -> resourceHelper.gs(valueWithUnit.value, valueWithUnit.params)
|
||||
is XXXValueWithUnit.StringResource -> resourceHelper.gs(valueWithUnit.value /*, valueWithUnit.params.map { it.value() }*/)
|
||||
is XXXValueWithUnit.TherapyEventMeterType -> translator.translate(valueWithUnit.value)
|
||||
is XXXValueWithUnit.TherapyEventTTReason -> translator.translate(valueWithUnit.value)
|
||||
is XXXValueWithUnit.TherapyEventType -> translator.translate(valueWithUnit.value)
|
||||
|
|
|
@ -12,8 +12,6 @@ import info.nightscout.androidaps.activities.TDDStatsActivity
|
|||
import info.nightscout.androidaps.dana.databinding.DanarFragmentBinding
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Action
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Sources
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.Units
|
||||
import info.nightscout.androidaps.database.entities.UserEntry.ValueWithUnit
|
||||
import info.nightscout.androidaps.dialogs.ProfileViewerDialog
|
||||
import info.nightscout.androidaps.events.EventExtendedBolusChange
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged
|
||||
|
@ -112,7 +110,7 @@ class DanaFragment : DaggerFragment() {
|
|||
binding.btconnection.setOnLongClickListener {
|
||||
activity?.let {
|
||||
OKDialog.showConfirmation(it, resourceHelper.gs(R.string.resetpairing)) {
|
||||
uel.log(Action.CLEAR_PAIRING_KEYS, ValueWithUnit(Sources.Pump))
|
||||
uel.log(Action.CLEAR_PAIRING_KEYS, Sources.Pump)
|
||||
(activePlugin.activePump as DanaPumpInterface).clearPairing()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,18 +156,21 @@ data class UserEntry(
|
|||
Announcement,
|
||||
Actions, //From Actions plugin
|
||||
Automation, //From Automation plugin
|
||||
BG, // From BG plugin
|
||||
BG, //From BG plugin => Add One Source per BG Source for Calibration or Sensor Change
|
||||
LocalProfile, //From LocalProfile plugin
|
||||
Loop, //From Loop plugin
|
||||
Maintenance, //From Maintenance plugin
|
||||
NSClient, //From NSClient plugin
|
||||
NSProfile, //From NSProfile plugin
|
||||
Objectives, //From Objectives plugin
|
||||
Pump, //From Pump plugin
|
||||
Pump, //To update with one Source per pump
|
||||
SMS, //From SMS plugin
|
||||
Treatments, //From Treatments plugin
|
||||
Wear, //From Wear plugin
|
||||
Food, //From Food plugin
|
||||
ConfigBuilder, //From ConfigBuilder Plugin
|
||||
Overview, //From OverViewPlugin
|
||||
Stats, //From Stat Activity
|
||||
Unknown //if necessary
|
||||
;
|
||||
|
||||
|
|
|
@ -36,6 +36,26 @@ sealed class XXXValueWithUnit {
|
|||
|
||||
data class StringResource(@StringRes val value: Int, val params: List<XXXValueWithUnit> = listOf()) : XXXValueWithUnit()
|
||||
|
||||
fun value(): Any? {
|
||||
return when(this) {
|
||||
is Gram -> this.value
|
||||
is Hour -> this.value
|
||||
is Insulin -> this.value
|
||||
is Mgdl -> this.value
|
||||
is Minute -> this.value
|
||||
is Mmoll -> this.value
|
||||
is Percent -> this.value
|
||||
is SimpleInt -> this.value
|
||||
is SimpleString -> this.value
|
||||
is StringResource -> this.value
|
||||
is TherapyEventMeterType -> this.value
|
||||
is TherapyEventTTReason -> this.value
|
||||
is TherapyEventType -> this.value
|
||||
is Timestamp -> this.value
|
||||
is UnitPerHour -> this.value
|
||||
UNKNOWN -> null
|
||||
}
|
||||
}
|
||||
companion object {
|
||||
|
||||
fun fromGlucoseUnit(value: Double, string: String): XXXValueWithUnit? = when (string) {
|
||||
|
|
Loading…
Reference in a new issue