new Dexcom package name
This commit is contained in:
parent
dfb3bb06b1
commit
acd6863461
1 changed files with 29 additions and 22 deletions
|
@ -19,14 +19,14 @@ 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.extensions.fromConstant
|
import info.nightscout.androidaps.extensions.fromConstant
|
||||||
import info.nightscout.androidaps.interfaces.*
|
import info.nightscout.androidaps.interfaces.*
|
||||||
import info.nightscout.shared.logging.AAPSLogger
|
|
||||||
import info.nightscout.shared.logging.LTag
|
|
||||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
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
|
||||||
import info.nightscout.androidaps.utils.XDripBroadcast
|
import info.nightscout.androidaps.utils.XDripBroadcast
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||||
|
import info.nightscout.shared.logging.AAPSLogger
|
||||||
|
import info.nightscout.shared.logging.LTag
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
@ -39,14 +39,15 @@ class DexcomPlugin @Inject constructor(
|
||||||
private val sp: SP,
|
private val sp: SP,
|
||||||
private val dexcomMediator: DexcomMediator,
|
private val dexcomMediator: DexcomMediator,
|
||||||
config: Config
|
config: Config
|
||||||
) : PluginBase(PluginDescription()
|
) : PluginBase(
|
||||||
.mainType(PluginType.BGSOURCE)
|
PluginDescription()
|
||||||
.fragmentClass(BGSourceFragment::class.java.name)
|
.mainType(PluginType.BGSOURCE)
|
||||||
.pluginIcon(R.drawable.ic_dexcom_g6)
|
.fragmentClass(BGSourceFragment::class.java.name)
|
||||||
.pluginName(R.string.dexcom_app_patched)
|
.pluginIcon(R.drawable.ic_dexcom_g6)
|
||||||
.shortName(R.string.dexcom_short)
|
.pluginName(R.string.dexcom_app_patched)
|
||||||
.preferencesId(R.xml.pref_bgsourcedexcom)
|
.shortName(R.string.dexcom_short)
|
||||||
.description(R.string.description_source_dexcom),
|
.preferencesId(R.xml.pref_bgsourcedexcom)
|
||||||
|
.description(R.string.description_source_dexcom),
|
||||||
aapsLogger, rh, injector
|
aapsLogger, rh, injector
|
||||||
), BgSource {
|
), BgSource {
|
||||||
|
|
||||||
|
@ -125,11 +126,13 @@ class DexcomPlugin @Inject constructor(
|
||||||
val now = dateUtil.now()
|
val now = dateUtil.now()
|
||||||
val value = it.getInt("meterValue").toDouble()
|
val value = it.getInt("meterValue").toDouble()
|
||||||
if (timestamp > now - T.months(1).msecs() && timestamp < now) {
|
if (timestamp > now - T.months(1).msecs() && timestamp < now) {
|
||||||
calibrations.add(CgmSourceTransaction.Calibration(
|
calibrations.add(
|
||||||
timestamp = it.getLong("timestamp") * 1000,
|
CgmSourceTransaction.Calibration(
|
||||||
value = value,
|
timestamp = it.getLong("timestamp") * 1000,
|
||||||
glucoseUnit = TherapyEvent.GlucoseUnit.fromConstant(Profile.unit(value))
|
value = value,
|
||||||
))
|
glucoseUnit = TherapyEvent.GlucoseUnit.fromConstant(Profile.unit(value))
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,20 +158,22 @@ class DexcomPlugin @Inject constructor(
|
||||||
aapsLogger.debug(LTag.DATABASE, "Updated bg $it")
|
aapsLogger.debug(LTag.DATABASE, "Updated bg $it")
|
||||||
}
|
}
|
||||||
result.sensorInsertionsInserted.forEach {
|
result.sensorInsertionsInserted.forEach {
|
||||||
uel.log(Action.CAREPORTAL,
|
uel.log(
|
||||||
|
Action.CAREPORTAL,
|
||||||
Sources.Dexcom,
|
Sources.Dexcom,
|
||||||
ValueWithUnit.Timestamp(it.timestamp),
|
ValueWithUnit.Timestamp(it.timestamp),
|
||||||
ValueWithUnit.TherapyEventType(it.type))
|
ValueWithUnit.TherapyEventType(it.type)
|
||||||
|
)
|
||||||
aapsLogger.debug(LTag.DATABASE, "Inserted sensor insertion $it")
|
aapsLogger.debug(LTag.DATABASE, "Inserted sensor insertion $it")
|
||||||
}
|
}
|
||||||
result.calibrationsInserted.forEach { calibration ->
|
result.calibrationsInserted.forEach { calibration ->
|
||||||
calibration.glucose?.let { glucosevalue ->
|
calibration.glucose?.let { glucoseValue ->
|
||||||
uel.log(
|
uel.log(
|
||||||
Action.CALIBRATION,
|
Action.CALIBRATION,
|
||||||
Sources.Dexcom,
|
Sources.Dexcom,
|
||||||
ValueWithUnit.Timestamp(calibration.timestamp),
|
ValueWithUnit.Timestamp(calibration.timestamp),
|
||||||
ValueWithUnit.TherapyEventType(calibration.type),
|
ValueWithUnit.TherapyEventType(calibration.type),
|
||||||
ValueWithUnit.fromGlucoseUnit(glucosevalue, calibration.glucoseUnit.toString)
|
ValueWithUnit.fromGlucoseUnit(glucoseValue, calibration.glucoseUnit.toString)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
aapsLogger.debug(LTag.DATABASE, "Inserted calibration $calibration")
|
aapsLogger.debug(LTag.DATABASE, "Inserted calibration $calibration")
|
||||||
|
@ -184,10 +189,12 @@ class DexcomPlugin @Inject constructor(
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
private val PACKAGE_NAMES = arrayOf("com.dexcom.cgm.region1.mgdl", "com.dexcom.cgm.region1.mmol",
|
private val PACKAGE_NAMES = arrayOf(
|
||||||
|
"com.dexcom.cgm.region1.mgdl", "com.dexcom.cgm.region1.mmol",
|
||||||
"com.dexcom.cgm.region2.mgdl", "com.dexcom.cgm.region2.mmol",
|
"com.dexcom.cgm.region2.mgdl", "com.dexcom.cgm.region2.mmol",
|
||||||
"com.dexcom.g6.region1.mmol", "com.dexcom.g6.region2.mgdl",
|
"com.dexcom.g6.region1.mmol", "com.dexcom.g6.region2.mgdl",
|
||||||
"com.dexcom.g6.region3.mgdl", "com.dexcom.g6.region3.mmol")
|
"com.dexcom.g6.region3.mgdl", "com.dexcom.g6.region3.mmol", "com.dexcom.g6"
|
||||||
|
)
|
||||||
const val PERMISSION = "com.dexcom.cgm.EXTERNAL_PERMISSION"
|
const val PERMISSION = "com.dexcom.cgm.EXTERNAL_PERMISSION"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue