This commit is contained in:
Milos Kozak 2022-11-11 09:43:07 +01:00
parent e4ccc78a7d
commit 3305672ade
60 changed files with 459 additions and 459 deletions

View file

@ -16,7 +16,7 @@ import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.MainActivity
import info.nightscout.androidaps.R
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.convertedToPercent
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
@ -382,7 +382,7 @@ class LoopPlugin @Inject constructor(
if (resultAfterConstraints.isChangeRequested
&& !commandQueue.bolusInQueue()
) {
val waiting = PumpEnactResultImpl(injector)
val waiting = PumpEnactResultObject(injector)
waiting.queued = true
if (resultAfterConstraints.tempBasalRequested) lastRun.tbrSetByPump = waiting
if (resultAfterConstraints.bolusRequested()) lastRun.smbSetByPump = waiting
@ -533,18 +533,18 @@ class LoopPlugin @Inject constructor(
*/
private fun applyTBRRequest(request: APSResult, profile: Profile, callback: Callback?) {
if (!request.tempBasalRequested) {
callback?.result(PumpEnactResultImpl(injector).enacted(false).success(true).comment(R.string.nochangerequested))?.run()
callback?.result(PumpEnactResultObject(injector).enacted(false).success(true).comment(R.string.nochangerequested))?.run()
return
}
val pump = activePlugin.activePump
if (!pump.isInitialized()) {
aapsLogger.debug(LTag.APS, "applyAPSRequest: " + rh.gs(R.string.pumpNotInitialized))
callback?.result(PumpEnactResultImpl(injector).comment(R.string.pumpNotInitialized).enacted(false).success(false))?.run()
callback?.result(PumpEnactResultObject(injector).comment(R.string.pumpNotInitialized).enacted(false).success(false))?.run()
return
}
if (pump.isSuspended()) {
aapsLogger.debug(LTag.APS, "applyAPSRequest: " + rh.gs(R.string.pumpsuspended))
callback?.result(PumpEnactResultImpl(injector).comment(R.string.pumpsuspended).enacted(false).success(false))?.run()
callback?.result(PumpEnactResultObject(injector).comment(R.string.pumpsuspended).enacted(false).success(false))?.run()
return
}
aapsLogger.debug(LTag.APS, "applyAPSRequest: $request")
@ -558,7 +558,7 @@ class LoopPlugin @Inject constructor(
} else {
aapsLogger.debug(LTag.APS, "applyAPSRequest: Basal set correctly")
callback?.result(
PumpEnactResultImpl(injector).absolute(request.rate).duration(0)
PumpEnactResultObject(injector).absolute(request.rate).duration(0)
.enacted(false).success(true).comment(R.string.basal_set_correctly)
)?.run()
}
@ -571,7 +571,7 @@ class LoopPlugin @Inject constructor(
} else {
aapsLogger.debug(LTag.APS, "applyAPSRequest: Basal set correctly")
callback?.result(
PumpEnactResultImpl(injector).percent(request.percent).duration(0)
PumpEnactResultObject(injector).percent(request.percent).duration(0)
.enacted(false).success(true).comment(R.string.basal_set_correctly)
)?.run()
}
@ -582,7 +582,7 @@ class LoopPlugin @Inject constructor(
) {
aapsLogger.debug(LTag.APS, "applyAPSRequest: Temp basal set correctly")
callback?.result(
PumpEnactResultImpl(injector).percent(request.percent)
PumpEnactResultObject(injector).percent(request.percent)
.enacted(false).success(true).duration(activeTemp.plannedRemainingMinutes)
.comment(R.string.let_temp_basal_run)
)?.run()
@ -605,7 +605,7 @@ class LoopPlugin @Inject constructor(
) {
aapsLogger.debug(LTag.APS, "applyAPSRequest: Temp basal set correctly")
callback?.result(
PumpEnactResultImpl(injector).absolute(activeTemp.convertedToAbsolute(now, profile))
PumpEnactResultObject(injector).absolute(activeTemp.convertedToAbsolute(now, profile))
.enacted(false).success(true).duration(activeTemp.plannedRemainingMinutes)
.comment(R.string.let_temp_basal_run)
)?.run()
@ -631,7 +631,7 @@ class LoopPlugin @Inject constructor(
if (lastBolusTime != 0L && lastBolusTime + 3 * 60 * 1000 > System.currentTimeMillis()) {
aapsLogger.debug(LTag.APS, "SMB requested but still in 3 min interval")
callback?.result(
PumpEnactResultImpl(injector)
PumpEnactResultObject(injector)
.comment(R.string.smb_frequency_exceeded)
.enacted(false).success(false)
)?.run()
@ -639,12 +639,12 @@ class LoopPlugin @Inject constructor(
}
if (!pump.isInitialized()) {
aapsLogger.debug(LTag.APS, "applySMBRequest: " + rh.gs(R.string.pumpNotInitialized))
callback?.result(PumpEnactResultImpl(injector).comment(R.string.pumpNotInitialized).enacted(false).success(false))?.run()
callback?.result(PumpEnactResultObject(injector).comment(R.string.pumpNotInitialized).enacted(false).success(false))?.run()
return
}
if (pump.isSuspended()) {
aapsLogger.debug(LTag.APS, "applySMBRequest: " + rh.gs(R.string.pumpsuspended))
callback?.result(PumpEnactResultImpl(injector).comment(R.string.pumpsuspended).enacted(false).success(false))?.run()
callback?.result(PumpEnactResultObject(injector).comment(R.string.pumpsuspended).enacted(false).success(false))?.run()
return
}
aapsLogger.debug(LTag.APS, "applySMBRequest: $request")

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.Pump
@ -44,30 +44,30 @@ class TestPumpPlugin(val injector: HasAndroidInjector) : Pump {
override fun waitForDisconnectionInSeconds(): Int = 0
override fun getPumpStatus(reason: String) {}
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultImpl(injector)
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultObject(injector)
override fun isThisProfileSet(profile: Profile): Boolean = isProfileSet
override fun lastDataTime(): Long = lastData
override val baseBasalRate: Double = baseBasal
override val reservoirLevel: Double = 0.0
override val batteryLevel: Int = 0
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun stopBolusDelivering() {}
override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult =
PumpEnactResultImpl(injector).success(true)
PumpEnactResultObject(injector).success(true)
override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult =
PumpEnactResultImpl(injector).success(true)
PumpEnactResultObject(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject = JSONObject()
override fun manufacturer(): ManufacturerType = ManufacturerType.AAPS
override fun model(): PumpType = PumpType.GENERIC_AAPS
override fun serialNumber(): String = "1"
override fun shortStatus(veryShort: Boolean): String = ""
override val isFakingTempsByExtendedBoluses: Boolean = false
override fun loadTDDs(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun loadTDDs(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun canHandleDST(): Boolean = true
override fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
}

View file

@ -8,7 +8,7 @@ import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.dana.DanaPump
import info.nightscout.androidaps.danar.DanaRPlugin
import info.nightscout.androidaps.danars.DanaRSPlugin
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.insight.database.InsightDatabaseDao
import info.nightscout.androidaps.insight.database.InsightDbHelper
import info.nightscout.androidaps.plugins.aps.openAPSAMA.OpenAPSAMAPlugin
@ -86,7 +86,7 @@ class ConstraintsCheckerTest : TestBaseWithProfile() {
it.sp = sp
it.dateUtil = dateUtil
}
if (it is PumpEnactResultImpl) {
if (it is PumpEnactResultObject) {
it.rh = rh
}
}

View file

@ -4,7 +4,7 @@ import android.content.Context
import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.interfaces.queue.Callback
import info.nightscout.shared.utils.DateUtil
import info.nightscout.interfaces.utils.JsonHelper
@ -41,7 +41,7 @@ class ActionAlarm(injector: HasAndroidInjector) : Action(injector) {
override fun doAction(callback: Callback) {
timerUtil.scheduleReminder(10, text.value.takeIf { it.isNotBlank() }
?: rh.gs(config.appName))
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.ok)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.ok)).run()
}
override fun toJSON(): String {

View file

@ -2,7 +2,7 @@ package info.nightscout.automation.actions
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.logging.UserEntryLogger
@ -41,7 +41,7 @@ class ActionLoopDisable(injector: HasAndroidInjector) : Action(injector) {
}
})
} else {
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.alreadydisabled)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.alreadydisabled)).run()
}
}

View file

@ -2,7 +2,7 @@ package info.nightscout.automation.actions
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.automation.R
@ -33,9 +33,9 @@ class ActionLoopEnable(injector: HasAndroidInjector) : Action(injector) {
configBuilder.storeSettings("ActionLoopEnable")
rxBus.send(EventRefreshOverview("ActionLoopEnable"))
uel.log(UserEntry.Action.LOOP_ENABLED, Sources.Automation, title)
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.ok)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.ok)).run()
} else {
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.alreadyenabled)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.alreadyenabled)).run()
}
}

View file

@ -2,7 +2,7 @@ package info.nightscout.automation.actions
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.CancelCurrentOfflineEventIfAnyTransaction
import info.nightscout.androidaps.interfaces.Loop
@ -45,9 +45,9 @@ class ActionLoopResume(injector: HasAndroidInjector) : Action(injector) {
})
rxBus.send(EventRefreshOverview("ActionLoopResume"))
uel.log(UserEntry.Action.RESUME, Sources.Automation, title)
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.ok)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.ok)).run()
} else {
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.notsuspended)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.notsuspended)).run()
}
}

View file

@ -3,7 +3,7 @@ package info.nightscout.automation.actions
import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.Loop
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.automation.R
@ -40,9 +40,9 @@ class ActionLoopSuspend(injector: HasAndroidInjector) : Action(injector) {
UserEntry.Action.SUSPEND, Sources.Automation, title + ": " + rh.gs(R.string.suspendloopforXmin, minutes.getMinutes()),
ValueWithUnit.Minute(minutes.getMinutes())
)
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.ok)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.ok)).run()
} else {
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.alreadysuspended)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.alreadysuspended)).run()
}
}

View file

@ -3,7 +3,7 @@ package info.nightscout.automation.actions
import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
@ -39,7 +39,7 @@ class ActionNotification(injector: HasAndroidInjector) : Action(injector) {
rxBus.send(EventNewNotification(notification))
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(text.value)).subscribe()
rxBus.send(EventRefreshOverview("ActionNotification"))
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.ok)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.ok)).run()
}
override fun toJSON(): String {

View file

@ -3,7 +3,7 @@ package info.nightscout.automation.actions
import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.UserEntryLogger
@ -39,23 +39,23 @@ class ActionProfileSwitch(injector: HasAndroidInjector) : Action(injector) {
//Check for uninitialized profileName
if (inputProfileName.value == "") {
aapsLogger.error(LTag.AUTOMATION, "Selected profile not initialized")
callback.result(PumpEnactResultImpl(injector).success(false).comment(R.string.error_field_must_not_be_empty)).run()
callback.result(PumpEnactResultObject(injector).success(false).comment(R.string.error_field_must_not_be_empty)).run()
return
}
if (profileFunction.getProfile() == null) {
aapsLogger.error(LTag.AUTOMATION, "ProfileFunctions not initialized")
callback.result(PumpEnactResultImpl(injector).success(false).comment(R.string.noprofile)).run()
callback.result(PumpEnactResultObject(injector).success(false).comment(R.string.noprofile)).run()
return
}
if (inputProfileName.value == activeProfileName) {
aapsLogger.debug(LTag.AUTOMATION, "Profile is already switched")
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.alreadyset)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.alreadyset)).run()
return
}
val profileStore = activePlugin.activeProfileSource.profile ?: return
if (profileStore.getSpecificProfile(inputProfileName.value) == null) {
aapsLogger.error(LTag.AUTOMATION, "Selected profile does not exist! - ${inputProfileName.value}")
callback.result(PumpEnactResultImpl(injector).success(false).comment(R.string.notexists)).run()
callback.result(PumpEnactResultObject(injector).success(false).comment(R.string.notexists)).run()
return
}
uel.log(
@ -64,7 +64,7 @@ class ActionProfileSwitch(injector: HasAndroidInjector) : Action(injector) {
ValueWithUnit.Percent(100)
)
val result = profileFunction.createProfileSwitch(profileStore, inputProfileName.value, 0, 100, 0, dateUtil.now())
callback.result(PumpEnactResultImpl(injector).success(result).comment(R.string.ok)).run()
callback.result(PumpEnactResultObject(injector).success(result).comment(R.string.ok)).run()
}
override fun generateDialog(root: LinearLayout) {

View file

@ -3,7 +3,7 @@ package info.nightscout.automation.actions
import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.automation.R
@ -50,10 +50,10 @@ class ActionProfileSwitchPercent(injector: HasAndroidInjector) : Action(injector
ValueWithUnit.Percent(pct.value.toInt()),
ValueWithUnit.Minute(duration.value)
)
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.ok)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.ok)).run()
} else {
aapsLogger.error(LTag.AUTOMATION, "Final profile not valid")
callback.result(PumpEnactResultImpl(injector).success(false).comment(R.string.ok)).run()
callback.result(PumpEnactResultObject(injector).success(false).comment(R.string.ok)).run()
}
}

View file

@ -3,7 +3,7 @@ package info.nightscout.automation.actions
import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.automation.R
@ -48,11 +48,11 @@ class ActionRunAutotune(injector: HasAndroidInjector) : Action(injector) {
message = R.string.autotune_run_with_error
aapsLogger.error(LTag.AUTOMATION, "Error during Autotune Run")
}
callback.result(PumpEnactResultImpl(injector).success(autotunePlugin.lastRunSuccess).comment(message)).run()
callback.result(PumpEnactResultObject(injector).success(autotunePlugin.lastRunSuccess).comment(message)).run()
} else {
message = R.string.autotune_run_cancelled
aapsLogger.debug(LTag.AUTOMATION, "Autotune run detected, Autotune Run Cancelled")
callback.result(PumpEnactResultImpl(injector).success(false).comment(message)).run()
callback.result(PumpEnactResultObject(injector).success(false).comment(message)).run()
}
}.start()
return

View file

@ -2,7 +2,7 @@ package info.nightscout.automation.actions
import android.widget.LinearLayout
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.automation.R
import info.nightscout.automation.elements.InputString
import info.nightscout.automation.elements.LabelWithElement
@ -25,7 +25,7 @@ class ActionSendSMS(injector: HasAndroidInjector) : Action(injector) {
override fun doAction(callback: Callback) {
val result = smsCommunicator.sendNotificationToAllNumbers(text.value)
callback.result(PumpEnactResultImpl(injector).success(result).comment(if (result) R.string.ok else R.string.error)).run()
callback.result(PumpEnactResultObject(injector).success(result).comment(if (result) R.string.ok else R.string.error)).run()
}
override fun isValid(): Boolean = text.value.isNotEmpty()

View file

@ -3,7 +3,7 @@ package info.nightscout.automation.actions
import android.widget.LinearLayout
import androidx.annotation.DrawableRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.extensions.friendlyDescription
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.ProfileFunction
@ -69,10 +69,10 @@ class ActionStartTempTarget(injector: HasAndroidInjector) : Action(injector) {
ValueWithUnit.Mgdl(tt().highTarget).takeIf { tt().lowTarget != tt().highTarget },
ValueWithUnit.Minute(TimeUnit.MILLISECONDS.toMinutes(tt().duration).toInt())
)
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.ok)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.ok)).run()
}, {
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
callback.result(PumpEnactResultImpl(injector).success(false).comment(R.string.error)).run()
callback.result(PumpEnactResultObject(injector).success(false).comment(R.string.error)).run()
})
}

View file

@ -3,7 +3,7 @@ package info.nightscout.automation.actions
import androidx.annotation.DrawableRes
import com.google.gson.JsonObject
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.interfaces.queue.Callback
import info.nightscout.automation.R
import org.json.JSONObject
@ -17,7 +17,7 @@ class ActionStopProcessing(injector: HasAndroidInjector) : Action(injector) {
override fun isValid(): Boolean = true
override fun doAction(callback: Callback) {
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.ok)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.ok)).run()
}
override fun toJSON(): String {

View file

@ -1,7 +1,7 @@
package info.nightscout.automation.actions
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTransaction
import info.nightscout.androidaps.logging.UserEntryLogger
@ -35,7 +35,7 @@ class ActionStopTempTarget(injector: HasAndroidInjector) : Action(injector) {
}, {
aapsLogger.error(LTag.DATABASE, "Error while saving temporary target", it)
})
callback.result(PumpEnactResultImpl(injector).success(true).comment(R.string.ok)).run()
callback.result(PumpEnactResultObject(injector).success(true).comment(R.string.ok)).run()
}
override fun isValid(): Boolean = true

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription
import info.nightscout.interfaces.profile.Profile
@ -56,31 +56,31 @@ class TestPumpPlugin(
override fun waitForDisconnectionInSeconds(): Int = 0
override fun getPumpStatus(reason: String) {}
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultImpl(injector)
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultObject(injector)
override fun isThisProfileSet(profile: Profile): Boolean = isProfileSet
override fun lastDataTime(): Long = lastData
override val baseBasalRate: Double = baseBasal
override val reservoirLevel: Double = 0.0
override val batteryLevel: Int = 0
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun stopBolusDelivering() {}
override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult = PumpEnactResultImpl(
override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult = PumpEnactResultObject(
injector
).success(true)
override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult =
PumpEnactResultImpl(injector).success(true)
PumpEnactResultObject(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject = JSONObject()
override fun manufacturer(): ManufacturerType = ManufacturerType.AAPS
override fun model(): PumpType = PumpType.GENERIC_AAPS
override fun serialNumber(): String = "1"
override fun shortStatus(veryShort: Boolean): String = ""
override val isFakingTempsByExtendedBoluses: Boolean = false
override fun loadTDDs(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun loadTDDs(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun canHandleDST(): Boolean = true
override fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
override fun specialEnableCondition(): Boolean = specialEnable

View file

@ -4,7 +4,7 @@ import android.content.Context
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.interfaces.queue.Callback
import info.nightscout.shared.utils.DateUtil
@ -40,7 +40,7 @@ class ActionAlarmTest : TestBase() {
it.dateUtil = dateUtil
it.config = config
}
if (it is PumpEnactResultImpl) {
if (it is PumpEnactResultObject) {
it.rh = rh
}
}

View file

@ -3,7 +3,7 @@ package info.nightscout.automation.actions
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
import info.nightscout.database.impl.transactions.Transaction
@ -35,7 +35,7 @@ class ActionNotificationTest : TestBase() {
it.rxBus = rxBus
it.repository = repository
}
if (it is PumpEnactResultImpl) {
if (it is PumpEnactResultObject) {
it.rh = rh
}
}

View file

@ -4,7 +4,7 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.TestPumpPlugin
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.Loop
@ -157,7 +157,7 @@ ActionsTestBase : TestBaseWithProfile() {
if (it is ActionStopProcessing) {
it.rh = rh
}
if (it is PumpEnactResultImpl) {
if (it is PumpEnactResultObject) {
it.rh = rh
}
if (it is Trigger) {

View file

@ -9,7 +9,7 @@ import info.nightscout.shared.interfaces.ResourceHelper
import org.json.JSONObject
import javax.inject.Inject
class PumpEnactResultImpl(injector: HasAndroidInjector) : PumpEnactResult {
class PumpEnactResultObject(injector: HasAndroidInjector) : PumpEnactResult {
@Inject lateinit var rh: ResourceHelper
@ -33,18 +33,18 @@ class PumpEnactResultImpl(injector: HasAndroidInjector) : PumpEnactResult {
override var carbsDelivered = 0.0 // real value of delivered carbs
override var queued = false
override fun success(success: Boolean): PumpEnactResultImpl = this.also { this.success = success }
override fun enacted(enacted: Boolean): PumpEnactResultImpl = this.also { it.enacted = enacted }
override fun comment(comment: String): PumpEnactResultImpl = this.also { it.comment = comment }
override fun comment(comment: Int): PumpEnactResultImpl = this.also { it.comment = rh.gs(comment) }
override fun duration(duration: Int): PumpEnactResultImpl = this.also { it.duration = duration }
override fun absolute(absolute: Double): PumpEnactResultImpl = this.also { it.absolute = absolute }
override fun percent(percent: Int): PumpEnactResultImpl = this.also { it.percent = percent }
override fun isPercent(isPercent: Boolean): PumpEnactResultImpl = this.also { it.isPercent = isPercent }
override fun isTempCancel(isTempCancel: Boolean): PumpEnactResultImpl = this.also { it.isTempCancel = isTempCancel }
override fun bolusDelivered(bolusDelivered: Double): PumpEnactResultImpl = this.also { it.bolusDelivered = bolusDelivered }
override fun carbsDelivered(carbsDelivered: Double): PumpEnactResultImpl = this.also { it.carbsDelivered = carbsDelivered }
override fun queued(queued: Boolean): PumpEnactResultImpl = this.also { it.queued = queued }
override fun success(success: Boolean): PumpEnactResultObject = this.also { this.success = success }
override fun enacted(enacted: Boolean): PumpEnactResultObject = this.also { it.enacted = enacted }
override fun comment(comment: String): PumpEnactResultObject = this.also { it.comment = comment }
override fun comment(comment: Int): PumpEnactResultObject = this.also { it.comment = rh.gs(comment) }
override fun duration(duration: Int): PumpEnactResultObject = this.also { it.duration = duration }
override fun absolute(absolute: Double): PumpEnactResultObject = this.also { it.absolute = absolute }
override fun percent(percent: Int): PumpEnactResultObject = this.also { it.percent = percent }
override fun isPercent(isPercent: Boolean): PumpEnactResultObject = this.also { it.isPercent = isPercent }
override fun isTempCancel(isTempCancel: Boolean): PumpEnactResultObject = this.also { it.isTempCancel = isTempCancel }
override fun bolusDelivered(bolusDelivered: Double): PumpEnactResultObject = this.also { it.bolusDelivered = bolusDelivered }
override fun carbsDelivered(carbsDelivered: Double): PumpEnactResultObject = this.also { it.carbsDelivered = carbsDelivered }
override fun queued(queued: Boolean): PumpEnactResultObject = this.also { it.queued = queued }
override fun log(): String {
return "Success: " + success +

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.plugins.aps.loop.APSResult
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.data.AutosensData
import info.nightscout.core.profile.ProfileStoreObject
@ -11,7 +11,7 @@ import info.nightscout.core.profile.ProfileStoreObject
@Suppress("unused")
abstract class CoreDataClassesModule {
@ContributesAndroidInjector abstract fun pumpEnactResultInjector(): PumpEnactResultImpl
@ContributesAndroidInjector abstract fun pumpEnactResultInjector(): PumpEnactResultObject
@ContributesAndroidInjector abstract fun apsResultInjector(): APSResult
@ContributesAndroidInjector abstract fun autosensDataInjector(): AutosensData

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.queue.commands
import dagger.android.HasAndroidInjector
import info.nightscout.core.main.R
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.database.impl.AppRepository
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.interfaces.queue.Callback
@ -48,7 +48,7 @@ abstract class Command(
abstract fun log(): String
fun cancel() {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.success = false
result.comment = rh.gs(R.string.connectiontimedout)
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.Pump
@ -44,30 +44,30 @@ class TestPumpPlugin(val injector: HasAndroidInjector) : Pump {
override fun waitForDisconnectionInSeconds(): Int = 0
override fun getPumpStatus(reason: String) {}
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultImpl(injector)
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultObject(injector)
override fun isThisProfileSet(profile: Profile): Boolean = isProfileSet
override fun lastDataTime(): Long = lastData
override val baseBasalRate: Double = baseBasal
override val reservoirLevel: Double = 0.0
override val batteryLevel: Int = 0
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun stopBolusDelivering() {}
override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult =
PumpEnactResultImpl(injector).success(true)
PumpEnactResultObject(injector).success(true)
override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult =
PumpEnactResultImpl(injector).success(true)
PumpEnactResultObject(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject = JSONObject()
override fun manufacturer(): ManufacturerType = ManufacturerType.AAPS
override fun model(): PumpType = PumpType.GENERIC_AAPS
override fun serialNumber(): String = "1"
override fun shortStatus(veryShort: Boolean): String = ""
override val isFakingTempsByExtendedBoluses: Boolean = false
override fun loadTDDs(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun loadTDDs(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun canHandleDST(): Boolean = true
override fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
}

View file

@ -16,7 +16,7 @@ class PumpEnactResultTest : TestBaseWithProfile() {
private val injector = HasAndroidInjector {
AndroidInjector {
if (it is PumpEnactResultImpl) {
if (it is PumpEnactResultObject) {
it.rh = rh
}
}
@ -37,84 +37,84 @@ class PumpEnactResultTest : TestBaseWithProfile() {
}
@Test fun successTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
per.success(true)
Assert.assertEquals(true, per.success)
}
@Test fun enactedTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
per.enacted(true)
Assert.assertEquals(true, per.enacted)
}
@Test fun commentTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
per.comment("SomeComment")
Assert.assertEquals("SomeComment", per.comment)
}
@Test fun durationTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
per.duration(10)
Assert.assertEquals(10, per.duration.toLong())
}
@Test fun absoluteTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
per.absolute(11.0)
Assert.assertEquals(11.0, per.absolute, 0.01)
}
@Test fun percentTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
per.percent(10)
Assert.assertEquals(10, per.percent)
}
@Test fun isPercentTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
per.isPercent(true)
Assert.assertEquals(true, per.isPercent)
}
@Test fun isTempCancelTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
per.isTempCancel(true)
Assert.assertEquals(true, per.isTempCancel)
}
@Test fun bolusDeliveredTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
per.bolusDelivered(11.0)
Assert.assertEquals(11.0, per.bolusDelivered, 0.01)
}
@Test fun carbsDeliveredTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
per.carbsDelivered(11.0)
Assert.assertEquals(11.0, per.carbsDelivered, 0.01)
}
@Test fun queuedTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
per.queued(true)
Assert.assertEquals(true, per.queued)
}
@Test fun logTest() {
val per = PumpEnactResultImpl(injector)
val per = PumpEnactResultObject(injector)
Assert.assertEquals(
"Success: false Enacted: false Comment: Duration: -1 Absolute: -1.0 Percent: -1 IsPercent: false IsTempCancel: false bolusDelivered: 0.0 carbsDelivered: 0.0 Queued: false",
@ -123,7 +123,7 @@ class PumpEnactResultTest : TestBaseWithProfile() {
}
@Test fun toStringTest() {
var per = PumpEnactResultImpl(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
var per = PumpEnactResultObject(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
Assert.assertEquals(
"""
Success: false
@ -132,7 +132,7 @@ class PumpEnactResultTest : TestBaseWithProfile() {
Insulin: 10.0 U
""".trimIndent(), per.toString()
)
per = PumpEnactResultImpl(injector).enacted(true).isTempCancel(true).comment("AAA")
per = PumpEnactResultObject(injector).enacted(true).isTempCancel(true).comment("AAA")
Assert.assertEquals(
"""
Success: false
@ -141,7 +141,7 @@ class PumpEnactResultTest : TestBaseWithProfile() {
Cancel temp basal
""".trimIndent(), per.toString()
)
per = PumpEnactResultImpl(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
per = PumpEnactResultObject(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
Assert.assertEquals(
"""
Success: false
@ -151,7 +151,7 @@ class PumpEnactResultTest : TestBaseWithProfile() {
Percent: 90%
""".trimIndent(), per.toString()
)
per = PumpEnactResultImpl(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
per = PumpEnactResultObject(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
Assert.assertEquals(
"""
Success: false
@ -161,7 +161,7 @@ class PumpEnactResultTest : TestBaseWithProfile() {
Absolute: 1.0 U/h
""".trimIndent(), per.toString()
)
per = PumpEnactResultImpl(injector).enacted(false).comment("AAA")
per = PumpEnactResultObject(injector).enacted(false).comment("AAA")
Assert.assertEquals(
"""
Success: false
@ -172,31 +172,31 @@ class PumpEnactResultTest : TestBaseWithProfile() {
@Test fun toHtmlTest() {
var per: PumpEnactResult = PumpEnactResultImpl(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
var per: PumpEnactResult = PumpEnactResultObject(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
Assert.assertEquals("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br><b>SMB</b>: 10.0 U", per.toHtml())
per = PumpEnactResultImpl(injector).enacted(true).isTempCancel(true).comment("AAA")
per = PumpEnactResultObject(injector).enacted(true).isTempCancel(true).comment("AAA")
Assert.assertEquals("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br>Cancel temp basal", per.toHtml())
per = PumpEnactResultImpl(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
per = PumpEnactResultObject(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
Assert.assertEquals("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br><b>Duration</b>: 20 min<br><b>Percent</b>: 90%", per.toHtml())
per = PumpEnactResultImpl(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
per = PumpEnactResultObject(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
Assert.assertEquals("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br><b>Duration</b>: 30 min<br><b>Absolute</b>: 1.00 U/h", per.toHtml())
per = PumpEnactResultImpl(injector).enacted(false).comment("AAA")
per = PumpEnactResultObject(injector).enacted(false).comment("AAA")
Assert.assertEquals("<b>Success</b>: false<br><b>Comment</b>: AAA", per.toHtml())
}
@Test fun jsonTest() {
var o: JSONObject?
var per: PumpEnactResult = PumpEnactResultImpl(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
var per: PumpEnactResult = PumpEnactResultObject(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
o = per.json(validProfile.getBasal())
JSONAssert.assertEquals("{\"smb\":10}", o, false)
per = PumpEnactResultImpl(injector).enacted(true).isTempCancel(true).comment("AAA")
per = PumpEnactResultObject(injector).enacted(true).isTempCancel(true).comment("AAA")
o = per.json(validProfile.getBasal())
JSONAssert.assertEquals("{\"rate\":0,\"duration\":0}", o, false)
per = PumpEnactResultImpl(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
per = PumpEnactResultObject(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
o = per.json(validProfile.getBasal())
JSONAssert.assertEquals("{\"rate\":0.9,\"duration\":20}", o, false)
per = PumpEnactResultImpl(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
per = PumpEnactResultObject(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
o = per.json(validProfile.getBasal())
JSONAssert.assertEquals("{\"rate\":1,\"duration\":30}", o, false)
}

View file

@ -8,7 +8,7 @@ import androidx.appcompat.app.AppCompatActivity
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.dialogs.BolusProgressDialog
import info.nightscout.androidaps.extensions.getCustomizedName
import info.nightscout.androidaps.interfaces.ActivePlugin
@ -147,7 +147,7 @@ class CommandQueueImplementation @Inject constructor(
}
private fun executingNowError(): PumpEnactResult =
PumpEnactResultImpl(injector).success(false).enacted(false).comment(R.string.executing_right_now)
PumpEnactResultObject(injector).success(false).enacted(false).comment(R.string.executing_right_now)
override fun isRunning(type: CommandType): Boolean = performing?.commandType == type
@ -270,12 +270,12 @@ class CommandQueueImplementation @Inject constructor(
.subscribeBy(
onSuccess = { result ->
result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted carbs $it") }
callback?.result(PumpEnactResultImpl(injector).enacted(false).success(true))?.run()
callback?.result(PumpEnactResultObject(injector).enacted(false).success(true))?.run()
},
onError = {
aapsLogger.error(LTag.DATABASE, "Error while saving carbs", it)
callback?.result(PumpEnactResultImpl(injector).enacted(false).success(false))?.run()
callback?.result(PumpEnactResultObject(injector).enacted(false).success(false))?.run()
}
)
}
@ -292,13 +292,13 @@ class CommandQueueImplementation @Inject constructor(
if (type == CommandType.SMB_BOLUS) {
if (bolusInQueue()) {
aapsLogger.debug(LTag.PUMPQUEUE, "Rejecting SMB since a bolus is queue/running")
callback?.result(PumpEnactResultImpl(injector).enacted(false).success(false))?.run()
callback?.result(PumpEnactResultObject(injector).enacted(false).success(false))?.run()
return false
}
val lastBolusTime = repository.getLastBolusRecord()?.timestamp ?: 0L
if (detailedBolusInfo.lastKnownBolusTime < lastBolusTime) {
aapsLogger.debug(LTag.PUMPQUEUE, "Rejecting bolus, another bolus was issued since request time")
callback?.result(PumpEnactResultImpl(injector).enacted(false).success(false))?.run()
callback?.result(PumpEnactResultObject(injector).enacted(false).success(false))?.run()
return false
}
removeAll(CommandType.SMB_BOLUS)
@ -351,7 +351,7 @@ class CommandQueueImplementation @Inject constructor(
@Synchronized
override fun cancelAllBoluses(id: Long?) {
if (!isRunning(CommandType.BOLUS)) {
rxBus.send(EventDismissBolusProgressIfRunning(PumpEnactResultImpl(injector).success(true).enacted(false), id))
rxBus.send(EventDismissBolusProgressIfRunning(PumpEnactResultObject(injector).success(true).enacted(false), id))
}
removeAll(CommandType.BOLUS)
removeAll(CommandType.SMB_BOLUS)
@ -435,12 +435,12 @@ class CommandQueueImplementation @Inject constructor(
override fun setProfile(profile: Profile, hasNsId: Boolean, callback: Callback?): Boolean {
if (isRunning(CommandType.BASAL_PROFILE)) {
aapsLogger.debug(LTag.PUMPQUEUE, "Command is already executed")
callback?.result(PumpEnactResultImpl(injector).success(true).enacted(false))?.run()
callback?.result(PumpEnactResultObject(injector).success(true).enacted(false))?.run()
return false
}
if (isThisProfileSet(profile) && repository.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet() is ValueWrapper.Existing) {
aapsLogger.debug(LTag.PUMPQUEUE, "Correct profile already set")
callback?.result(PumpEnactResultImpl(injector).success(true).enacted(false))?.run()
callback?.result(PumpEnactResultObject(injector).success(true).enacted(false))?.run()
return false
}
// Compare with pump limits
@ -449,7 +449,7 @@ class CommandQueueImplementation @Inject constructor(
if (basalValue.value < activePlugin.activePump.pumpDescription.basalMinimumRate) {
val notification = Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, rh.gs(R.string.basal_value_below_minimum), Notification.URGENT)
rxBus.send(EventNewNotification(notification))
callback?.result(PumpEnactResultImpl(injector).success(false).enacted(false).comment(R.string.basal_value_below_minimum))?.run()
callback?.result(PumpEnactResultObject(injector).success(false).enacted(false).comment(R.string.basal_value_below_minimum))?.run()
return false
}
}

View file

@ -1,7 +1,7 @@
package info.nightscout.implementation.queue.commands
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.interfaces.LocalAlertUtils
import info.nightscout.interfaces.queue.Callback
@ -26,7 +26,7 @@ class CommandReadStatus(
localAlertUtils.notifyPumpStatusRead()
aapsLogger.debug(LTag.PUMPQUEUE, "CommandReadStatus executed. Reason: $reason")
val pump = activePlugin.activePump
val result = PumpEnactResultImpl(injector).success(false)
val result = PumpEnactResultObject(injector).success(false)
val lastConnection = pump.lastDataTime()
if (lastConnection > System.currentTimeMillis() - T.mins(1).msecs()) result.success(true)
callback?.result(result)?.run()

View file

@ -1,7 +1,7 @@
package info.nightscout.implementation.queue.commands
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.queue.commands.Command
import info.nightscout.implementation.R
@ -28,11 +28,11 @@ class CommandSMBBolus(
aapsLogger.debug(LTag.PUMPQUEUE, "Last bolus: $lastBolusTime ${dateUtil.dateAndTimeAndSecondsString(lastBolusTime)}")
if (lastBolusTime != 0L && lastBolusTime + T.mins(3).msecs() > dateUtil.now()) {
aapsLogger.debug(LTag.PUMPQUEUE, "SMB requested but still in 3 min interval")
r = PumpEnactResultImpl(injector).enacted(false).success(false).comment("SMB requested but still in 3 min interval")
r = PumpEnactResultObject(injector).enacted(false).success(false).comment("SMB requested but still in 3 min interval")
} else if (detailedBolusInfo.deliverAtTheLatest != 0L && detailedBolusInfo.deliverAtTheLatest + T.mins(1).msecs() > System.currentTimeMillis()) {
r = activePlugin.activePump.deliverTreatment(detailedBolusInfo)
} else {
r = PumpEnactResultImpl(injector).enacted(false).success(false).comment("SMB request too old")
r = PumpEnactResultObject(injector).enacted(false).success(false).comment("SMB request too old")
aapsLogger.debug(LTag.PUMPQUEUE, "SMB bolus canceled. deliverAt: " + dateUtil.dateAndTimeString(detailedBolusInfo.deliverAtTheLatest))
}
aapsLogger.debug(LTag.PUMPQUEUE, "Result success: ${r.success} enacted: ${r.enacted}")

View file

@ -1,7 +1,7 @@
package info.nightscout.implementation.queue.commands
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.queue.commands.Command
@ -32,7 +32,7 @@ class CommandSetProfile constructor(
override fun execute() {
if (commandQueue.isThisProfileSet(profile) && repository.getEffectiveProfileSwitchActiveAt(dateUtil.now()).blockingGet() is ValueWrapper.Existing) {
aapsLogger.debug(LTag.PUMPQUEUE, "Correct profile already set. profile: $profile")
callback?.result(PumpEnactResultImpl(injector).success(true).enacted(false))?.run()
callback?.result(PumpEnactResultObject(injector).success(true).enacted(false))?.run()
return
}
val r = activePlugin.activePump.setNewBasalProfile(profile)

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.Pump
@ -44,30 +44,30 @@ class TestPumpPlugin(val injector: HasAndroidInjector) : Pump {
override fun waitForDisconnectionInSeconds(): Int = 0
override fun getPumpStatus(reason: String) {}
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultImpl(injector)
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultObject(injector)
override fun isThisProfileSet(profile: Profile): Boolean = isProfileSet
override fun lastDataTime(): Long = lastData
override val baseBasalRate: Double = baseBasal
override val reservoirLevel: Double = 0.0
override val batteryLevel: Int = 0
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun stopBolusDelivering() {}
override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult =
PumpEnactResultImpl(injector).success(true)
PumpEnactResultObject(injector).success(true)
override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult =
PumpEnactResultImpl(injector).success(true)
PumpEnactResultObject(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject = JSONObject()
override fun manufacturer(): ManufacturerType = ManufacturerType.AAPS
override fun model(): PumpType = PumpType.GENERIC_AAPS
override fun serialNumber(): String = "1"
override fun shortStatus(veryShort: Boolean): String = ""
override val isFakingTempsByExtendedBoluses: Boolean = false
override fun loadTDDs(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun loadTDDs(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun canHandleDST(): Boolean = true
override fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
}

View file

@ -6,7 +6,7 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.TestPumpPlugin
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.Constraints
import info.nightscout.androidaps.interfaces.ProfileFunction
@ -105,7 +105,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
if (it is CommandLoadHistory) {
it.activePlugin = activePlugin
}
if (it is PumpEnactResultImpl) {
if (it is PumpEnactResultObject) {
it.rh = rh
}
}

View file

@ -30,7 +30,7 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.data.PumpEnactResultImpl;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.insight.R;
import info.nightscout.androidaps.insight.database.InsightBolusID;
import info.nightscout.androidaps.insight.database.InsightDbHelper;
@ -475,7 +475,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
@NonNull @Override
public PumpEnactResult setNewBasalProfile(Profile profile) {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
List<BasalProfileBlock> profileBlocks = new ArrayList<>();
for (int i = 0; i < profile.getBasalValues().length; i++) {
@ -575,7 +575,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
if (detailedBolusInfo.insulin == 0 || detailedBolusInfo.carbs > 0) {
throw new IllegalArgumentException(detailedBolusInfo.toString(), new Exception());
}
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
double insulin = Math.round(detailedBolusInfo.insulin / 0.01) * 0.01;
if (insulin > 0) {
try {
@ -691,7 +691,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
@NonNull @Override
public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, @NonNull Profile profile, boolean enforceNew, @NonNull PumpSync.TemporaryBasalType tbrType) {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
if (activeBasalRate == null) return result;
if (activeBasalRate.getActiveBasalRate() == 0) return result;
double percent = 100D / activeBasalRate.getActiveBasalRate() * absoluteRate;
@ -741,7 +741,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
@NonNull @Override
public PumpEnactResult setTempBasalPercent(int percent, int durationInMinutes, @NonNull Profile profile, boolean enforceNew, @NonNull PumpSync.TemporaryBasalType tbrType) {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
percent = (int) Math.round(((double) percent) / 10d) * 10;
if (percent == 100) return cancelTempBasal(true);
else if (percent > 250) percent = 250;
@ -797,7 +797,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
}
public PumpEnactResult setExtendedBolusOnly(Double insulin, Integer durationInMinutes, boolean disableVibration) {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
try {
DeliverBolusMessage bolusMessage = new DeliverBolusMessage();
bolusMessage.setBolusType(BolusType.EXTENDED);
@ -829,7 +829,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
@NonNull @Override
public PumpEnactResult cancelTempBasal(boolean enforceNew) {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
PumpEnactResult cancelEBResult = null;
if (isFakingTempsByExtendedBoluses()) cancelEBResult = cancelExtendedBolusOnly();
PumpEnactResult cancelTBRResult = cancelTempBasalOnly();
@ -850,7 +850,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
}
private PumpEnactResult cancelTempBasalOnly() {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
try {
alertService.ignore(AlertType.WARNING_36);
connectionService.requestMessage(new CancelTBRMessage()).await();
@ -893,7 +893,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
}
private PumpEnactResult cancelExtendedBolusOnly() {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
try {
for (ActiveBolus activeBolus : activeBoluses) {
if (activeBolus.getBolusType() == BolusType.EXTENDED || activeBolus.getBolusType() == BolusType.MULTIWAVE) {
@ -1012,7 +1012,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
}
public PumpEnactResult stopPump() {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
try {
SetOperatingModeMessage operatingModeMessage = new SetOperatingModeMessage();
operatingModeMessage.setOperatingMode(OperatingMode.STOPPED);
@ -1034,7 +1034,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
}
public PumpEnactResult startPump() {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
try {
SetOperatingModeMessage operatingModeMessage = new SetOperatingModeMessage();
operatingModeMessage.setOperatingMode(OperatingMode.STARTED);
@ -1056,7 +1056,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
}
public PumpEnactResult setTBROverNotification(boolean enabled) {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
boolean valueBefore = tbrOverNotificationBlock.isEnabled();
tbrOverNotificationBlock.setEnabled(enabled);
try {
@ -1119,7 +1119,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Insight,
@NonNull @Override
public PumpEnactResult loadTDDs() {
return new PumpEnactResultImpl(getInjector()).success(true);
return new PumpEnactResultObject(getInjector()).success(true);
}
private void readHistory() {

View file

@ -4,7 +4,7 @@ import android.os.SystemClock
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.dialogs.BolusProgressDialog
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.extensions.convertedToAbsolute
@ -133,7 +133,7 @@ open class VirtualPumpPlugin @Inject constructor(
override var fakeDataDetected = false
override fun loadTDDs(): PumpEnactResult { //no result, could read DB in the future?
return PumpEnactResultImpl(injector)
return PumpEnactResultObject(injector)
}
override fun isInitialized(): Boolean = true
@ -158,7 +158,7 @@ open class VirtualPumpPlugin @Inject constructor(
lastDataTime = System.currentTimeMillis()
rxBus.send(EventNewNotification(Notification(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60)))
// Do nothing here. we are using database profile
return PumpEnactResultImpl(injector).success(true).enacted(true)
return PumpEnactResultObject(injector).success(true).enacted(true)
}
override fun isThisProfileSet(profile: Profile): Boolean = pumpSync.expectedPumpState().profile?.isEqual(profile) ?: false
@ -175,7 +175,7 @@ open class VirtualPumpPlugin @Inject constructor(
get() = batteryPercent
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
.success(true)
.bolusDelivered(detailedBolusInfo.insulin)
.carbsDelivered(detailedBolusInfo.carbs)
@ -191,7 +191,7 @@ open class VirtualPumpPlugin @Inject constructor(
rxBus.send(bolusingEvent)
delivering += 0.1
if (BolusProgressDialog.stopPressed)
return PumpEnactResultImpl(injector)
return PumpEnactResultObject(injector)
.success(false)
.enacted(false)
.comment(rh.gs(R.string.stoppressed))
@ -226,7 +226,7 @@ open class VirtualPumpPlugin @Inject constructor(
override fun stopBolusDelivering() {}
override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.success = true
result.enacted = true
result.isTempCancel = false
@ -250,7 +250,7 @@ open class VirtualPumpPlugin @Inject constructor(
}
override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.success = true
result.enacted = true
result.percent = percent
@ -299,7 +299,7 @@ open class VirtualPumpPlugin @Inject constructor(
}
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.success = true
result.isTempCancel = true
result.comment = rh.gs(R.string.virtualpump_resultok)
@ -319,7 +319,7 @@ open class VirtualPumpPlugin @Inject constructor(
}
override fun cancelExtendedBolus(): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
if (pumpSync.expectedPumpState().extendedBolus != null) {
pumpSync.syncStopExtendedBolusWithPumpId(
timestamp = dateUtil.now(),

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.Pump
@ -44,30 +44,30 @@ class TestPumpPlugin(val injector: HasAndroidInjector) : Pump {
override fun waitForDisconnectionInSeconds(): Int = 0
override fun getPumpStatus(reason: String) {}
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultImpl(injector)
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultObject(injector)
override fun isThisProfileSet(profile: Profile): Boolean = isProfileSet
override fun lastDataTime(): Long = lastData
override val baseBasalRate: Double = baseBasal
override val reservoirLevel: Double = 0.0
override val batteryLevel: Int = 0
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun stopBolusDelivering() {}
override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult =
PumpEnactResultImpl(injector).success(true)
PumpEnactResultObject(injector).success(true)
override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult =
PumpEnactResultImpl(injector).success(true)
PumpEnactResultObject(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject = JSONObject()
override fun manufacturer(): ManufacturerType = ManufacturerType.AAPS
override fun model(): PumpType = PumpType.GENERIC_AAPS
override fun serialNumber(): String = "1"
override fun shortStatus(veryShort: Boolean): String = ""
override val isFakingTempsByExtendedBoluses: Boolean = false
override fun loadTDDs(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun loadTDDs(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun canHandleDST(): Boolean = true
override fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
}

View file

@ -5,7 +5,7 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBaseWithProfile
import info.nightscout.androidaps.TestPumpPlugin
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.Constraints
@ -70,7 +70,7 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
var injector: HasAndroidInjector = HasAndroidInjector {
AndroidInjector {
if (it is PumpEnactResultImpl) {
if (it is PumpEnactResultObject) {
it.rh = rh
}
if (it is AuthRequest) {
@ -113,45 +113,45 @@ class SmsCommunicatorPluginTest : TestBaseWithProfile() {
smsCommunicatorPlugin.setPluginEnabled(PluginType.GENERAL, true)
Mockito.doAnswer { invocation: InvocationOnMock ->
val callback = invocation.getArgument<Callback>(1)
callback.result = PumpEnactResultImpl(injector).success(true)
callback.result = PumpEnactResultObject(injector).success(true)
callback.run()
null
}.`when`(commandQueue).cancelTempBasal(ArgumentMatchers.anyBoolean(), ArgumentMatchers.any(Callback::class.java))
Mockito.doAnswer { invocation: InvocationOnMock ->
val callback = invocation.getArgument<Callback>(0)
callback.result = PumpEnactResultImpl(injector).success(true)
callback.result = PumpEnactResultObject(injector).success(true)
callback.run()
null
}.`when`(commandQueue).cancelExtended(ArgumentMatchers.any(Callback::class.java))
Mockito.doAnswer { invocation: InvocationOnMock ->
val callback = invocation.getArgument<Callback>(1)
callback.result = PumpEnactResultImpl(injector).success(true)
callback.result = PumpEnactResultObject(injector).success(true)
callback.run()
null
}.`when`(commandQueue).readStatus(ArgumentMatchers.anyString(), ArgumentMatchers.any(Callback::class.java))
Mockito.doAnswer { invocation: InvocationOnMock ->
val callback = invocation.getArgument<Callback>(1)
callback.result = PumpEnactResultImpl(injector).success(true).bolusDelivered(1.0)
callback.result = PumpEnactResultObject(injector).success(true).bolusDelivered(1.0)
callback.run()
null
}.`when`(commandQueue).bolus(anyObject(), ArgumentMatchers.any(Callback::class.java))
Mockito.doAnswer { invocation: InvocationOnMock ->
val callback = invocation.getArgument<Callback>(5)
callback.result = PumpEnactResultImpl(injector).success(true).isPercent(true).percent(invocation.getArgument(0)).duration(invocation.getArgument(1))
callback.result = PumpEnactResultObject(injector).success(true).isPercent(true).percent(invocation.getArgument(0)).duration(invocation.getArgument(1))
callback.run()
null
}.`when`(commandQueue)
.tempBasalPercent(ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyBoolean(), anyObject(), anyObject(), ArgumentMatchers.any(Callback::class.java))
Mockito.doAnswer { invocation: InvocationOnMock ->
val callback = invocation.getArgument<Callback>(5)
callback.result = PumpEnactResultImpl(injector).success(true).isPercent(false).absolute(invocation.getArgument(0)).duration(invocation.getArgument(1))
callback.result = PumpEnactResultObject(injector).success(true).isPercent(false).absolute(invocation.getArgument(0)).duration(invocation.getArgument(1))
callback.run()
null
}.`when`(commandQueue)
.tempBasalAbsolute(ArgumentMatchers.anyDouble(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyBoolean(), anyObject(), anyObject(), ArgumentMatchers.any(Callback::class.java))
Mockito.doAnswer { invocation: InvocationOnMock ->
val callback = invocation.getArgument<Callback>(2)
callback.result = PumpEnactResultImpl(injector).success(true).isPercent(false).absolute(invocation.getArgument(0)).duration(invocation.getArgument(1))
callback.result = PumpEnactResultObject(injector).success(true).isPercent(false).absolute(invocation.getArgument(0)).duration(invocation.getArgument(1))
callback.run()
null
}.`when`(commandQueue).extendedBolus(ArgumentMatchers.anyDouble(), ArgumentMatchers.anyInt(), ArgumentMatchers.any(Callback::class.java))

View file

@ -21,7 +21,7 @@ import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.combo.R;
import info.nightscout.androidaps.data.PumpEnactResultImpl;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.extensions.PumpStateExtensionKt;
import info.nightscout.androidaps.interfaces.CommandQueue;
import info.nightscout.androidaps.interfaces.Constraints;
@ -177,7 +177,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
@Override protected void onStart() {
super.onStart();
OPERATION_NOT_SUPPORTED = new PumpEnactResultImpl(getInjector())
OPERATION_NOT_SUPPORTED = new PumpEnactResultObject(getInjector())
.success(false).enacted(false).comment(R.string.combo_pump_unsupported_operation);
}
@ -264,7 +264,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
getAapsLogger().error("setNewBasalProfile not initialized");
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, getRh().gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
rxBus.send(new EventNewNotification(notification));
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false).comment(R.string.pumpNotInitializedProfileNotSet);
return new PumpEnactResultObject(getInjector()).success(false).enacted(false).comment(R.string.pumpNotInitializedProfileNotSet);
}
BasalProfile requestedBasalProfile = convertProfileToComboProfile(profile);
@ -272,12 +272,12 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
//dismiss previously "FAILED" overview notifications
rxBus.send(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
rxBus.send(new EventDismissNotification(Notification.FAILED_UPDATE_PROFILE));
return new PumpEnactResultImpl(getInjector()).success(true).enacted(false);
return new PumpEnactResultObject(getInjector()).success(true).enacted(false);
}
CommandResult stateResult = runCommand(null, 1, ruffyScripter::readPumpState);
if (stateResult.state.unsafeUsageDetected == PumpState.UNSUPPORTED_BASAL_RATE_PROFILE) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false).comment(R.string.combo_force_disabled_notification);
return new PumpEnactResultObject(getInjector()).success(false).enacted(false).comment(R.string.combo_force_disabled_notification);
}
CommandResult setResult = runCommand(getRh().gs(R.string.combo_activity_setting_basal_profile), 2,
@ -285,7 +285,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
if (!setResult.success) {
Notification notification = new Notification(Notification.FAILED_UPDATE_PROFILE, getRh().gs(R.string.failedupdatebasalprofile), Notification.URGENT);
rxBus.send(new EventNewNotification(notification));
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false).comment(R.string.failedupdatebasalprofile);
return new PumpEnactResultObject(getInjector()).success(false).enacted(false).comment(R.string.failedupdatebasalprofile);
}
pump.basalProfile = requestedBasalProfile;
@ -296,7 +296,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
//issue success notification
Notification notification = new Notification(Notification.PROFILE_SET_OK, getRh().gs(R.string.profile_set_ok), Notification.INFO, 60);
rxBus.send(new EventNewNotification(notification));
return new PumpEnactResultImpl(getInjector()).success(true).enacted(true);
return new PumpEnactResultObject(getInjector()).success(true).enacted(true);
}
@Override
@ -509,16 +509,16 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
// check pump is ready and all pump bolus records are known
CommandResult stateResult = runCommand(null, 2, () -> ruffyScripter.readQuickInfo(1));
if (!stateResult.success) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false)
return new PumpEnactResultObject(getInjector()).success(false).enacted(false)
.comment(R.string.combo_error_no_connection_no_bolus_delivered);
}
if (stateResult.reservoirLevel != -1 && stateResult.reservoirLevel - 0.5 < detailedBolusInfo.insulin) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false)
return new PumpEnactResultObject(getInjector()).success(false).enacted(false)
.comment(R.string.combo_reservoir_level_insufficient_for_bolus);
}
// the commands above ensured a connection was made, which updated this field
if (pumpHistoryChanged) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false)
return new PumpEnactResultObject(getInjector()).success(false).enacted(false)
.comment(R.string.combo_bolus_rejected_due_to_pump_history_change);
}
@ -531,7 +531,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
if (Math.abs(previousBolus.amount - detailedBolusInfo.insulin) < 0.01
&& previousBolus.timestamp + 60 * 1000 > System.currentTimeMillis()) {
getAapsLogger().debug(LTag.PUMP, "Bolus request rejected, same bolus was successfully delivered very recently");
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false)
return new PumpEnactResultObject(getInjector()).success(false).enacted(false)
.comment(R.string.bolus_frequency_exceeded);
}
@ -544,10 +544,10 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
while (previousBolus.timestamp == timeCheckResult.state.pumpTime
&& maxWaitTimeout > System.currentTimeMillis()) {
if (cancelBolus) {
return new PumpEnactResultImpl(getInjector()).success(true).enacted(false);
return new PumpEnactResultObject(getInjector()).success(true).enacted(false);
}
if (!timeCheckResult.success) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false)
return new PumpEnactResultObject(getInjector()).success(false).enacted(false)
.comment(R.string.combo_error_no_connection_no_bolus_delivered);
}
getAapsLogger().debug(LTag.PUMP, "Waiting for pump clock to advance for the next unused bolus record timestamp");
@ -561,7 +561,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
}
if (cancelBolus) {
return new PumpEnactResultImpl(getInjector()).success(true).enacted(false);
return new PumpEnactResultObject(getInjector()).success(true).enacted(false);
}
EventOverviewBolusProgress.Treatment treatment = new EventOverviewBolusProgress.Treatment(0.0, 0, detailedBolusInfo.getBolusType() == DetailedBolusInfo.BolusType.SMB, detailedBolusInfo.getId());
@ -581,7 +581,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
// (reads 2 records to update `recentBoluses` further down)
CommandResult postBolusStateResult = runCommand(null, 3, () -> ruffyScripter.readQuickInfo(2));
if (!postBolusStateResult.success) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false)
return new PumpEnactResultObject(getInjector()).success(false).enacted(false)
.comment(R.string.combo_error_bolus_verification_failed);
}
Bolus lastPumpBolus = postBolusStateResult.history != null && !postBolusStateResult.history.bolusHistory.isEmpty()
@ -591,9 +591,9 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
// no bolus delivered?
if (lastPumpBolus == null || lastPumpBolus.equals(previousBolus)) {
if (cancelBolus) {
return new PumpEnactResultImpl(getInjector()).success(true).enacted(false);
return new PumpEnactResultObject(getInjector()).success(true).enacted(false);
} else {
return new PumpEnactResultImpl(getInjector())
return new PumpEnactResultObject(getInjector())
.success(false)
.enacted(false)
.comment(R.string.combo_error_no_bolus_delivered);
@ -602,7 +602,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
// at least some insulin delivered, so add it to treatments
if (!addBolusToTreatments(detailedBolusInfo, lastPumpBolus))
return new PumpEnactResultImpl(getInjector()).success(false).enacted(true)
return new PumpEnactResultObject(getInjector()).success(false).enacted(true)
.comment(R.string.combo_error_updating_treatment_record);
// check pump bolus record has a sane timestamp
@ -619,16 +619,16 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
// only a partial bolus was delivered
if (Math.abs(lastPumpBolus.amount - detailedBolusInfo.insulin) > 0.01) {
if (cancelBolus) {
return new PumpEnactResultImpl(getInjector()).success(true).enacted(true);
return new PumpEnactResultObject(getInjector()).success(true).enacted(true);
}
return new PumpEnactResultImpl(getInjector()).success(false).enacted(true)
return new PumpEnactResultObject(getInjector()).success(false).enacted(true)
.comment(getRh().gs(R.string.combo_error_partial_bolus_delivered,
lastPumpBolus.amount, detailedBolusInfo.insulin));
}
// full bolus was delivered successfully
incrementBolusCount();
return new PumpEnactResultImpl(getInjector())
return new PumpEnactResultObject(getInjector())
.success(true)
.enacted(lastPumpBolus.amount > 0)
.bolusDelivered(lastPumpBolus.amount)
@ -729,7 +729,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
getAapsLogger().debug(LTag.PUMP, "setTempBasalPercent called with " + percent + "% for " + durationInMinutes + "min");
if (pumpHistoryChanged && percent > 110) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false)
return new PumpEnactResultObject(getInjector()).success(false).enacted(false)
.comment(R.string.combo_high_temp_rejected_due_to_pump_history_changes);
}
@ -755,7 +755,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
CommandResult commandResult = runCommand(getRh().gs(R.string.combo_pump_action_setting_tbr, percent, durationInMinutes),
3, () -> ruffyScripter.setTbr(finalAdjustedPercent, durationInMinutes));
if (!commandResult.success) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false);
return new PumpEnactResultObject(getInjector()).success(false).enacted(false);
}
PumpState state = commandResult.state;
@ -781,7 +781,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
}
incrementTbrCount();
return new PumpEnactResultImpl(getInjector()).success(true).enacted(true).isPercent(true)
return new PumpEnactResultObject(getInjector()).success(true).enacted(true).isPercent(true)
.percent(state.tbrPercent).duration(state.tbrRemainingDuration);
}
@ -805,15 +805,15 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
if (enforceNew) {
CommandResult stateResult = runCommand(getRh().gs(R.string.combo_pump_action_refreshing), 2, ruffyScripter::readPumpState);
if (!stateResult.success) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false);
return new PumpEnactResultObject(getInjector()).success(false).enacted(false);
}
if (!stateResult.state.tbrActive) {
return new PumpEnactResultImpl(getInjector()).success(true).enacted(false);
return new PumpEnactResultObject(getInjector()).success(true).enacted(false);
}
getAapsLogger().debug(LTag.PUMP, "cancelTempBasal: hard-cancelling TBR since force requested");
CommandResult cancelResult = runCommand(getRh().gs(R.string.combo_pump_action_cancelling_tbr), 2, ruffyScripter::cancelTbr);
if (!cancelResult.success) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false);
return new PumpEnactResultObject(getInjector()).success(false).enacted(false);
}
if (!cancelResult.state.tbrActive) {
pumpSync.syncStopTemporaryBasalWithPumpId(
@ -823,19 +823,19 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
PumpType.ACCU_CHEK_COMBO,
serialNumber()
);
return new PumpEnactResultImpl(getInjector()).isTempCancel(true).success(true).enacted(true);
return new PumpEnactResultObject(getInjector()).isTempCancel(true).success(true).enacted(true);
} else {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false);
return new PumpEnactResultObject(getInjector()).success(false).enacted(false);
}
} else if (activeTemp == null) {
return new PumpEnactResultImpl(getInjector()).success(true).enacted(false);
return new PumpEnactResultObject(getInjector()).success(true).enacted(false);
} else if ((activeTemp.getRate() >= 90 && activeTemp.getRate() <= 110)
&& PumpStateExtensionKt.getPlannedRemainingMinutes(activeTemp) <= 15) {
// Let fake neutral temp keep run (see below)
// Note that since this runs on the queue a connection is opened regardless, but this
// case doesn't occur all that often, so it's not worth optimizing (1.3k SetTBR vs 4 cancelTBR).
getAapsLogger().debug(LTag.PUMP, "cancelTempBasal: skipping changing tbr since it already is at " + activeTemp.getRate() + "% and running for another " + PumpStateExtensionKt.getPlannedRemainingMinutes(activeTemp) + " mins.");
return new PumpEnactResultImpl(getInjector()).success(true).enacted(true)
return new PumpEnactResultObject(getInjector()).success(true).enacted(true)
.comment("cancelTempBasal skipping changing tbr since it already is at "
+ activeTemp.getRate() + "% and running for another "
+ PumpStateExtensionKt.getPlannedRemainingMinutes(activeTemp) + " mins.");
@ -1361,7 +1361,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
@NonNull @Override
public PumpEnactResult loadTDDs() {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
result.success(readHistory(new PumpHistoryRequest().tddHistory(PumpHistoryRequest.FULL)));
if (result.getSuccess()) {
List<Tdd> tdds = pump.tddHistory;

View file

@ -4,7 +4,7 @@ import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.combo.R
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.pump.combo.ruffyscripter.RuffyScripter
@ -34,7 +34,7 @@ class ComboPluginTest : TestBase() {
private val injector = HasAndroidInjector {
AndroidInjector {
if (it is PumpEnactResultImpl) {
if (it is PumpEnactResultObject) {
it.rh = rh
}
}

View file

@ -10,7 +10,7 @@ import info.nightscout.androidaps.dana.DanaPump
import info.nightscout.androidaps.danaRKorean.services.DanaRKoreanExecutionService
import info.nightscout.androidaps.danar.AbstractDanaRPlugin
import info.nightscout.androidaps.danar.R
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
@ -134,7 +134,7 @@ class DanaRKoreanPlugin @Inject constructor(
detailedBolusInfo.insulin, detailedBolusInfo.carbs.toInt(), detailedBolusInfo.carbsTimestamp
?: detailedBolusInfo.timestamp, t
)
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.success(connectionOK && abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.bolusStep)
.bolusDelivered(t.insulin)
if (!result.success) result.comment(rh.gs(R.string.boluserrorcode, detailedBolusInfo.insulin, t.insulin, danaPump.bolusStartErrorCode)) else result.comment(R.string.ok)
@ -151,7 +151,7 @@ class DanaRKoreanPlugin @Inject constructor(
)
result
} else {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.success(false).bolusDelivered(0.0).carbsDelivered(0.0).comment(R.string.invalidinput)
aapsLogger.error("deliverTreatment: Invalid input")
result
@ -191,7 +191,7 @@ class DanaRKoreanPlugin @Inject constructor(
return cancelRealTempBasal()
}
aapsLogger.debug(LTag.PUMP, "setTempBasalAbsolute: doTempOff OK")
return PumpEnactResultImpl(injector).success(true).enacted(false).percent(100).isPercent(true).isTempCancel(true)
return PumpEnactResultObject(injector).success(true).enacted(false).percent(100).isPercent(true).isTempCancel(true)
}
if (doLowTemp || doHighTemp) {
// If extended in progress
@ -212,7 +212,7 @@ class DanaRKoreanPlugin @Inject constructor(
cancelTempBasal(true)
} else {
aapsLogger.debug(LTag.PUMP, "setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)")
return PumpEnactResultImpl(injector).success(true).percent(percentRate).enacted(false).duration(danaPump.tempBasalRemainingMin).isPercent(true).isTempCancel(false)
return PumpEnactResultObject(injector).success(true).percent(percentRate).enacted(false).duration(danaPump.tempBasalRemainingMin).isPercent(true).isTempCancel(false)
}
}
}
@ -251,7 +251,7 @@ class DanaRKoreanPlugin @Inject constructor(
if (danaPump.isExtendedInProgress && abs(danaPump.extendedBolusAbsoluteRate - extendedRateToSet) < pumpDescription.extendedBolusStep) {
// correct extended already set
aapsLogger.debug(LTag.PUMP, "setTempBasalAbsolute: Correct extended already set")
return PumpEnactResultImpl(injector).success(true).absolute(danaPump.extendedBolusAbsoluteRate).enacted(false).duration(danaPump.extendedBolusRemainingMinutes).isPercent(false)
return PumpEnactResultObject(injector).success(true).absolute(danaPump.extendedBolusAbsoluteRate).enacted(false).duration(danaPump.extendedBolusRemainingMinutes).isPercent(false)
.isTempCancel(false)
}
@ -269,7 +269,7 @@ class DanaRKoreanPlugin @Inject constructor(
}
// We should never end here
aapsLogger.error("setTempBasalAbsolute: Internal error")
return PumpEnactResultImpl(injector).success(false).comment("Internal error")
return PumpEnactResultObject(injector).success(false).comment("Internal error")
}
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult {
@ -277,7 +277,7 @@ class DanaRKoreanPlugin @Inject constructor(
if (danaPump.isExtendedInProgress && useExtendedBoluses) {
return cancelExtendedBolus()
}
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.success(true).enacted(false).comment(R.string.ok).isTempCancel(true)
return result
}
@ -285,7 +285,7 @@ class DanaRKoreanPlugin @Inject constructor(
override fun model(): PumpType = PumpType.DANA_R_KOREAN
private fun cancelRealTempBasal(): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
if (danaPump.isTempBasalInProgress) {
sExecutionService.tempBasalStop()
if (!danaPump.isTempBasalInProgress) {
@ -304,6 +304,6 @@ class DanaRKoreanPlugin @Inject constructor(
return result
}
override fun loadEvents(): PumpEnactResult = PumpEnactResultImpl(injector) // no history, not needed
override fun setUserOptions(): PumpEnactResult = PumpEnactResultImpl(injector)
override fun loadEvents(): PumpEnactResult = PumpEnactResultObject(injector) // no history, not needed
override fun setUserOptions(): PumpEnactResult = PumpEnactResultObject(injector)
}

View file

@ -16,7 +16,7 @@ import info.nightscout.androidaps.dana.DanaPump;
import info.nightscout.androidaps.danaRv2.services.DanaRv2ExecutionService;
import info.nightscout.androidaps.danar.AbstractDanaRPlugin;
import info.nightscout.androidaps.danar.R;
import info.nightscout.androidaps.data.PumpEnactResultImpl;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.interfaces.CommandQueue;
import info.nightscout.androidaps.interfaces.Constraints;
@ -190,7 +190,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
boolean connectionOK = false;
if (detailedBolusInfo.insulin > 0 || carbs > 0)
connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) carbs, carbTimeStamp, t);
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
result.success(connectionOK && Math.abs(detailedBolusInfo.insulin - t.getInsulin()) < pumpDescription.getBolusStep())
.bolusDelivered(t.getInsulin())
.carbsDelivered(detailedBolusInfo.carbs);
@ -203,7 +203,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
// remove carbs because it's get from history separately
return result;
} else {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
result.success(false).bolusDelivered(0d).carbsDelivered(0d).comment(R.string.invalidinput);
aapsLogger.error("deliverTreatment: Invalid input");
return result;
@ -223,7 +223,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
@NonNull @Override
public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, @NonNull Profile profile, boolean enforceNew, @NonNull PumpSync.TemporaryBasalType tbrType) {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
absoluteRate = constraintChecker.applyBasalConstraints(new Constraint<>(absoluteRate), profile).value();
@ -290,7 +290,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
@NonNull @Override
public PumpEnactResult setTempBasalPercent(int percent, int durationInMinutes, @NonNull Profile profile, boolean enforceNew, @NonNull PumpSync.TemporaryBasalType tbrType) {
DanaPump pump = danaPump;
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
percent = constraintChecker.applyBasalPercentConstraints(new Constraint<>(percent), profile).value();
if (percent < 0) {
result.isTempCancel(false).enacted(false).success(false).comment(R.string.invalidinput);
@ -324,7 +324,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
private PumpEnactResult setHighTempBasalPercent(Integer percent, int durationInMinutes) {
DanaPump pump = danaPump;
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
boolean connectionOK = sExecutionService.highTempBasal(percent, durationInMinutes);
if (connectionOK && pump.isTempBasalInProgress() && pump.getTempBasalPercent() == percent) {
result.enacted(true).success(true).comment(R.string.ok).isTempCancel(false).duration(pump.getTempBasalRemainingMin()).percent(pump.getTempBasalPercent()).isPercent(true);
@ -338,7 +338,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
@NonNull @Override
public PumpEnactResult cancelTempBasal(boolean force) {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
if (danaPump.isTempBasalInProgress()) {
sExecutionService.tempBasalStop();
result.enacted(true).isTempCancel(true);
@ -357,7 +357,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
insulin = Round.INSTANCE.roundTo(insulin, getPumpDescription().getExtendedBolusStep());
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
if (danaPump.isExtendedInProgress() && Math.abs(danaPump.getExtendedBolusAmount() - insulin) < pumpDescription.getExtendedBolusStep()) {
result.enacted(false)
.success(true)
@ -390,7 +390,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
@NonNull @Override
public PumpEnactResult cancelExtendedBolus() {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
if (danaPump.isExtendedInProgress()) {
sExecutionService.extendedBolusStop();
result.enacted(true).success(!danaPump.isExtendedInProgress()).isTempCancel(true);

View file

@ -48,7 +48,7 @@ import info.nightscout.androidaps.danar.comm.MsgStatusBasic;
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
import info.nightscout.androidaps.data.PumpEnactResultImpl;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.dialogs.BolusProgressDialog;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.ActivePlugin;
@ -430,14 +430,14 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public PumpEnactResult loadEvents() {
if (!danaRv2Plugin.isInitialized()) {
PumpEnactResult result = new PumpEnactResultImpl(injector).success(false);
PumpEnactResult result = new PumpEnactResultObject(injector).success(false);
result.comment("pump not initialized");
return result;
}
if (!isConnected())
return new PumpEnactResultImpl(injector).success(false);
return new PumpEnactResultObject(injector).success(false);
SystemClock.sleep(300);
MsgHistoryEventsV2 msg = new MsgHistoryEventsV2(injector, danaPump.lastHistoryFetched);
aapsLogger.debug(LTag.PUMP, "Loading event history from: " + dateUtil.dateAndTimeString(danaPump.lastHistoryFetched));
@ -452,7 +452,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
else
danaPump.lastHistoryFetched = 0;
danaPump.setLastConnection(System.currentTimeMillis());
return new PumpEnactResultImpl(injector).success(true);
return new PumpEnactResultObject(injector).success(true);
}
public boolean updateBasalsInPump(final Profile profile) {
@ -471,12 +471,12 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public PumpEnactResult setUserOptions() {
if (!isConnected())
return new PumpEnactResultImpl(injector).success(false);
return new PumpEnactResultObject(injector).success(false);
SystemClock.sleep(300);
MsgSetUserOptions msg = new MsgSetUserOptions(injector);
mSerialIOThread.sendMessage(msg);
SystemClock.sleep(200);
return new PumpEnactResultImpl(injector).success(!msg.getFailed());
return new PumpEnactResultObject(injector).success(!msg.getFailed());
}
}

View file

@ -10,7 +10,7 @@ import info.nightscout.androidaps.dana.DanaFragment;
import info.nightscout.androidaps.dana.DanaPump;
import info.nightscout.androidaps.dana.comm.RecordTypes;
import info.nightscout.androidaps.danar.services.AbstractDanaRExecutionService;
import info.nightscout.androidaps.data.PumpEnactResultImpl;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.extensions.PumpStateExtensionKt;
import info.nightscout.androidaps.interfaces.ActivePlugin;
@ -136,7 +136,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
// Pump interface
@NonNull @Override
public PumpEnactResult setNewBasalProfile(@NonNull Profile profile) {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
if (sExecutionService == null) {
getAapsLogger().error("setNewBasalProfile sExecutionService is null");
@ -216,7 +216,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
@NonNull @Override
public PumpEnactResult setTempBasalPercent(int percent, int durationInMinutes, @NonNull Profile profile, boolean enforceNew, @NonNull PumpSync.TemporaryBasalType tbrType) {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
percent = constraintChecker.applyBasalPercentConstraints(new Constraint<>(percent), profile).value();
if (percent < 0) {
result.isTempCancel(false).enacted(false).success(false).comment(R.string.invalidinput);
@ -269,7 +269,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
insulin = Round.INSTANCE.roundTo(insulin, getPumpDescription().getExtendedBolusStep());
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
if (danaPump.isExtendedInProgress() && Math.abs(danaPump.getExtendedBolusAmount() - insulin) < getPumpDescription().getExtendedBolusStep()) {
result.enacted(false)
.success(true)
@ -320,7 +320,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
@NonNull @Override
public PumpEnactResult cancelExtendedBolus() {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
if (danaPump.isExtendedInProgress()) {
sExecutionService.extendedBolusStop();
if (!danaPump.isExtendedInProgress()) {

View file

@ -14,7 +14,7 @@ import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.dana.DanaPump;
import info.nightscout.androidaps.danar.services.DanaRExecutionService;
import info.nightscout.androidaps.data.PumpEnactResultImpl;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.interfaces.CommandQueue;
@ -165,7 +165,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
boolean connectionOK = false;
if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0)
connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, detailedBolusInfo.getCarbsTimestamp() != null ? detailedBolusInfo.getCarbsTimestamp() : detailedBolusInfo.timestamp, t);
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
result.success(connectionOK && Math.abs(detailedBolusInfo.insulin - t.getInsulin()) < pumpDescription.getBolusStep())
.bolusDelivered(t.getInsulin())
.carbsDelivered(detailedBolusInfo.carbs);
@ -193,7 +193,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
serialNumber());
return result;
} else {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
result.success(false).bolusDelivered(0d).carbsDelivered(0d).comment(R.string.invalidinput);
aapsLogger.error("deliverTreatment: Invalid input");
return result;
@ -205,7 +205,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, @NonNull Profile profile, boolean enforceNew, @NonNull PumpSync.TemporaryBasalType tbrType) {
// Recheck pump status if older than 30 min
//This should not be needed while using queue because connection should be done before calling this
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
absoluteRate = constraints.applyBasalConstraints(new Constraint<>(absoluteRate), profile).value();
@ -327,7 +327,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
if (danaPump.isExtendedInProgress() && useExtendedBoluses) {
return cancelExtendedBolus();
}
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
result.success(true).enacted(false).comment(R.string.ok).isTempCancel(true);
return result;
}
@ -338,7 +338,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
}
private PumpEnactResult cancelRealTempBasal() {
PumpEnactResult result = new PumpEnactResultImpl(getInjector());
PumpEnactResult result = new PumpEnactResultObject(getInjector());
if (danaPump.isTempBasalInProgress()) {
sExecutionService.tempBasalStop();
if (!danaPump.isTempBasalInProgress()) {
@ -360,7 +360,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
@NonNull @Override
public PumpEnactResult loadEvents() {
return new PumpEnactResultImpl(getInjector()); // no history, not needed
return new PumpEnactResultObject(getInjector()); // no history, not needed
}
@NonNull @Override

View file

@ -39,7 +39,7 @@ import info.nightscout.androidaps.danar.comm.MsgHistoryRefill;
import info.nightscout.androidaps.danar.comm.MsgHistorySuspend;
import info.nightscout.androidaps.danar.comm.MsgPCCommStart;
import info.nightscout.androidaps.danar.comm.MsgPCCommStop;
import info.nightscout.androidaps.data.PumpEnactResultImpl;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
@ -242,7 +242,7 @@ public abstract class AbstractDanaRExecutionService extends DaggerService {
}
public PumpEnactResult loadHistory(byte type) {
PumpEnactResult result = new PumpEnactResultImpl(injector);
PumpEnactResult result = new PumpEnactResultObject(injector);
if (!isConnected()) return result;
MessageBase msg = null;
switch (type) {

View file

@ -43,7 +43,7 @@ import info.nightscout.androidaps.danar.comm.MsgStatus;
import info.nightscout.androidaps.danar.comm.MsgStatusBasic;
import info.nightscout.androidaps.danar.comm.MsgStatusBolusExtended;
import info.nightscout.androidaps.danar.comm.MsgStatusTempBasal;
import info.nightscout.androidaps.data.PumpEnactResultImpl;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.dialogs.BolusProgressDialog;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.interfaces.CommandQueue;
@ -397,11 +397,11 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService {
public PumpEnactResult setUserOptions() {
if (!isConnected())
return new PumpEnactResultImpl(injector).success(false);
return new PumpEnactResultObject(injector).success(false);
SystemClock.sleep(300);
MsgSetUserOptions msg = new MsgSetUserOptions(injector);
mSerialIOThread.sendMessage(msg);
SystemClock.sleep(200);
return new PumpEnactResultImpl(injector).success(!msg.getFailed());
return new PumpEnactResultObject(injector).success(!msg.getFailed());
}
}

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.Pump
@ -44,26 +44,26 @@ class TestPumpPlugin(val injector: HasAndroidInjector) : Pump {
override fun waitForDisconnectionInSeconds(): Int = 0
override fun getPumpStatus(reason: String) {}
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultImpl(injector)
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultObject(injector)
override fun isThisProfileSet(profile: Profile): Boolean = isProfileSet
override fun lastDataTime(): Long = lastData
override val baseBasalRate: Double = baseBasal
override val reservoirLevel: Double = 0.0
override val batteryLevel: Int = 0
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun stopBolusDelivering() {}
override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject = JSONObject()
override fun manufacturer(): ManufacturerType = ManufacturerType.AAPS
override fun model(): PumpType = PumpType.GENERIC_AAPS
override fun serialNumber(): String = "1"
override fun shortStatus(veryShort: Boolean): String = ""
override val isFakingTempsByExtendedBoluses: Boolean = false
override fun loadTDDs(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun loadTDDs(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun canHandleDST(): Boolean = true
override fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
}

View file

@ -13,7 +13,7 @@ import info.nightscout.androidaps.dana.DanaPump
import info.nightscout.androidaps.dana.comm.RecordTypes
import info.nightscout.androidaps.danars.events.EventDanaRSDeviceChange
import info.nightscout.androidaps.danars.services.DanaRSService
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
import info.nightscout.androidaps.interfaces.CommandQueue
@ -186,15 +186,15 @@ class DanaRSPlugin @Inject constructor(
// DanaR interface
override fun loadHistory(type: Byte): PumpEnactResult {
return danaRSService?.loadHistory(type) ?: PumpEnactResultImpl(injector).success(false)
return danaRSService?.loadHistory(type) ?: PumpEnactResultObject(injector).success(false)
}
override fun loadEvents(): PumpEnactResult {
return danaRSService?.loadEvents() ?: PumpEnactResultImpl(injector).success(false)
return danaRSService?.loadEvents() ?: PumpEnactResultObject(injector).success(false)
}
override fun setUserOptions(): PumpEnactResult {
return danaRSService?.setUserSettings() ?: PumpEnactResultImpl(injector).success(false)
return danaRSService?.setUserSettings() ?: PumpEnactResultObject(injector).success(false)
}
// Constraints interface
@ -229,7 +229,7 @@ class DanaRSPlugin @Inject constructor(
danaRSService?.isConnected ?: false || danaRSService?.isConnecting ?: false
override fun setNewBasalProfile(profile: Profile): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
if (!isInitialized()) {
aapsLogger.error("setNewBasalProfile not initialized")
val notification = Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, rh.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT)
@ -305,7 +305,7 @@ class DanaRSPlugin @Inject constructor(
var connectionOK = false
if (detailedBolusInfo.insulin > 0 || carbs > 0) connectionOK = danaRSService?.bolus(detailedBolusInfo.insulin, carbs.toInt(), carbTimeStamp, t)
?: false
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.success = connectionOK && abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.bolusStep
result.bolusDelivered = t.insulin
result.carbsDelivered = detailedBolusInfo.carbs
@ -322,7 +322,7 @@ class DanaRSPlugin @Inject constructor(
aapsLogger.debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered)
result
} else {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.success = false
result.bolusDelivered = 0.0
result.carbsDelivered = 0.0
@ -364,7 +364,7 @@ class DanaRSPlugin @Inject constructor(
return cancelTempBasal(false)
}
aapsLogger.debug(LTag.PUMP, "setTempBasalAbsolute: doTempOff OK")
return PumpEnactResultImpl(injector)
return PumpEnactResultObject(injector)
.success(true)
.enacted(false)
.percent(100)
@ -379,7 +379,7 @@ class DanaRSPlugin @Inject constructor(
if (danaPump.tempBasalPercent == percentRate && danaPump.tempBasalRemainingMin > 4) {
if (!enforceNew) {
aapsLogger.debug(LTag.PUMP, "setTempBasalAbsolute: Correct temp basal already set (doLowTemp || doHighTemp)")
return PumpEnactResultImpl(injector)
return PumpEnactResultObject(injector)
.success(true)
.percent(percentRate)
.enacted(false)
@ -407,14 +407,14 @@ class DanaRSPlugin @Inject constructor(
}
// We should never end here
aapsLogger.error("setTempBasalAbsolute: Internal error")
return PumpEnactResultImpl(injector)
return PumpEnactResultObject(injector)
.success(false)
.comment("Internal error")
}
@Synchronized
override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
var percentAfterConstraint = constraintChecker.applyBasalPercentConstraints(Constraint(percent), profile).value()
if (percentAfterConstraint < 0) {
result.isTempCancel = false
@ -463,7 +463,7 @@ class DanaRSPlugin @Inject constructor(
}
@Synchronized private fun setHighTempBasalPercent(percent: Int): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
val connectionOK = danaRSService?.highTempBasal(percent) ?: false
if (connectionOK && danaPump.isTempBasalInProgress && danaPump.tempBasalPercent == percent) {
result.enacted = true
@ -489,7 +489,7 @@ class DanaRSPlugin @Inject constructor(
// needs to be rounded
val durationInHalfHours = max(durationInMinutes / 30, 1)
insulinAfterConstraint = Round.roundTo(insulinAfterConstraint, pumpDescription.extendedBolusStep)
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
if (danaPump.isExtendedInProgress && abs(danaPump.extendedBolusAmount - insulinAfterConstraint) < pumpDescription.extendedBolusStep) {
result.enacted = false
result.success = true
@ -524,7 +524,7 @@ class DanaRSPlugin @Inject constructor(
@Synchronized
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
if (danaPump.isTempBasalInProgress) {
danaRSService?.tempBasalStop()
result.success = !danaPump.isTempBasalInProgress
@ -541,7 +541,7 @@ class DanaRSPlugin @Inject constructor(
}
@Synchronized override fun cancelExtendedBolus(): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
if (danaPump.isExtendedInProgress) {
danaRSService?.extendedBolusStop()
result.success = !danaPump.isExtendedInProgress

View file

@ -54,7 +54,7 @@ import info.nightscout.androidaps.danars.comm.DanaRSPacketOptionGetUserOption
import info.nightscout.androidaps.danars.comm.DanaRSPacketOptionSetPumpTime
import info.nightscout.androidaps.danars.comm.DanaRSPacketOptionSetPumpUTCAndTimeZone
import info.nightscout.androidaps.danars.comm.DanaRSPacketOptionSetUserOption
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.dialogs.BolusProgressDialog
import info.nightscout.androidaps.events.EventPumpStatusChanged
import info.nightscout.androidaps.interfaces.ActivePlugin
@ -261,7 +261,7 @@ class DanaRSService : DaggerService() {
fun loadEvents(): PumpEnactResult {
if (!danaRSPlugin.isInitialized()) {
val result = PumpEnactResultImpl(injector).success(false)
val result = PumpEnactResultObject(injector).success(false)
result.comment = "pump not initialized"
return result
}
@ -283,13 +283,13 @@ class DanaRSService : DaggerService() {
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.gettingpumpstatus)))
sendMessage(DanaRSPacketGeneralInitialScreenInformation(injector))
danaPump.lastConnection = System.currentTimeMillis()
return PumpEnactResultImpl(injector).success(msg.success())
return PumpEnactResultObject(injector).success(msg.success())
}
fun setUserSettings(): PumpEnactResult {
val message = DanaRSPacketOptionSetUserOption(injector)
sendMessage(message)
return PumpEnactResultImpl(injector).success(message.success())
return PumpEnactResultObject(injector).success(message.success())
}
fun bolus(insulin: Double, carbs: Int, carbTime: Long, t: EventOverviewBolusProgress.Treatment): Boolean {
@ -499,7 +499,7 @@ class DanaRSService : DaggerService() {
}
fun loadHistory(type: Byte): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
if (!isConnected) return result
var msg: DanaRSPacketHistory? = null
when (type) {

View file

@ -9,7 +9,7 @@ import android.text.format.DateFormat
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8DeviceChange
import info.nightscout.androidaps.diaconn.service.DiaconnG8Service
import info.nightscout.androidaps.extensions.convertedToAbsolute
@ -174,11 +174,11 @@ class DiaconnG8Plugin @Inject constructor(
// Diaconn Pump Interface
override fun loadHistory(): PumpEnactResult {
return diaconnG8Service?.loadHistory() ?: PumpEnactResultImpl(injector).success(false)
return diaconnG8Service?.loadHistory() ?: PumpEnactResultObject(injector).success(false)
}
override fun setUserOptions(): PumpEnactResult {
return diaconnG8Service?.setUserSettings() ?: PumpEnactResultImpl(injector).success(false)
return diaconnG8Service?.setUserSettings() ?: PumpEnactResultObject(injector).success(false)
}
// Constraints interface
@ -213,7 +213,7 @@ class DiaconnG8Plugin @Inject constructor(
diaconnG8Service?.isConnected ?: false || diaconnG8Service?.isConnecting ?: false
override fun setNewBasalProfile(profile: Profile): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
if (!isInitialized()) {
val notification = Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, rh.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT)
rxBus.send(EventNewNotification(notification))
@ -277,7 +277,7 @@ class DiaconnG8Plugin @Inject constructor(
var connectionOK = false
if (detailedBolusInfo.insulin > 0 || carbs > 0) connectionOK = diaconnG8Service?.bolus(detailedBolusInfo.insulin, carbs.toInt(), carbTimeStamp, t)
?: false
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.success = connectionOK
result.bolusDelivered = t.insulin
result.carbsDelivered = detailedBolusInfo.carbs
@ -289,7 +289,7 @@ class DiaconnG8Plugin @Inject constructor(
aapsLogger.debug(LTag.PUMP, "deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered)
result
} else {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.success = false
result.bolusDelivered = 0.0
result.carbsDelivered = 0.0
@ -306,7 +306,7 @@ class DiaconnG8Plugin @Inject constructor(
// This is called from APS
@Synchronized
override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
val absoluteAfterConstrain = constraintChecker.applyBasalConstraints(Constraint(absoluteRate), profile).value()
val doTempOff = baseBasalRate - absoluteAfterConstrain == 0.0
val doLowTemp = absoluteAfterConstrain < baseBasalRate
@ -397,7 +397,7 @@ class DiaconnG8Plugin @Inject constructor(
var insulinAfterConstraint = constraintChecker.applyExtendedBolusConstraints(Constraint(insulin)).value()
// needs to be rounded
insulinAfterConstraint = Round.roundTo(insulinAfterConstraint, pumpDescription.extendedBolusStep)
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
if (diaconnG8Pump.isExtendedInProgress && abs(diaconnG8Pump.extendedBolusAmount - insulinAfterConstraint) < pumpDescription.extendedBolusStep) {
result.enacted = false
@ -435,7 +435,7 @@ class DiaconnG8Plugin @Inject constructor(
@Synchronized
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
if (diaconnG8Pump.isTempBasalInProgress) {
diaconnG8Service?.tempBasalStop()
result.success = !diaconnG8Pump.isTempBasalInProgress
@ -453,7 +453,7 @@ class DiaconnG8Plugin @Inject constructor(
}
@Synchronized override fun cancelExtendedBolus(): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
if (diaconnG8Pump.isExtendedInProgress) {
diaconnG8Service?.extendedBolusStop()
result.success = !diaconnG8Pump.isExtendedInProgress

View file

@ -8,7 +8,7 @@ import android.os.IBinder
import android.os.SystemClock
import dagger.android.DaggerService
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.diaconn.DiaconnG8Plugin
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
import info.nightscout.androidaps.diaconn.R
@ -269,7 +269,7 @@ class DiaconnG8Service : DaggerService() {
fun loadHistory(): PumpEnactResult {
if (!diaconnG8Plugin.isInitialized()) {
val result = PumpEnactResultImpl(injector).success(false)
val result = PumpEnactResultObject(injector).success(false)
result.comment = "pump not initialized"
return result
}
@ -279,7 +279,7 @@ class DiaconnG8Service : DaggerService() {
sendMessage(IncarnationInquirePacket(injector))
}
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
var apsLastLogNum = 9999
var apsWrappingCount = -1
// get saved last loginfo
@ -421,7 +421,7 @@ class DiaconnG8Service : DaggerService() {
}
fun setUserSettings(): PumpEnactResult {
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
val msg: DiaconnG8Packet = when (diaconnG8Pump.setUserOptionType) {
DiaconnG8Pump.ALARM -> SoundSettingPacket(injector, diaconnG8Pump.beepAndAlarm, diaconnG8Pump.alarmIntesity)

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.eopatch
import android.os.SystemClock
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.interfaces.PumpPluginBase
@ -177,7 +177,7 @@ class EopatchPumpPlugin @Inject constructor(
mLastDataTime = System.currentTimeMillis()
if (patchManager.isActivated) {
if (patchManager.patchState.isTempBasalActive || patchManager.patchState.isBolusActive) {
return PumpEnactResultImpl(injector)
return PumpEnactResultObject(injector)
} else {
var isSuccess: Boolean? = null
val result: BehaviorSubject<Boolean> = BehaviorSubject.create()
@ -205,16 +205,16 @@ class EopatchPumpPlugin @Inject constructor(
aapsLogger.info(LTag.PUMP, "Basal Profile was set: ${isSuccess ?: false}")
if (isSuccess == true) {
rxBus.send(EventNewNotification(Notification(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60)))
return PumpEnactResultImpl(injector).success(true).enacted(true)
return PumpEnactResultObject(injector).success(true).enacted(true)
} else {
return PumpEnactResultImpl(injector)
return PumpEnactResultObject(injector)
}
}
} else {
preferenceManager.getNormalBasalManager().setNormalBasal(profile)
preferenceManager.flushNormalBasalManager()
rxBus.send(EventNewNotification(Notification(Notification.PROFILE_SET_OK, rh.gs(R.string.profile_set_ok), Notification.INFO, 60)))
return PumpEnactResultImpl(injector).success(true).enacted(true)
return PumpEnactResultObject(injector).success(true).enacted(true)
}
}
@ -264,7 +264,7 @@ class EopatchPumpPlugin @Inject constructor(
if (detailedBolusInfo.insulin == 0.0 && detailedBolusInfo.carbs == 0.0) {
// neither carbs nor bolus requested
aapsLogger.error("deliverTreatment: Invalid input: neither carbs nor insulin are set in treatment")
return PumpEnactResultImpl(injector).success(false).enacted(false).bolusDelivered(0.0).carbsDelivered(0.0)
return PumpEnactResultObject(injector).success(false).enacted(false).bolusDelivered(0.0).carbsDelivered(0.0)
.comment(rh.gs(R.string.invalidinput))
} else if (detailedBolusInfo.insulin > 0.0) {
var isSuccess = true
@ -311,15 +311,15 @@ class EopatchPumpPlugin @Inject constructor(
disposable.dispose()
return if (isSuccess)
PumpEnactResultImpl(injector).success(true)/*.enacted(true)*/.carbsDelivered(detailedBolusInfo.carbs).bolusDelivered(detailedBolusInfo.insulin)
PumpEnactResultObject(injector).success(true)/*.enacted(true)*/.carbsDelivered(detailedBolusInfo.carbs).bolusDelivered(detailedBolusInfo.insulin)
else
PumpEnactResultImpl(injector).success(false)/*.enacted(false)*/.carbsDelivered(0.0).bolusDelivered(detailedBolusInfo.insulin)
PumpEnactResultObject(injector).success(false)/*.enacted(false)*/.carbsDelivered(0.0).bolusDelivered(detailedBolusInfo.insulin)
} else {
// no bolus required, carb only treatment
patchManager.addBolusToHistory(detailedBolusInfo)
return PumpEnactResultImpl(injector).success(true).enacted(true).bolusDelivered(0.0)
return PumpEnactResultObject(injector).success(true).enacted(true).bolusDelivered(0.0)
.carbsDelivered(detailedBolusInfo.carbs).comment(rh.gs(info.nightscout.core.main.R.string.ok))
}
}
@ -357,15 +357,15 @@ class EopatchPumpPlugin @Inject constructor(
)
aapsLogger.info(LTag.PUMP, "setTempBasalAbsolute - tbrCurrent:${readTBR()}")
}
.map { PumpEnactResultImpl(injector).success(true).enacted(true).duration(durationInMinutes).absolute(absoluteRate).isPercent(false).isTempCancel(false) }
.map { PumpEnactResultObject(injector).success(true).enacted(true).duration(durationInMinutes).absolute(absoluteRate).isPercent(false).isTempCancel(false) }
.onErrorReturnItem(
PumpEnactResultImpl(injector).success(false).enacted(false)
PumpEnactResultObject(injector).success(false).enacted(false)
.comment("Internal error")
)
.blockingGet()
} else {
aapsLogger.info(LTag.PUMP, "setTempBasalAbsolute - normal basal is not active")
return PumpEnactResultImpl(injector).success(false).enacted(false)
return PumpEnactResultObject(injector).success(false).enacted(false)
}
}
@ -390,15 +390,15 @@ class EopatchPumpPlugin @Inject constructor(
)
aapsLogger.info(LTag.PUMP, "setTempBasalPercent - tbrCurrent:${readTBR()}")
}
.map { PumpEnactResultImpl(injector).success(true).enacted(true).duration(durationInMinutes).percent(percent).isPercent(true).isTempCancel(false) }
.map { PumpEnactResultObject(injector).success(true).enacted(true).duration(durationInMinutes).percent(percent).isPercent(true).isTempCancel(false) }
.onErrorReturnItem(
PumpEnactResultImpl(injector).success(false).enacted(false)
PumpEnactResultObject(injector).success(false).enacted(false)
.comment("Internal error")
)
.blockingGet()
} else {
aapsLogger.info(LTag.PUMP, "setTempBasalPercent - normal basal is not active")
return PumpEnactResultImpl(injector).success(false).enacted(false)
return PumpEnactResultObject(injector).success(false).enacted(false)
}
}
@ -418,9 +418,9 @@ class EopatchPumpPlugin @Inject constructor(
pumpSerial = serialNumber()
)
}
.map { PumpEnactResultImpl(injector).success(true).enacted(true) }
.map { PumpEnactResultObject(injector).success(true).enacted(true) }
.onErrorReturnItem(
PumpEnactResultImpl(injector).success(false).enacted(false).bolusDelivered(0.0)
PumpEnactResultObject(injector).success(false).enacted(false).bolusDelivered(0.0)
.comment(rh.gs(info.nightscout.core.main.R.string.error))
)
.blockingGet()
@ -431,14 +431,14 @@ class EopatchPumpPlugin @Inject constructor(
if (tbrCurrent == null) {
aapsLogger.debug(LTag.PUMP, "cancelTempBasal - TBR already false.")
return PumpEnactResultImpl(injector).success(true).enacted(false)
return PumpEnactResultObject(injector).success(true).enacted(false)
}
if (!patchManager.patchState.isTempBasalActive) {
return if (pumpSync.expectedPumpState().temporaryBasal != null) {
PumpEnactResultImpl(injector).success(true).enacted(true).isTempCancel(true)
PumpEnactResultObject(injector).success(true).enacted(true).isTempCancel(true)
} else
PumpEnactResultImpl(injector).success(true).isTempCancel(true)
PumpEnactResultObject(injector).success(true).isTempCancel(true)
}
return patchManager.stopTempBasal()
@ -455,9 +455,9 @@ class EopatchPumpPlugin @Inject constructor(
.doOnError {
aapsLogger.error(LTag.PUMP, "cancelTempBasal() - $it")
}
.map { PumpEnactResultImpl(injector).success(true).enacted(true).isTempCancel(true) }
.map { PumpEnactResultObject(injector).success(true).enacted(true).isTempCancel(true) }
.onErrorReturnItem(
PumpEnactResultImpl(injector).success(false).enacted(false)
PumpEnactResultObject(injector).success(false).enacted(false)
.comment(rh.gs(info.nightscout.core.main.R.string.error))
)
.blockingGet()
@ -476,9 +476,9 @@ class EopatchPumpPlugin @Inject constructor(
pumpSerial = serialNumber()
)
}
.map { PumpEnactResultImpl(injector).success(true).enacted(true).isTempCancel(true) }
.map { PumpEnactResultObject(injector).success(true).enacted(true).isTempCancel(true) }
.onErrorReturnItem(
PumpEnactResultImpl(injector).success(false).enacted(false)
PumpEnactResultObject(injector).success(false).enacted(false)
.comment(rh.gs(info.nightscout.core.main.R.string.error))
)
.blockingGet()
@ -491,9 +491,9 @@ class EopatchPumpPlugin @Inject constructor(
pumpType = PumpType.EOFLOW_EOPATCH2,
pumpSerial = serialNumber()
)
PumpEnactResultImpl(injector).success(true).enacted(true).isTempCancel(true)
PumpEnactResultObject(injector).success(true).enacted(true).isTempCancel(true)
} else
PumpEnactResultImpl(injector)
PumpEnactResultObject(injector)
}
}
@ -546,7 +546,7 @@ class EopatchPumpPlugin @Inject constructor(
override val isFakingTempsByExtendedBoluses: Boolean = false
override fun loadTDDs(): PumpEnactResult {
return PumpEnactResultImpl(injector)
return PumpEnactResultObject(injector)
}
override fun canHandleDST(): Boolean {

View file

@ -7,7 +7,7 @@ import android.os.IBinder
import android.os.SystemClock
import androidx.preference.Preference
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
@ -592,7 +592,7 @@ class MedtronicPumpPlugin @Inject constructor(
aapsLogger.info(LTag.PUMP, "MedtronicPumpPlugin::deliverBolus - " + BolusDeliveryType.DeliveryPrepared)
setRefreshButtonEnabled(false)
if (detailedBolusInfo.insulin > medtronicPumpStatus.reservoirRemainingUnits) {
return PumpEnactResultImpl(injector) //
return PumpEnactResultObject(injector) //
.success(false) //
.enacted(false) //
.comment(
@ -633,7 +633,7 @@ class MedtronicPumpPlugin @Inject constructor(
// LOG.debug("MedtronicPumpPlugin::deliverBolus - Response: {}", response);
return if (response == null || !response) {
PumpEnactResultImpl(injector) //
PumpEnactResultObject(injector) //
.success(bolusDeliveryType == BolusDeliveryType.CancelDelivery) //
.enacted(false) //
.comment(R.string.medtronic_cmd_bolus_could_not_be_delivered)
@ -660,7 +660,7 @@ class MedtronicPumpPlugin @Inject constructor(
val time = now + bolusTime * 1000
busyTimestamps.add(time)
setEnableCustomAction(MedtronicCustomActionType.ClearBolusBlock, true)
PumpEnactResultImpl(injector).success(true) //
PumpEnactResultObject(injector).success(true) //
.enacted(true) //
.bolusDelivered(detailedBolusInfo.insulin) //
.carbsDelivered(detailedBolusInfo.carbs)
@ -677,8 +677,8 @@ class MedtronicPumpPlugin @Inject constructor(
private fun setNotReachable(isBolus: Boolean, success: Boolean): PumpEnactResult {
setRefreshButtonEnabled(true)
if (isBolus) bolusDeliveryType = BolusDeliveryType.Idle
return if (success) PumpEnactResultImpl(injector).success(true).enacted(false)
else PumpEnactResultImpl(injector).success(false).enacted(false).comment(R.string.medtronic_pump_status_pump_unreachable)
return if (success) PumpEnactResultObject(injector).success(true).enacted(false)
else PumpEnactResultObject(injector).success(false).enacted(false).comment(R.string.medtronic_pump_status_pump_unreachable)
}
override fun stopBolusDelivering() {
@ -701,7 +701,7 @@ class MedtronicPumpPlugin @Inject constructor(
setRefreshButtonEnabled(false)
if (isPumpNotReachable) {
setRefreshButtonEnabled(true)
return PumpEnactResultImpl(injector) //
return PumpEnactResultObject(injector) //
.success(false) //
.enacted(false) //
.comment(R.string.medtronic_pump_status_pump_unreachable)
@ -714,7 +714,7 @@ class MedtronicPumpPlugin @Inject constructor(
if (tbrCurrent == null) {
aapsLogger.warn(LTag.PUMP, logPrefix + "setTempBasalAbsolute - Could not read current TBR, canceling operation.")
finishAction("TBR")
return PumpEnactResultImpl(injector).success(false).enacted(false)
return PumpEnactResultObject(injector).success(false).enacted(false)
.comment(R.string.medtronic_cmd_cant_read_tbr)
} else {
aapsLogger.info(LTag.PUMP, logPrefix + "setTempBasalAbsolute: Current Basal: duration: " + tbrCurrent.durationMinutes + " min, rate=" + tbrCurrent.insulinRate)
@ -729,7 +729,7 @@ class MedtronicPumpPlugin @Inject constructor(
if (sameRate) {
aapsLogger.info(LTag.PUMP, logPrefix + "setTempBasalAbsolute - No enforceNew and same rate. Exiting.")
finishAction("TBR")
return PumpEnactResultImpl(injector).success(true).enacted(false)
return PumpEnactResultObject(injector).success(true).enacted(false)
}
}
// if not the same rate, we cancel and start new
@ -745,7 +745,7 @@ class MedtronicPumpPlugin @Inject constructor(
if (response == null || !response) {
aapsLogger.error(logPrefix + "setTempBasalAbsolute - Cancel TBR failed.")
finishAction("TBR")
return PumpEnactResultImpl(injector).success(false).enacted(false)
return PumpEnactResultObject(injector).success(false).enacted(false)
.comment(R.string.medtronic_cmd_cant_cancel_tbr_stop_op)
} else {
//cancelTBRWithTemporaryId()
@ -762,7 +762,7 @@ class MedtronicPumpPlugin @Inject constructor(
aapsLogger.info(LTag.PUMP, logPrefix + "setTempBasalAbsolute - setTBR. Response: " + response)
return if (response == null || !response) {
finishAction("TBR")
PumpEnactResultImpl(injector).success(false).enacted(false) //
PumpEnactResultObject(injector).success(false).enacted(false) //
.comment(R.string.medtronic_cmd_tbr_could_not_be_delivered)
} else {
medtronicPumpStatus.tempBasalStart = System.currentTimeMillis()
@ -776,7 +776,7 @@ class MedtronicPumpPlugin @Inject constructor(
incrementStatistics(MedtronicConst.Statistics.TBRsSet)
finishAction("TBR")
PumpEnactResultImpl(injector).success(true).enacted(true) //
PumpEnactResultObject(injector).success(true).enacted(true) //
.absolute(absoluteRate).duration(durationInMinutes)
}
}
@ -1022,7 +1022,7 @@ class MedtronicPumpPlugin @Inject constructor(
aapsLogger.info(LTag.PUMP, logPrefix + "cancelTempBasal - started")
if (isPumpNotReachable) {
setRefreshButtonEnabled(true)
return PumpEnactResultImpl(injector) //
return PumpEnactResultObject(injector) //
.success(false) //
.enacted(false) //
.comment(R.string.medtronic_pump_status_pump_unreachable)
@ -1034,12 +1034,12 @@ class MedtronicPumpPlugin @Inject constructor(
if (tbrCurrent.insulinRate > 0.0f && tbrCurrent.durationMinutes == 0) {
aapsLogger.info(LTag.PUMP, logPrefix + "cancelTempBasal - TBR already canceled.")
finishAction("TBR")
return PumpEnactResultImpl(injector).success(true).enacted(false)
return PumpEnactResultObject(injector).success(true).enacted(false)
}
} else {
aapsLogger.warn(LTag.PUMP, logPrefix + "cancelTempBasal - Could not read current TBR, canceling operation.")
finishAction("TBR")
return PumpEnactResultImpl(injector).success(false).enacted(false)
return PumpEnactResultObject(injector).success(false).enacted(false)
.comment(R.string.medtronic_cmd_cant_read_tbr)
}
val responseTask2 = rileyLinkMedtronicService?.medtronicUIComm?.executeCommand(MedtronicCommandType.CancelTBR)
@ -1047,7 +1047,7 @@ class MedtronicPumpPlugin @Inject constructor(
finishAction("TBR")
return if (response == null || !response) {
aapsLogger.info(LTag.PUMP, logPrefix + "cancelTempBasal - Cancel TBR failed.")
PumpEnactResultImpl(injector).success(false).enacted(false) //
PumpEnactResultObject(injector).success(false).enacted(false) //
.comment(R.string.medtronic_cmd_cant_cancel_tbr)
} else {
aapsLogger.info(LTag.PUMP, logPrefix + "cancelTempBasal - Cancel TBR successful.")
@ -1083,7 +1083,7 @@ class MedtronicPumpPlugin @Inject constructor(
//cancelTBRWithTemporaryId()
PumpEnactResultImpl(injector).success(true).enacted(true) //
PumpEnactResultObject(injector).success(true).enacted(true) //
.isTempCancel(true)
}
}
@ -1106,7 +1106,7 @@ class MedtronicPumpPlugin @Inject constructor(
// this shouldn't be needed, but let's do check if profile setting we are setting is same as current one
if (isProfileSame(profile)) {
return PumpEnactResultImpl(injector) //
return PumpEnactResultObject(injector) //
.success(true) //
.enacted(false) //
.comment(R.string.medtronic_cmd_basal_profile_not_set_is_same)
@ -1114,7 +1114,7 @@ class MedtronicPumpPlugin @Inject constructor(
setRefreshButtonEnabled(false)
if (isPumpNotReachable) {
setRefreshButtonEnabled(true)
return PumpEnactResultImpl(injector) //
return PumpEnactResultObject(injector) //
.success(false) //
.enacted(false) //
.comment(R.string.medtronic_pump_status_pump_unreachable)
@ -1124,7 +1124,7 @@ class MedtronicPumpPlugin @Inject constructor(
aapsLogger.debug("Basal Profile: $basalProfile")
val profileInvalid = isProfileValid(basalProfile)
if (profileInvalid != null) {
return PumpEnactResultImpl(injector) //
return PumpEnactResultObject(injector) //
.success(false) //
.enacted(false) //
.comment(rh.gs(R.string.medtronic_cmd_set_profile_pattern_overflow, profileInvalid))
@ -1136,10 +1136,10 @@ class MedtronicPumpPlugin @Inject constructor(
val response = responseTask?.result as Boolean?
aapsLogger.info(LTag.PUMP, logPrefix + "Basal Profile was set: " + response)
return if (response == null || !response) {
PumpEnactResultImpl(injector).success(false).enacted(false) //
PumpEnactResultObject(injector).success(false).enacted(false) //
.comment(R.string.medtronic_cmd_basal_profile_could_not_be_set)
} else {
PumpEnactResultImpl(injector).success(true).enacted(true)
PumpEnactResultObject(injector).success(true).enacted(true)
}
}

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.interfaces.pump.PumpEnactResult
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.logging.AAPSLogger
@ -41,7 +41,7 @@ abstract class ActionViewModelBase(
logger.error(LTag.PUMP, "Caught exception in while executing action in ActionViewModelBase", throwable)
_isActionExecutingLiveData.postValue(false)
_actionResultLiveData.postValue(
PumpEnactResultImpl(injector).success(false).comment(
PumpEnactResultObject(injector).success(false).comment(
throwable.message ?: "Caught exception in while executing action in ActionViewModelBase"
)
)

View file

@ -5,7 +5,7 @@ import android.os.Handler
import android.os.HandlerThread
import android.text.format.DateFormat
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.events.EventPreferenceChange
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
@ -395,7 +395,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
override fun setNewBasalProfile(profile: Profile): PumpEnactResult {
if (!podStateManager.isActivationCompleted) {
return PumpEnactResultImpl(injector).success(true).enacted(true)
return PumpEnactResultObject(injector).success(true).enacted(true)
}
aapsLogger.debug(LTag.PUMP, "setNewBasalProfile profile=$profile")
return setNewBasalProfile(profile, OmnipodCommandType.SET_BASAL_PROFILE)
@ -567,7 +567,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
detailedBolusInfo.insulin == 0.0
) {
// Accept only valid insulin requests
return PumpEnactResultImpl(injector)
return PumpEnactResultObject(injector)
.success(false)
.enacted(false)
.bolusDelivered(0.0)
@ -575,7 +575,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
}
val requestedBolusAmount = detailedBolusInfo.insulin
if (requestedBolusAmount > reservoirLevel) {
return PumpEnactResultImpl(injector)
return PumpEnactResultObject(injector)
.success(false)
.enacted(false)
.bolusDelivered(0.0)
@ -584,7 +584,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
if (podStateManager.deliveryStatus == DeliveryStatus.BOLUS_AND_BASAL_ACTIVE ||
podStateManager.deliveryStatus == DeliveryStatus.BOLUS_AND_TEMP_BASAL_ACTIVE
) {
return PumpEnactResultImpl(injector)
return PumpEnactResultObject(injector)
.success(false)
.enacted(false)
.bolusDelivered(0.0)
@ -653,10 +653,10 @@ class OmnipodDashPumpPlugin @Inject constructor(
}
}
}.toSingle {
PumpEnactResultImpl(injector).success(true).enacted(true).bolusDelivered(deliveredBolusAmount)
PumpEnactResultObject(injector).success(true).enacted(true).bolusDelivered(deliveredBolusAmount)
}.onErrorReturnItem(
// success if canceled
PumpEnactResultImpl(injector).success(bolusCanceled).enacted(false)
PumpEnactResultObject(injector).success(bolusCanceled).enacted(false)
)
.blockingGet()
aapsLogger.info(
@ -940,13 +940,13 @@ class OmnipodDashPumpPlugin @Inject constructor(
tbrType: PumpSync.TemporaryBasalType
): PumpEnactResult {
// TODO i18n
return PumpEnactResultImpl(injector).success(false).enacted(false)
return PumpEnactResultObject(injector).success(false).enacted(false)
.comment("Omnipod Dash driver does not support percentage temp basals")
}
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult {
// TODO i18n
return PumpEnactResultImpl(injector).success(false).enacted(false)
return PumpEnactResultObject(injector).success(false).enacted(false)
.comment("Omnipod Dash driver does not support extended boluses")
}
@ -963,7 +963,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
pumpSync.expectedPumpState().temporaryBasal == null
) {
// nothing to cancel
return PumpEnactResultImpl(injector).success(true).enacted(false)
return PumpEnactResultObject(injector).success(true).enacted(false)
}
return executeProgrammingCommand(
@ -986,17 +986,17 @@ class OmnipodDashPumpPlugin @Inject constructor(
}
private fun Completable.toPumpEnactResultImpl(): PumpEnactResult {
return this.toSingleDefault(PumpEnactResultImpl(injector).success(true).enacted(true))
return this.toSingleDefault(PumpEnactResultObject(injector).success(true).enacted(true))
.doOnError { throwable ->
aapsLogger.error(LTag.PUMP, "toPumpEnactResult, error executing command: $throwable")
}
.onErrorReturnItem(PumpEnactResultImpl(injector).success(false).enacted(false))
.onErrorReturnItem(PumpEnactResultObject(injector).success(false).enacted(false))
.blockingGet()
}
override fun cancelExtendedBolus(): PumpEnactResult {
// TODO i18n
return PumpEnactResultImpl(injector).success(false).enacted(false)
return PumpEnactResultObject(injector).success(false).enacted(false)
.comment("Omnipod Dash driver does not support extended boluses")
}
@ -1097,7 +1097,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
override fun loadTDDs(): PumpEnactResult {
// TODO i18n
return PumpEnactResultImpl(injector).success(false).enacted(false)
return PumpEnactResultObject(injector).success(false).enacted(false)
.comment("Omnipod Dash driver does not support TDD")
}
@ -1132,7 +1132,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
else -> {
aapsLogger.warn(LTag.PUMP, "Unsupported custom command: " + customCommand.javaClass.name)
PumpEnactResultImpl(injector).success(false).enacted(false).comment(
PumpEnactResultObject(injector).success(false).enacted(false).comment(
rh.gs(
R.string.omnipod_common_error_unsupported_custom_command,
customCommand.javaClass.name
@ -1149,7 +1149,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
historyEntry = history.createRecord(commandType = OmnipodCommandType.ACKNOWLEDGE_ALERTS),
command = omnipodManager.silenceAlerts(it).ignoreElements(),
).toPumpEnactResultImpl()
} ?: PumpEnactResultImpl(injector).success(false).enacted(false).comment("No active alerts") // TODO i18n
} ?: PumpEnactResultObject(injector).success(false).enacted(false).comment("No active alerts") // TODO i18n
}
private fun disableSuspendAlerts(): PumpEnactResult {
@ -1197,7 +1197,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
R.raw.boluserror
)
}.toPumpEnactResultImpl()
} ?: PumpEnactResultImpl(injector).success(false).enacted(false).comment("No profile active") // TODO i18n
} ?: PumpEnactResultObject(injector).success(false).enacted(false).comment("No profile active") // TODO i18n
}
private fun deactivatePod(): PumpEnactResult {
@ -1223,7 +1223,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
private fun handleTimeChange(): PumpEnactResult {
return profileFunction.getProfile()?.let {
setNewBasalProfile(it, OmnipodCommandType.SET_TIME)
} ?: PumpEnactResultImpl(injector).success(false).enacted(false).comment("No profile active")
} ?: PumpEnactResultObject(injector).success(false).enacted(false).comment("No profile active")
}
private fun updateAlertConfiguration(): PumpEnactResult {
@ -1241,12 +1241,12 @@ class OmnipodDashPumpPlugin @Inject constructor(
lowReservoirAlertUnits
) -> {
aapsLogger.debug(LTag.PUMP, "Ignoring updateAlertConfiguration because the settings did not change")
return PumpEnactResultImpl(injector).success(true).enacted(false)
return PumpEnactResultObject(injector).success(true).enacted(false)
}
!podStateManager.isPodRunning -> {
aapsLogger.debug(LTag.PUMP, "Ignoring updateAlertConfiguration because there is no active pod")
return PumpEnactResultImpl(injector).success(true).enacted(false)
return PumpEnactResultObject(injector).success(true).enacted(false)
}
}
@ -1258,7 +1258,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
"updateAlertConfiguration negative " +
"expiryAlertDuration=$expiryAlertDelay"
)
PumpEnactResultImpl(injector).success(false).enacted(false)
PumpEnactResultObject(injector).success(false).enacted(false)
}
val alerts = listOf(
AlertConfiguration(

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.activatio
import androidx.annotation.StringRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel
import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
@ -66,14 +66,14 @@ class DashInitializePodViewModel @Inject constructor(
onError = { throwable ->
logger.error(LTag.PUMP, "Error in Pod activation part 1", throwable)
source.onSuccess(
PumpEnactResultImpl(injector)
PumpEnactResultObject(injector)
.success(false)
.comment(I8n.textFromException(throwable, rh))
)
},
onComplete = {
logger.debug("Pod activation part 1 completed")
source.onSuccess(PumpEnactResultImpl(injector).success(true))
source.onSuccess(PumpEnactResultObject(injector).success(true))
}
)
}

View file

@ -2,7 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.activatio
import androidx.annotation.StringRes
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ProfileFunction
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType
@ -91,7 +91,7 @@ class DashInsertCannulaViewModel @Inject constructor(
.subscribeBy(
onError = { throwable ->
logger.error(LTag.PUMP, "Error in Pod activation part 2", throwable)
source.onSuccess(PumpEnactResultImpl(injector).success(false).comment(I8n.textFromException(throwable, rh)))
source.onSuccess(PumpEnactResultObject(injector).success(false).comment(I8n.textFromException(throwable, rh)))
},
onComplete = {
logger.debug("Pod activation part 2 completed")
@ -121,7 +121,7 @@ class DashInsertCannulaViewModel @Inject constructor(
)
rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_NOT_ATTACHED))
fabricPrivacy.logCustom("OmnipodDashPodActivated")
source.onSuccess(PumpEnactResultImpl(injector).success(true))
source.onSuccess(PumpEnactResultObject(injector).success(true))
}
)
}

View file

@ -34,7 +34,7 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.data.PumpEnactResultImpl;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.interfaces.ActivePlugin;
import info.nightscout.androidaps.interfaces.CommandQueue;
@ -603,7 +603,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
@Override
public PumpEnactResult setNewBasalProfile(@NonNull Profile profile) {
if (!podStateManager.hasPodState())
return new PumpEnactResultImpl(getInjector()).enacted(false).success(false).comment("Null pod state");
return new PumpEnactResultObject(getInjector()).enacted(false).success(false).comment("Null pod state");
PumpEnactResult result = executeCommand(OmnipodCommandType.SET_BASAL_PROFILE, () -> aapsOmnipodErosManager.setBasalProfile(profile, true));
aapsLogger.info(LTag.PUMP, "Basal Profile was set: " + result.getSuccess());
@ -661,7 +661,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
if (detailedBolusInfo.insulin == 0 && detailedBolusInfo.carbs == 0) {
// neither carbs nor bolus requested
aapsLogger.error("deliverTreatment: Invalid input: neither carbs nor insulin are set in treatment");
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false).bolusDelivered(0d).carbsDelivered(0d)
return new PumpEnactResultObject(getInjector()).success(false).enacted(false).bolusDelivered(0d).carbsDelivered(0d)
.comment(R.string.invalidinput);
} else if (detailedBolusInfo.insulin > 0) {
// bolus needed, ask pump to deliver it
@ -679,7 +679,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
"[date=%d, carbs=%.2f, pumpSerial=%s] - Result: %b",
detailedBolusInfo.timestamp, detailedBolusInfo.carbs, serialNumber(), result));
return new PumpEnactResultImpl(getInjector()).success(true).enacted(true).bolusDelivered(0d)
return new PumpEnactResultObject(getInjector()).success(true).enacted(true).bolusDelivered(0d)
.carbsDelivered(detailedBolusInfo.carbs);
}
}
@ -697,7 +697,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
aapsLogger.info(LTag.PUMP, "setTempBasalAbsolute: rate: {}, duration={}", absoluteRate, durationInMinutes);
if (durationInMinutes <= 0 || durationInMinutes % BASAL_STEP_DURATION.getStandardMinutes() != 0) {
return new PumpEnactResultImpl(getInjector()).success(false).comment(rh.gs(R.string.omnipod_eros_error_set_temp_basal_failed_validation, BASAL_STEP_DURATION.getStandardMinutes()));
return new PumpEnactResultObject(getInjector()).success(false).comment(rh.gs(R.string.omnipod_eros_error_set_temp_basal_failed_validation, BASAL_STEP_DURATION.getStandardMinutes()));
}
// read current TBR
@ -711,7 +711,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
if (tbrCurrent != null && !enforceNew) {
if (Round.INSTANCE.isSame(tbrCurrent.getRate(), absoluteRate)) {
aapsLogger.info(LTag.PUMP, "setTempBasalAbsolute - No enforceNew and same rate. Exiting.");
return new PumpEnactResultImpl(getInjector()).success(true).enacted(false);
return new PumpEnactResultObject(getInjector()).success(true).enacted(false);
}
}
@ -733,7 +733,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
if (tbrCurrent == null) {
aapsLogger.info(LTag.PUMP, "cancelTempBasal - TBR already cancelled.");
return new PumpEnactResultImpl(getInjector()).success(true).enacted(false);
return new PumpEnactResultObject(getInjector()).success(true).enacted(false);
}
return executeCommand(OmnipodCommandType.CANCEL_TEMPORARY_BASAL, aapsOmnipodErosManager::cancelTemporaryBasal);
@ -857,7 +857,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
@Override
public PumpEnactResult executeCustomCommand(@NonNull CustomCommand command) {
if (!podStateManager.hasPodState())
return new PumpEnactResultImpl(getInjector()).enacted(false).success(false).comment("Null pod state");
return new PumpEnactResultObject(getInjector()).enacted(false).success(false).comment("Null pod state");
if (command instanceof CommandSilenceAlerts) {
return executeCommand(OmnipodCommandType.ACKNOWLEDGE_ALERTS, aapsOmnipodErosManager::acknowledgeAlerts);
}
@ -887,7 +887,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
}
aapsLogger.warn(LTag.PUMP, "Unsupported custom command: " + command.getClass().getName());
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false).comment(rh.gs(R.string.omnipod_common_error_unsupported_custom_command, command.getClass().getName()));
return new PumpEnactResultObject(getInjector()).success(false).enacted(false).comment(rh.gs(R.string.omnipod_common_error_unsupported_custom_command, command.getClass().getName()));
}
private PumpEnactResult retrievePulseLog() {
@ -895,7 +895,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
try {
result = executeCommand(OmnipodCommandType.READ_POD_PULSE_LOG, aapsOmnipodErosManager::readPulseLog);
} catch (Exception ex) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false).comment(aapsOmnipodErosManager.translateException(ex));
return new PumpEnactResultObject(getInjector()).success(false).enacted(false).comment(aapsOmnipodErosManager.translateException(ex));
}
Intent i = new Intent(context, activityNames.getErrorHelperActivity());
@ -905,7 +905,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
i.putExtra("clipboardContent", result.toString());
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
return new PumpEnactResultImpl(getInjector()).success(true).enacted(false);
return new PumpEnactResultObject(getInjector()).success(true).enacted(false);
}
@NonNull private PumpEnactResult updateAlertConfiguration() {
@ -1170,7 +1170,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
}
private PumpEnactResult getOperationNotSupportedWithCustomText(int resourceId) {
return new PumpEnactResultImpl(getInjector()).success(false).enacted(false).comment(resourceId);
return new PumpEnactResultObject(getInjector()).success(false).enacted(false).comment(resourceId);
}
}

View file

@ -14,7 +14,7 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import dagger.android.HasAndroidInjector;
import info.nightscout.androidaps.data.PumpEnactResultImpl;
import info.nightscout.androidaps.data.PumpEnactResultObject;
import info.nightscout.androidaps.extensions.PumpStateExtensionKt;
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
@ -170,7 +170,7 @@ public class AapsOmnipodErosManager {
}
public PumpEnactResult initializePod() {
PumpEnactResult result = new PumpEnactResultImpl(injector);
PumpEnactResult result = new PumpEnactResultObject(injector);
try {
Boolean res = executeCommand(delegate::pairAndPrime)
.blockingGet();
@ -192,10 +192,10 @@ public class AapsOmnipodErosManager {
public PumpEnactResult insertCannula(Profile profile) {
if (profile == null) {
String comment = getStringResource(R.string.omnipod_common_error_set_initial_basal_schedule_no_profile);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(comment);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(comment);
}
PumpEnactResult result = new PumpEnactResultImpl(injector);
PumpEnactResult result = new PumpEnactResultObject(injector);
try {
BasalSchedule basalSchedule = mapProfileToBasalSchedule(profile);
@ -233,11 +233,11 @@ public class AapsOmnipodErosManager {
} catch (Exception ex) {
String errorMessage = translateException(ex);
addFailureToHistory(PodHistoryEntryType.CONFIGURE_ALERTS, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
}
addSuccessToHistory(PodHistoryEntryType.CONFIGURE_ALERTS, alertConfigurations);
return new PumpEnactResultImpl(injector).success(true).enacted(false);
return new PumpEnactResultObject(injector).success(true).enacted(false);
}
public PumpEnactResult playTestBeep(BeepConfigType beepType) {
@ -246,11 +246,11 @@ public class AapsOmnipodErosManager {
} catch (Exception ex) {
String errorMessage = translateException(ex);
addFailureToHistory(PodHistoryEntryType.PLAY_TEST_BEEP, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
}
addSuccessToHistory(PodHistoryEntryType.PLAY_TEST_BEEP, beepType);
return new PumpEnactResultImpl(injector).success(true).enacted(false);
return new PumpEnactResultObject(injector).success(true).enacted(false);
}
@ -262,12 +262,12 @@ public class AapsOmnipodErosManager {
} catch (Exception ex) {
String errorMessage = translateException(ex);
addFailureToHistory(PodHistoryEntryType.GET_POD_STATUS, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
}
addSuccessToHistory(PodHistoryEntryType.GET_POD_STATUS, statusResponse);
return new PumpEnactResultImpl(injector).success(true).enacted(false);
return new PumpEnactResultObject(injector).success(true).enacted(false);
}
public PumpEnactResult deactivatePod() {
@ -276,7 +276,7 @@ public class AapsOmnipodErosManager {
} catch (Exception ex) {
String errorMessage = translateException(ex);
addFailureToHistory(PodHistoryEntryType.DEACTIVATE_POD, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
}
addSuccessToHistory(PodHistoryEntryType.DEACTIVATE_POD, null);
@ -284,7 +284,7 @@ public class AapsOmnipodErosManager {
dismissNotification(Notification.OMNIPOD_POD_FAULT);
return new PumpEnactResultImpl(injector).success(true).enacted(true);
return new PumpEnactResultObject(injector).success(true).enacted(true);
}
public PumpEnactResult setBasalProfile(Profile profile, boolean showNotifications) {
@ -293,7 +293,7 @@ public class AapsOmnipodErosManager {
if (showNotifications) {
showNotification(Notification.FAILED_UPDATE_PROFILE, note, Notification.URGENT, R.raw.boluserror);
}
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(note);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(note);
}
// #1963 return synthetic success if pre-activation
@ -301,7 +301,7 @@ public class AapsOmnipodErosManager {
// otherwise a catch-22
if (!podStateManager.getActivationProgress().isCompleted()) {
// TODO: i18n string
return new PumpEnactResultImpl(injector).success(true).enacted(false).comment("pre" +
return new PumpEnactResultObject(injector).success(true).enacted(false).comment("pre" +
"-activation basal change moot");
}
@ -317,14 +317,14 @@ public class AapsOmnipodErosManager {
}
String errorMessage = translateException(ex.getCause());
addFailureToHistory(historyEntryType, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
} catch (PrecedingCommandFailedUncertainlyException ex) {
if (showNotifications) {
showNotification(Notification.FAILED_UPDATE_PROFILE, getStringResource(R.string.omnipod_eros_error_set_basal_failed_delivery_might_be_suspended), Notification.URGENT, R.raw.boluserror);
}
String errorMessage = translateException(ex.getCause());
addFailureToHistory(historyEntryType, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
} catch (Exception ex) {
if (showNotifications) {
String note;
@ -337,7 +337,7 @@ public class AapsOmnipodErosManager {
}
String errorMessage = translateException(ex);
addFailureToHistory(historyEntryType, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
}
@ -355,7 +355,7 @@ public class AapsOmnipodErosManager {
dismissNotification(Notification.OMNIPOD_POD_SUSPENDED);
dismissNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC);
return new PumpEnactResultImpl(injector).success(true).enacted(true);
return new PumpEnactResultObject(injector).success(true).enacted(true);
}
public PumpEnactResult discardPodState() {
@ -369,7 +369,7 @@ public class AapsOmnipodErosManager {
sendEvent(new EventOmnipodErosPumpValuesChanged());
sendEvent(new EventRefreshOverview("Omnipod command: " + OmnipodCommandType.DISCARD_POD, false));
return new PumpEnactResultImpl(injector).success(true).enacted(true);
return new PumpEnactResultObject(injector).success(true).enacted(true);
}
public PumpEnactResult bolus(DetailedBolusInfo detailedBolusInfo) {
@ -393,7 +393,7 @@ public class AapsOmnipodErosManager {
} catch (Exception ex) {
String errorMessage = translateException(ex);
addFailureToHistory(System.currentTimeMillis(), PodHistoryEntryType.SET_BOLUS, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
}
if (OmnipodManager.CommandDeliveryStatus.UNCERTAIN_FAILURE.equals(bolusCommandResult.getCommandDeliveryStatus())) {
@ -448,7 +448,7 @@ public class AapsOmnipodErosManager {
sp.remove(OmnipodErosStorageKeys.Preferences.ACTIVE_BOLUS);
return new PumpEnactResultImpl(injector).success(true).enacted(true).carbsDelivered(detailedBolusInfo.carbs).bolusDelivered(detailedBolusInfo.insulin);
return new PumpEnactResultObject(injector).success(true).enacted(true).carbsDelivered(detailedBolusInfo.carbs).bolusDelivered(detailedBolusInfo.insulin);
}
public PumpEnactResult cancelBolus() {
@ -463,7 +463,7 @@ public class AapsOmnipodErosManager {
aapsLogger.debug(LTag.PUMP, "Not cancelling bolus: bolus command failed");
String comment = getStringResource(R.string.omnipod_common_error_bolus_did_not_succeed);
addFailureToHistory(System.currentTimeMillis(), PodHistoryEntryType.CANCEL_BOLUS, comment);
return new PumpEnactResultImpl(injector).success(true).enacted(false).comment(comment);
return new PumpEnactResultObject(injector).success(true).enacted(false).comment(comment);
}
}
@ -475,11 +475,11 @@ public class AapsOmnipodErosManager {
executeCommand(() -> delegate.cancelBolus(isBolusBeepsEnabled()));
aapsLogger.debug(LTag.PUMP, "Successfully cancelled bolus", i);
addSuccessToHistory(System.currentTimeMillis(), PodHistoryEntryType.CANCEL_BOLUS, null);
return new PumpEnactResultImpl(injector).success(true).enacted(true);
return new PumpEnactResultObject(injector).success(true).enacted(true);
} catch (PodFaultException ex) {
aapsLogger.debug(LTag.PUMP, "Successfully cancelled bolus (implicitly because of a Pod Fault)");
addSuccessToHistory(System.currentTimeMillis(), PodHistoryEntryType.CANCEL_BOLUS, null);
return new PumpEnactResultImpl(injector).success(true).enacted(true);
return new PumpEnactResultObject(injector).success(true).enacted(true);
} catch (Exception ex) {
aapsLogger.debug(LTag.PUMP, "Failed to cancel bolus", ex);
comment = translateException(ex);
@ -487,7 +487,7 @@ public class AapsOmnipodErosManager {
}
addFailureToHistory(System.currentTimeMillis(), PodHistoryEntryType.CANCEL_BOLUS, comment);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(comment);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(comment);
}
public PumpEnactResult setTemporaryBasal(TempBasalPair tempBasalPair) {
@ -497,7 +497,7 @@ public class AapsOmnipodErosManager {
} catch (CommandFailedAfterChangingDeliveryStatusException ex) {
String errorMessage = translateException(ex.getCause());
addFailureToHistory(PodHistoryEntryType.SET_TEMPORARY_BASAL, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
} catch (PrecedingCommandFailedUncertainlyException ex) {
String errorMessage = translateException(ex.getCause());
addFailureToHistory(PodHistoryEntryType.SET_TEMPORARY_BASAL, errorMessage);
@ -506,7 +506,7 @@ public class AapsOmnipodErosManager {
splitActiveTbr(); // Split any active TBR so when we recover from the uncertain TBR status,we only cancel the part after the cancellation
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
} catch (Exception ex) {
String errorMessage = translateException(ex);
long pumpId = addFailureToHistory(PodHistoryEntryType.SET_TEMPORARY_BASAL, errorMessage);
@ -524,7 +524,7 @@ public class AapsOmnipodErosManager {
addTempBasalTreatment(System.currentTimeMillis(), pumpId, tempBasalPair);
}
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
}
long pumpId = addSuccessToHistory(PodHistoryEntryType.SET_TEMPORARY_BASAL, tempBasalPair);
@ -533,7 +533,7 @@ public class AapsOmnipodErosManager {
sendEvent(new EventDismissNotification(Notification.OMNIPOD_TBR_ALERTS));
return new PumpEnactResultImpl(injector)
return new PumpEnactResultObject(injector)
.duration(tempBasalPair.getDurationMinutes())
.absolute(PumpType.OMNIPOD_EROS.determineCorrectBasalSize(tempBasalPair.getInsulinRate()))
.success(true).enacted(true);
@ -550,7 +550,7 @@ public class AapsOmnipodErosManager {
}
String errorMessage = translateException(ex);
addFailureToHistory(PodHistoryEntryType.CANCEL_TEMPORARY_BASAL, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
}
long pumpId = addSuccessToHistory(PodHistoryEntryType.CANCEL_TEMPORARY_BASAL, null);
@ -564,7 +564,7 @@ public class AapsOmnipodErosManager {
sendEvent(new EventDismissNotification(Notification.OMNIPOD_TBR_ALERTS));
return new PumpEnactResultImpl(injector).success(true).enacted(true);
return new PumpEnactResultObject(injector).success(true).enacted(true);
}
public PumpEnactResult acknowledgeAlerts() {
@ -573,11 +573,11 @@ public class AapsOmnipodErosManager {
} catch (Exception ex) {
String errorMessage = translateException(ex);
addFailureToHistory(PodHistoryEntryType.ACKNOWLEDGE_ALERTS, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
}
addSuccessToHistory(PodHistoryEntryType.ACKNOWLEDGE_ALERTS, null);
return new PumpEnactResultImpl(injector).success(true).enacted(true);
return new PumpEnactResultObject(injector).success(true).enacted(true);
}
public PumpEnactResult suspendDelivery() {
@ -586,7 +586,7 @@ public class AapsOmnipodErosManager {
} catch (Exception ex) {
String errorMessage = translateException(ex);
addFailureToHistory(PodHistoryEntryType.SUSPEND_DELIVERY, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
}
addSuccessToHistory(PodHistoryEntryType.SUSPEND_DELIVERY, null);
@ -595,7 +595,7 @@ public class AapsOmnipodErosManager {
dismissNotification(Notification.FAILED_UPDATE_PROFILE);
dismissNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC);
return new PumpEnactResultImpl(injector).success(true).enacted(true);
return new PumpEnactResultObject(injector).success(true).enacted(true);
}
// Updates the pods current time based on the device timezone and the pod's time zone
@ -609,21 +609,21 @@ public class AapsOmnipodErosManager {
}
String errorMessage = translateException(ex.getCause());
addFailureToHistory(PodHistoryEntryType.SET_TIME, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
} catch (PrecedingCommandFailedUncertainlyException ex) {
if (showNotifications) {
showNotification(Notification.FAILED_UPDATE_PROFILE, getStringResource(R.string.omnipod_eros_error_set_time_failed_delivery_might_be_suspended), Notification.URGENT, R.raw.boluserror);
}
String errorMessage = translateException(ex.getCause());
addFailureToHistory(PodHistoryEntryType.SET_TIME, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
} catch (Exception ex) {
if (showNotifications) {
showNotification(Notification.FAILED_UPDATE_PROFILE, getStringResource(R.string.omnipod_eros_error_set_time_failed_delivery_might_be_suspended), Notification.URGENT, R.raw.boluserror);
}
String errorMessage = translateException(ex);
addFailureToHistory(PodHistoryEntryType.SET_TIME, errorMessage);
return new PumpEnactResultImpl(injector).success(false).enacted(false).comment(errorMessage);
return new PumpEnactResultObject(injector).success(false).enacted(false).comment(errorMessage);
}
addSuccessToHistory(PodHistoryEntryType.SET_TIME, null);
@ -632,7 +632,7 @@ public class AapsOmnipodErosManager {
dismissNotification(Notification.OMNIPOD_POD_SUSPENDED);
dismissNotification(Notification.OMNIPOD_TIME_OUT_OF_SYNC);
return new PumpEnactResultImpl(injector).success(true).enacted(true);
return new PumpEnactResultObject(injector).success(true).enacted(true);
}
public PodInfoRecentPulseLog readPulseLog() {

View file

@ -3,7 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.CommandQueue
import info.nightscout.androidaps.plugins.pump.common.defs.TempBasalPair
@ -74,7 +74,7 @@ class OmnipodErosPumpPluginTest : TestBase() {
)
).thenAnswer { invocation: InvocationOnMock ->
val pair = invocation.getArgument<TempBasalPair>(0)
val result = PumpEnactResultImpl(injector)
val result = PumpEnactResultObject(injector)
result.absolute(pair.insulinRate)
result.duration(pair.durationMinutes)
result

View file

@ -6,7 +6,7 @@ import android.content.ServiceConnection
import android.text.format.DateFormat
import com.google.gson.GsonBuilder
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.androidaps.extensions.convertedToAbsolute
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
import info.nightscout.androidaps.extensions.toStringFull
@ -313,7 +313,7 @@ abstract class PumpPluginAbstract protected constructor(
if (detailedBolusInfo.insulin == 0.0 && detailedBolusInfo.carbs == 0.0) {
// neither carbs nor bolus requested
aapsLogger.error("deliverTreatment: Invalid input")
PumpEnactResultImpl(injector).success(false).enacted(false).bolusDelivered(0.0).carbsDelivered(0.0)
PumpEnactResultObject(injector).success(false).enacted(false).bolusDelivered(0.0).carbsDelivered(0.0)
.comment(R.string.invalidinput)
} else if (detailedBolusInfo.insulin > 0) {
// bolus needed, ask pump to deliver it
@ -329,7 +329,7 @@ abstract class PumpPluginAbstract protected constructor(
bolusingEvent.percent = 100
rxBus.send(bolusingEvent)
aapsLogger.debug(LTag.PUMP, "deliverTreatment: Carb only treatment.")
PumpEnactResultImpl(injector).success(true).enacted(true).bolusDelivered(0.0)
PumpEnactResultObject(injector).success(true).enacted(true).bolusDelivered(0.0)
.carbsDelivered(detailedBolusInfo.carbs).comment(R.string.common_resultok)
}
} finally {
@ -350,7 +350,7 @@ abstract class PumpPluginAbstract protected constructor(
protected abstract fun triggerUIChange()
private fun getOperationNotSupportedWithCustomText(resourceId: Int): PumpEnactResult =
PumpEnactResultImpl(injector).success(false).enacted(false).comment(resourceId)
PumpEnactResultObject(injector).success(false).enacted(false).comment(resourceId)
init {
pumpDescription.fillFor(pumpType)

View file

@ -1,7 +1,7 @@
package info.nightscout.androidaps
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.data.PumpEnactResultImpl
import info.nightscout.androidaps.data.PumpEnactResultObject
import info.nightscout.interfaces.profile.Profile
import info.nightscout.interfaces.pump.DetailedBolusInfo
import info.nightscout.interfaces.pump.Pump
@ -44,30 +44,30 @@ class TestPumpPlugin(val injector: HasAndroidInjector) : Pump {
override fun waitForDisconnectionInSeconds(): Int = 0
override fun getPumpStatus(reason: String) {}
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultImpl(injector)
override fun setNewBasalProfile(profile: Profile): PumpEnactResult = PumpEnactResultObject(injector)
override fun isThisProfileSet(profile: Profile): Boolean = isProfileSet
override fun lastDataTime(): Long = lastData
override val baseBasalRate: Double = baseBasal
override val reservoirLevel: Double = 0.0
override val batteryLevel: Int = 0
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun deliverTreatment(detailedBolusInfo: DetailedBolusInfo): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun stopBolusDelivering() {}
override fun setTempBasalAbsolute(absoluteRate: Double, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult =
PumpEnactResultImpl(injector).success(true)
PumpEnactResultObject(injector).success(true)
override fun setTempBasalPercent(percent: Int, durationInMinutes: Int, profile: Profile, enforceNew: Boolean, tbrType: PumpSync.TemporaryBasalType): PumpEnactResult =
PumpEnactResultImpl(injector).success(true)
PumpEnactResultObject(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun setExtendedBolus(insulin: Double, durationInMinutes: Int): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun cancelExtendedBolus(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject = JSONObject()
override fun manufacturer(): ManufacturerType = ManufacturerType.AAPS
override fun model(): PumpType = PumpType.GENERIC_AAPS
override fun serialNumber(): String = "1"
override fun shortStatus(veryShort: Boolean): String = ""
override val isFakingTempsByExtendedBoluses: Boolean = false
override fun loadTDDs(): PumpEnactResult = PumpEnactResultImpl(injector).success(true)
override fun loadTDDs(): PumpEnactResult = PumpEnactResultObject(injector).success(true)
override fun canHandleDST(): Boolean = true
override fun timezoneOrDSTChanged(timeChangeType: TimeChangeType) {}
}