diff --git a/app/src/main/java/info/nightscout/androidaps/di/PluginsModule.kt b/app/src/main/java/info/nightscout/androidaps/di/PluginsModule.kt index 64c2fb24dd..589a7ea2d4 100644 --- a/app/src/main/java/info/nightscout/androidaps/di/PluginsModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/di/PluginsModule.kt @@ -44,7 +44,6 @@ import info.nightscout.androidaps.plugins.iob.iobCobCalculator.IobCobCalculatorP import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin import info.nightscout.androidaps.plugins.pump.combo.ComboPlugin import info.nightscout.androidaps.plugins.pump.insight.LocalInsightPlugin -import info.nightscout.androidaps.plugins.pump.mdi.MDIPlugin import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin import info.nightscout.androidaps.plugins.pump.omnipod.dash.OmnipodDashPumpPlugin import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin @@ -182,14 +181,8 @@ abstract class PluginsModule { @Binds @PumpDriver @IntoMap - @IntKey(155) - abstract fun bindDiaconnG8Plugin(plugin: DiaconnG8Plugin): PluginBase - - @Binds - @NotNSClient - @IntoMap @IntKey(160) - abstract fun bindMDIPlugin(plugin: MDIPlugin): PluginBase + abstract fun bindDiaconnG8Plugin(plugin: DiaconnG8Plugin): PluginBase @Binds @AllConfigs diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.kt deleted file mode 100644 index f03c4f7da7..0000000000 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/mdi/MDIPlugin.kt +++ /dev/null @@ -1,158 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.mdi - -import dagger.android.HasAndroidInjector -import info.nightscout.androidaps.R -import info.nightscout.androidaps.data.DetailedBolusInfo -import info.nightscout.androidaps.data.PumpEnactResult -import info.nightscout.androidaps.interfaces.* -import info.nightscout.androidaps.plugins.common.ManufacturerType -import info.nightscout.androidaps.plugins.pump.common.defs.PumpType -import info.nightscout.androidaps.utils.DateUtil -import info.nightscout.androidaps.utils.InstanceId -import info.nightscout.androidaps.interfaces.ResourceHelper -import info.nightscout.shared.logging.AAPSLogger -import info.nightscout.shared.logging.LTag -import org.json.JSONException -import org.json.JSONObject -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -class MDIPlugin @Inject constructor( - injector: HasAndroidInjector, - aapsLogger: AAPSLogger, - rh: ResourceHelper, - commandQueue: CommandQueue, - private val dateUtil: DateUtil, - private val pumpSync: PumpSync -) : PumpPluginBase(PluginDescription() - .mainType(PluginType.PUMP) - .pluginIcon(R.drawable.ic_ict) - .pluginName(R.string.mdi) - .description(R.string.description_pump_mdi), - injector, aapsLogger, rh, commandQueue -), Pump { - - override val pumpDescription = PumpDescription() - - init { - pumpDescription.isBolusCapable = true - pumpDescription.bolusStep = 0.5 - pumpDescription.isExtendedBolusCapable = false - pumpDescription.isTempBasalCapable = false - pumpDescription.isSetBasalProfileCapable = false - pumpDescription.isRefillingCapable = false - pumpDescription.isBatteryReplaceable = false - } - - override val isFakingTempsByExtendedBoluses: Boolean = false - - override fun loadTDDs(): PumpEnactResult = PumpEnactResult(injector) - override fun isInitialized(): Boolean = true - override fun isSuspended(): Boolean = false - override fun isBusy(): Boolean = false - override fun isConnected(): Boolean = true - override fun isConnecting(): Boolean = false - override fun isHandshakeInProgress(): Boolean = false - override fun connect(reason: String) {} - override fun disconnect(reason: String) {} - override fun waitForDisconnectionInSeconds(): Int = 0 - override fun stopConnecting() {} - override fun getPumpStatus(reason: String) {} - override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResult(injector).success(true).enacted(true) - override fun isThisProfileSet(profile: Profile): Boolean = false - override fun lastDataTime(): Long = System.currentTimeMillis() - override val baseBasalRate: Double = 0.0 - override val reservoirLevel: Double = -1.0 - override val batteryLevel: Int = -1 - - override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult { - val result = PumpEnactResult(injector) - result.success = true - result.bolusDelivered = detailedBolusInfo.insulin - result.carbsDelivered = detailedBolusInfo.carbs - result.comment = rh.gs(R.string.virtualpump_resultok) - if (detailedBolusInfo.insulin > 0) - pumpSync.syncBolusWithPumpId( - timestamp = detailedBolusInfo.timestamp, - amount = detailedBolusInfo.insulin, - type = detailedBolusInfo.bolusType, - pumpId = dateUtil.now(), - pumpType = PumpType.MDI, - pumpSerial = serialNumber()) - if (detailedBolusInfo.carbs > 0) - pumpSync.syncCarbsWithTimestamp( - timestamp = detailedBolusInfo.carbsTimestamp ?: detailedBolusInfo.timestamp, - amount = detailedBolusInfo.carbs, - pumpId = null, - pumpType = PumpType.MDI, - pumpSerial = serialNumber()) - return result - } - - override fun stopBolusDelivering() {} - override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult { - val result = PumpEnactResult(injector) - result.success = false - result.comment = rh.gs(R.string.pumperror) - aapsLogger.debug(LTag.PUMPBTCOMM, "Setting temp basal absolute: $result") - return result - } - - override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult { - val result = PumpEnactResult(injector) - result.success = false - result.comment = rh.gs(R.string.pumperror) - aapsLogger.debug(LTag.PUMPBTCOMM, "Settings temp basal percent: $result") - return result - } - - override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult { - val result = PumpEnactResult(injector) - result.success = false - result.comment = rh.gs(R.string.pumperror) - aapsLogger.debug(LTag.PUMPBTCOMM, "Setting extended bolus: $result") - return result - } - - override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult { - val result = PumpEnactResult(injector) - result.success = false - result.comment = rh.gs(R.string.pumperror) - aapsLogger.debug(LTag.PUMPBTCOMM, "Cancel temp basal: $result") - return result - } - - override fun cancelExtendedBolus(): PumpEnactResult { - val result = PumpEnactResult(injector) - result.success = false - result.comment = rh.gs(R.string.pumperror) - aapsLogger.debug(LTag.PUMPBTCOMM, "Canceling extended bolus: $result") - return result - } - - override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject { - val now = System.currentTimeMillis() - val pump = JSONObject() - val status = JSONObject() - val extended = JSONObject() - try { - status.put("status", "normal") - extended.put("Version", version) - extended.put("ActiveProfile", profileName) - status.put("timestamp", dateUtil.toISOString(now)) - pump.put("status", status) - pump.put("extended", extended) - pump.put("clock", dateUtil.toISOString(now)) - } catch (e: JSONException) { - aapsLogger.error("Exception: ", e) - } - return pump - } - - override fun manufacturer(): ManufacturerType = ManufacturerType.AndroidAPS - override fun model(): PumpType = PumpType.MDI - override fun serialNumber(): String = InstanceId.instanceId - override fun shortStatus(veryShort: Boolean): String = model().model - override fun canHandleDST(): Boolean = true -} \ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 771a2e7a73..76a0593fb9 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -92,6 +92,7 @@ Generic AAPS + MDI Accu-Chek Combo Accu-Chek Spirit Accu-Chek Insight diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 716eb554d2..eb50291484 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -81,7 +81,6 @@ Displays the current state of your loop and buttons for most common actions Shows an ongoing notification with a short overview of what your loop is doing Define a profile which is available offline. - Pump integration for people who do multiple daily injections for their diabetes therapy Pump integration for pumps which don\'t have any driver yet (Open Loop) Sensitivity is calculated the same way like Oref0, but you can specify timeframe to the past. Minimal carb absorption is calculated from max carb absorption time from preferences. Sensitivity is calculated from 8h or 24h data in the past (using either which is more sensitive). Carbs (if not absorbed) are cut after time specified in preferences. Plugin also calculates UAM. @@ -303,7 +302,6 @@ Basal value below minimum. Profile not set! BG: Last BG: - MDI MM640g Ongoing Notification OLD DATA diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt index cd59d1413b..9344476a61 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt @@ -288,6 +288,7 @@ enum class PumpType { pumpCapability = PumpCapability.YpsomedCapabilities), MDI(description = "MDI", manufacturer = ManufacturerType.AndroidAPS, + bolusSize = 0.5, model = "MDI", tbrSettings = DoseSettings(1.0, 15, 24 * 60, 0.0, 500.0), extendedBolusSettings = DoseSettings(0.1, 15, 12 * 60, 0.1),