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.extensions.fromConstant
|
||||
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.receivers.DataWorker
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.XDripBroadcast
|
||||
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 javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
@ -39,14 +39,15 @@ class DexcomPlugin @Inject constructor(
|
|||
private val sp: SP,
|
||||
private val dexcomMediator: DexcomMediator,
|
||||
config: Config
|
||||
) : PluginBase(PluginDescription()
|
||||
.mainType(PluginType.BGSOURCE)
|
||||
.fragmentClass(BGSourceFragment::class.java.name)
|
||||
.pluginIcon(R.drawable.ic_dexcom_g6)
|
||||
.pluginName(R.string.dexcom_app_patched)
|
||||
.shortName(R.string.dexcom_short)
|
||||
.preferencesId(R.xml.pref_bgsourcedexcom)
|
||||
.description(R.string.description_source_dexcom),
|
||||
) : PluginBase(
|
||||
PluginDescription()
|
||||
.mainType(PluginType.BGSOURCE)
|
||||
.fragmentClass(BGSourceFragment::class.java.name)
|
||||
.pluginIcon(R.drawable.ic_dexcom_g6)
|
||||
.pluginName(R.string.dexcom_app_patched)
|
||||
.shortName(R.string.dexcom_short)
|
||||
.preferencesId(R.xml.pref_bgsourcedexcom)
|
||||
.description(R.string.description_source_dexcom),
|
||||
aapsLogger, rh, injector
|
||||
), BgSource {
|
||||
|
||||
|
@ -125,11 +126,13 @@ class DexcomPlugin @Inject constructor(
|
|||
val now = dateUtil.now()
|
||||
val value = it.getInt("meterValue").toDouble()
|
||||
if (timestamp > now - T.months(1).msecs() && timestamp < now) {
|
||||
calibrations.add(CgmSourceTransaction.Calibration(
|
||||
timestamp = it.getLong("timestamp") * 1000,
|
||||
value = value,
|
||||
glucoseUnit = TherapyEvent.GlucoseUnit.fromConstant(Profile.unit(value))
|
||||
))
|
||||
calibrations.add(
|
||||
CgmSourceTransaction.Calibration(
|
||||
timestamp = it.getLong("timestamp") * 1000,
|
||||
value = value,
|
||||
glucoseUnit = TherapyEvent.GlucoseUnit.fromConstant(Profile.unit(value))
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -155,20 +158,22 @@ class DexcomPlugin @Inject constructor(
|
|||
aapsLogger.debug(LTag.DATABASE, "Updated bg $it")
|
||||
}
|
||||
result.sensorInsertionsInserted.forEach {
|
||||
uel.log(Action.CAREPORTAL,
|
||||
uel.log(
|
||||
Action.CAREPORTAL,
|
||||
Sources.Dexcom,
|
||||
ValueWithUnit.Timestamp(it.timestamp),
|
||||
ValueWithUnit.TherapyEventType(it.type))
|
||||
ValueWithUnit.TherapyEventType(it.type)
|
||||
)
|
||||
aapsLogger.debug(LTag.DATABASE, "Inserted sensor insertion $it")
|
||||
}
|
||||
result.calibrationsInserted.forEach { calibration ->
|
||||
calibration.glucose?.let { glucosevalue ->
|
||||
result.calibrationsInserted.forEach { calibration ->
|
||||
calibration.glucose?.let { glucoseValue ->
|
||||
uel.log(
|
||||
Action.CALIBRATION,
|
||||
Sources.Dexcom,
|
||||
ValueWithUnit.Timestamp(calibration.timestamp),
|
||||
ValueWithUnit.TherapyEventType(calibration.type),
|
||||
ValueWithUnit.fromGlucoseUnit(glucosevalue, calibration.glucoseUnit.toString)
|
||||
ValueWithUnit.fromGlucoseUnit(glucoseValue, calibration.glucoseUnit.toString)
|
||||
)
|
||||
}
|
||||
aapsLogger.debug(LTag.DATABASE, "Inserted calibration $calibration")
|
||||
|
@ -184,10 +189,12 @@ class DexcomPlugin @Inject constructor(
|
|||
|
||||
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.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"
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue