Add BG sources for uel (Calibration and Sensor Change)
This commit is contained in:
parent
ec9efefb93
commit
6114effb22
|
@ -131,8 +131,8 @@ class BGSourceFragment : DaggerFragment() {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
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))
|
val source = Sources.BG //Todo Replace Sources.BG by Active BG Source plugin
|
||||||
uel.log(Action.BG_REMOVED, Sources.BG,
|
uel.log(Action.BG_REMOVED, source,
|
||||||
ValueWithUnit.Timestamp(glucoseValue.timestamp))
|
ValueWithUnit.Timestamp(glucoseValue.timestamp))
|
||||||
disposable += repository.runTransaction(InvalidateGlucoseValueTransaction(glucoseValue.id)).subscribe()
|
disposable += repository.runTransaction(InvalidateGlucoseValueTransaction(glucoseValue.id)).subscribe()
|
||||||
})
|
})
|
||||||
|
|
|
@ -14,6 +14,9 @@ import info.nightscout.androidaps.activities.RequestDexcomPermissionActivity
|
||||||
import info.nightscout.androidaps.database.AppRepository
|
import info.nightscout.androidaps.database.AppRepository
|
||||||
import info.nightscout.androidaps.database.entities.GlucoseValue
|
import info.nightscout.androidaps.database.entities.GlucoseValue
|
||||||
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.Sources
|
||||||
|
import info.nightscout.androidaps.database.entities.ValueWithUnit
|
||||||
import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
|
import info.nightscout.androidaps.database.transactions.CgmSourceTransaction
|
||||||
import info.nightscout.androidaps.interfaces.BgSourceInterface
|
import info.nightscout.androidaps.interfaces.BgSourceInterface
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase
|
import info.nightscout.androidaps.interfaces.PluginBase
|
||||||
|
@ -21,6 +24,7 @@ import info.nightscout.androidaps.interfaces.PluginDescription
|
||||||
import info.nightscout.androidaps.interfaces.PluginType
|
import info.nightscout.androidaps.interfaces.PluginType
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger
|
import info.nightscout.androidaps.logging.AAPSLogger
|
||||||
import info.nightscout.androidaps.logging.LTag
|
import info.nightscout.androidaps.logging.LTag
|
||||||
|
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||||
import info.nightscout.androidaps.receivers.DataWorker
|
import info.nightscout.androidaps.receivers.DataWorker
|
||||||
import info.nightscout.androidaps.utils.DateUtil
|
import info.nightscout.androidaps.utils.DateUtil
|
||||||
import info.nightscout.androidaps.utils.T
|
import info.nightscout.androidaps.utils.T
|
||||||
|
@ -83,6 +87,7 @@ class DexcomPlugin @Inject constructor(
|
||||||
@Inject lateinit var dataWorker: DataWorker
|
@Inject lateinit var dataWorker: DataWorker
|
||||||
@Inject lateinit var broadcastToXDrip: XDripBroadcast
|
@Inject lateinit var broadcastToXDrip: XDripBroadcast
|
||||||
@Inject lateinit var repository: AppRepository
|
@Inject lateinit var repository: AppRepository
|
||||||
|
@Inject lateinit var uel: UserEntryLogger
|
||||||
|
|
||||||
init {
|
init {
|
||||||
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
(context.applicationContext as HasAndroidInjector).androidInjector().inject(this)
|
||||||
|
@ -150,8 +155,20 @@ class DexcomPlugin @Inject constructor(
|
||||||
broadcastToXDrip(it)
|
broadcastToXDrip(it)
|
||||||
aapsLogger.debug(LTag.DATABASE, "Updated bg $it")
|
aapsLogger.debug(LTag.DATABASE, "Updated bg $it")
|
||||||
}
|
}
|
||||||
result.sensorInsertionsInserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted sensor insertion $it") }
|
result.sensorInsertionsInserted.forEach {
|
||||||
result.calibrationsInserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted calibration $it") }
|
uel.log(Action.CAREPORTAL,
|
||||||
|
Sources.BG,
|
||||||
|
ValueWithUnit.Timestamp(it.timestamp),
|
||||||
|
ValueWithUnit.TherapyEventType(it.type))
|
||||||
|
aapsLogger.debug(LTag.DATABASE, "Inserted sensor insertion $it")
|
||||||
|
}
|
||||||
|
result.calibrationsInserted.forEach {
|
||||||
|
uel.log(Action.CAREPORTAL,
|
||||||
|
Sources.BG,
|
||||||
|
ValueWithUnit.Timestamp(it.timestamp),
|
||||||
|
ValueWithUnit.TherapyEventType(it.type))
|
||||||
|
aapsLogger.debug(LTag.DATABASE, "Inserted calibration $it")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
aapsLogger.error("Error while processing intent from Dexcom App", e)
|
aapsLogger.error("Error while processing intent from Dexcom App", e)
|
||||||
|
|
|
@ -233,6 +233,14 @@ class Translator @Inject internal constructor(
|
||||||
Sources.Announcement -> TODO()
|
Sources.Announcement -> TODO()
|
||||||
Sources.Actions -> TODO()
|
Sources.Actions -> TODO()
|
||||||
Sources.BG -> TODO()
|
Sources.BG -> TODO()
|
||||||
|
Sources.Dexcom -> TODO()
|
||||||
|
Sources.Eversense -> TODO()
|
||||||
|
Sources.Glimp -> TODO()
|
||||||
|
Sources.MM640g -> TODO()
|
||||||
|
Sources.NSClientSource -> TODO()
|
||||||
|
Sources.PocTech -> TODO()
|
||||||
|
Sources.Tomato -> TODO()
|
||||||
|
Sources.Xdrip -> TODO()
|
||||||
Sources.LocalProfile -> TODO()
|
Sources.LocalProfile -> TODO()
|
||||||
Sources.Maintenance -> TODO()
|
Sources.Maintenance -> TODO()
|
||||||
Sources.NSProfile -> TODO()
|
Sources.NSProfile -> TODO()
|
||||||
|
|
|
@ -106,6 +106,14 @@ class UserEntryMapper {
|
||||||
Actions (UserEntry.Sources.Actions),
|
Actions (UserEntry.Sources.Actions),
|
||||||
Automation (UserEntry.Sources.Automation),
|
Automation (UserEntry.Sources.Automation),
|
||||||
BG (UserEntry.Sources.BG),
|
BG (UserEntry.Sources.BG),
|
||||||
|
Dexcom (UserEntry.Sources.Dexcom),
|
||||||
|
Eversense (UserEntry.Sources.Eversense),
|
||||||
|
Glimp (UserEntry.Sources.Glimp),
|
||||||
|
MM640g (UserEntry.Sources.MM640g),
|
||||||
|
NSClientSource (UserEntry.Sources.BG),
|
||||||
|
PocTech (UserEntry.Sources.PocTech),
|
||||||
|
Tomato (UserEntry.Sources.Tomato),
|
||||||
|
Xdrip (UserEntry.Sources.Xdrip),
|
||||||
LocalProfile (UserEntry.Sources.LocalProfile),
|
LocalProfile (UserEntry.Sources.LocalProfile),
|
||||||
Loop (UserEntry.Sources.Loop),
|
Loop (UserEntry.Sources.Loop),
|
||||||
Maintenance (UserEntry.Sources.Maintenance),
|
Maintenance (UserEntry.Sources.Maintenance),
|
||||||
|
|
|
@ -61,6 +61,14 @@ class UserEntryPresentationHelper @Inject constructor(
|
||||||
Sources.Actions -> R.drawable.ic_action
|
Sources.Actions -> R.drawable.ic_action
|
||||||
Sources.Automation -> R.drawable.ic_automation
|
Sources.Automation -> R.drawable.ic_automation
|
||||||
Sources.BG -> R.drawable.ic_generic_cgm
|
Sources.BG -> R.drawable.ic_generic_cgm
|
||||||
|
Sources.Dexcom -> R.drawable.ic_dexcom_g6
|
||||||
|
Sources.Eversense -> R.drawable.ic_eversense
|
||||||
|
Sources.Glimp -> R.drawable.ic_glimp
|
||||||
|
Sources.MM640g -> R.drawable.ic_generic_cgm
|
||||||
|
Sources.NSClientSource -> R.drawable.ic_nsclient_bg
|
||||||
|
Sources.PocTech -> R.drawable.ic_poctech
|
||||||
|
Sources.Tomato -> R.drawable.ic_sensor
|
||||||
|
Sources.Xdrip -> R.drawable.ic_blooddrop_48
|
||||||
Sources.LocalProfile -> R.drawable.ic_local_profile
|
Sources.LocalProfile -> R.drawable.ic_local_profile
|
||||||
Sources.Loop -> R.drawable.ic_loop_closed_white
|
Sources.Loop -> R.drawable.ic_loop_closed_white
|
||||||
Sources.Maintenance -> R.drawable.ic_maintenance
|
Sources.Maintenance -> R.drawable.ic_maintenance
|
||||||
|
|
|
@ -125,6 +125,14 @@ data class UserEntry(
|
||||||
Actions, //From Actions plugin
|
Actions, //From Actions plugin
|
||||||
Automation, //From Automation plugin
|
Automation, //From Automation plugin
|
||||||
BG, //From BG plugin => Add One Source per BG Source for Calibration or Sensor Change
|
BG, //From BG plugin => Add One Source per BG Source for Calibration or Sensor Change
|
||||||
|
Dexcom,
|
||||||
|
Eversense,
|
||||||
|
Glimp,
|
||||||
|
MM640g,
|
||||||
|
NSClientSource,
|
||||||
|
PocTech,
|
||||||
|
Tomato,
|
||||||
|
Xdrip,
|
||||||
LocalProfile, //From LocalProfile plugin
|
LocalProfile, //From LocalProfile plugin
|
||||||
Loop, //From Loop plugin
|
Loop, //From Loop plugin
|
||||||
Maintenance, //From Maintenance plugin
|
Maintenance, //From Maintenance plugin
|
||||||
|
|
Loading…
Reference in a new issue