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