From 37a6fa92208661540d87c782bb1ddfb328ac7115 Mon Sep 17 00:00:00 2001 From: jbr7rr <> Date: Sat, 18 Feb 2023 21:10:50 +0100 Subject: [PATCH] Added Medtrum pump type etc --- .../interfaces/pump/defs/PumpCapability.kt | 1 + .../interfaces/pump/defs/PumpType.kt | 21 +++++++++++++++++++ .../nightscout/core/pump/PumpTypeExtension.kt | 2 ++ .../entities/embedments/InterfaceIDs.kt | 1 + .../pump/medtrum/MedtrumPumpPlugin.kt | 6 ++++-- 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpCapability.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpCapability.kt index ed9620a818..f425ffdff7 100644 --- a/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpCapability.kt +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpCapability.kt @@ -26,6 +26,7 @@ enum class PumpCapability { YpsomedCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, ManualTDDLoad)), // BasalRates (separately grouped) DiaconnCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, Refill, ReplaceBattery, TDD, ManualTDDLoad)), // EopatchCapabilities(arrayOf(Bolus, ExtendedBolus, TempBasal, BasalProfileSet, BasalRate30min)), + MedtrumCapabilities(arrayOf(Bolus, TempBasal, BasalProfileSet, BasalRate30min)), // Technically the pump supports ExtendedBolus, but not implemented (yet) BasalRate_Duration15minAllowed, BasalRate_Duration30minAllowed, BasalRate_Duration15and30minAllowed(arrayOf(BasalRate_Duration15minAllowed, BasalRate_Duration30minAllowed)), diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpType.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpType.kt index 30163c9ddf..4199af95a8 100644 --- a/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpType.kt +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpType.kt @@ -391,6 +391,26 @@ enum class PumpType { isPatchPump = true, maxReservoirReading = 50, source = Source.EOPatch2 + ), + + //Medtrum Nano Pump + MEDTRUM_NANO( + description = "Medtrum Nano", + manufacturer = ManufacturerType.Medtrum, + model = "Nano", + bolusSize = 0.05, + specialBolusSize = null, + extendedBolusSettings = DoseSettings(0.05, 30, 8 * 60, 0.05, 30.0), + pumpTempBasalType = PumpTempBasalType.Absolute, + tbrSettings = DoseSettings(0.05, 30, 12 * 60, 0.0, 25.0), + specialBasalDurations = PumpCapability.BasalRate_Duration30minAllowed, + baseBasalMinValue = 0.05, + baseBasalMaxValue = 25.0, + baseBasalStep = 0.05, + baseBasalSpecialSteps = null, + pumpCapability = PumpCapability.MedtrumCapabilities, + isPatchPump = true, + source = Source.Medtrum ); val description: String @@ -458,6 +478,7 @@ enum class PumpType { OmnipodEros, OmnipodDash, EOPatch2, + Medtrum, MDI, VirtualPump, Unknown diff --git a/core/main/src/main/java/info/nightscout/core/pump/PumpTypeExtension.kt b/core/main/src/main/java/info/nightscout/core/pump/PumpTypeExtension.kt index 7024036f9e..8a0b120cc1 100644 --- a/core/main/src/main/java/info/nightscout/core/pump/PumpTypeExtension.kt +++ b/core/main/src/main/java/info/nightscout/core/pump/PumpTypeExtension.kt @@ -59,6 +59,7 @@ fun PumpType.Companion.fromDbPumpType(pt: InterfaceIDs.PumpType): PumpType = InterfaceIDs.PumpType.USER -> PumpType.USER InterfaceIDs.PumpType.DIACONN_G8 -> PumpType.DIACONN_G8 InterfaceIDs.PumpType.EOPATCH2 -> PumpType.EOFLOW_EOPATCH2 + InterfaceIDs.PumpType.MEDTRUM -> PumpType.MEDTRUM_NANO InterfaceIDs.PumpType.CACHE -> PumpType.CACHE } @@ -117,5 +118,6 @@ fun PumpType.toDbPumpType(): InterfaceIDs.PumpType = PumpType.USER -> InterfaceIDs.PumpType.USER PumpType.DIACONN_G8 -> InterfaceIDs.PumpType.DIACONN_G8 PumpType.EOFLOW_EOPATCH2 -> InterfaceIDs.PumpType.EOPATCH2 + PumpType.MEDTRUM_NANO -> InterfaceIDs.PumpType.MEDTRUM PumpType.CACHE -> InterfaceIDs.PumpType.CACHE } diff --git a/database/entities/src/main/java/info/nightscout/database/entities/embedments/InterfaceIDs.kt b/database/entities/src/main/java/info/nightscout/database/entities/embedments/InterfaceIDs.kt index 5f78da4e8c..a10a7740cd 100644 --- a/database/entities/src/main/java/info/nightscout/database/entities/embedments/InterfaceIDs.kt +++ b/database/entities/src/main/java/info/nightscout/database/entities/embedments/InterfaceIDs.kt @@ -43,6 +43,7 @@ data class InterfaceIDs( MDI, DIACONN_G8, EOPATCH2, + MEDTRUM, USER, CACHE; diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPumpPlugin.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPumpPlugin.kt index 1d2e4c0742..404668c68f 100644 --- a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPumpPlugin.kt +++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/MedtrumPumpPlugin.kt @@ -64,6 +64,8 @@ class MedtrumPumpPlugin @Inject constructor( .description(R.string.medtrum_pump_description), injector, aapsLogger, rh, commandQueue ), Pump { + private var mPumpType: PumpType = PumpType.MEDTRUM_NANO + private val mPumpDescription = PumpDescription(mPumpType) override fun onStart() { super.onStart() @@ -175,7 +177,7 @@ class MedtrumPumpPlugin @Inject constructor( } override fun model(): PumpType { - return PumpType.GENERIC_AAPS // TODO + return mPumpType } override fun serialNumber(): String { @@ -183,7 +185,7 @@ class MedtrumPumpPlugin @Inject constructor( } override val pumpDescription: PumpDescription - get() = PumpDescription(PumpType.GENERIC_AAPS) // TODO + get() = mPumpDescription override fun shortStatus(veryShort: Boolean): String { return ""// TODO