merge: profile is not an interface

This commit is contained in:
Andrei Vereha 2021-05-02 10:37:06 +02:00
parent 2ae9f399aa
commit dd8ebded1a
2 changed files with 5 additions and 6 deletions

View file

@ -482,7 +482,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
}, },
onError = { throwable -> onError = { throwable ->
aapsLogger.error(LTag.PUMP, "Error in deactivatePod", throwable) aapsLogger.error(LTag.PUMP, "Error in deactivatePod", throwable)
source.onSuccess(PumpEnactResult(injector).success(false).comment(throwable.message)) source.onSuccess(PumpEnactResult(injector).success(false).comment(throwable.toString()))
}, },
onComplete = { onComplete = {
aapsLogger.debug("deactivatePod completed") aapsLogger.debug("deactivatePod completed")

View file

@ -1,14 +1,13 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dash.util package info.nightscout.androidaps.plugins.pump.omnipod.dash.util
import info.nightscout.androidaps.data.Profile import info.nightscout.androidaps.interfaces.Profile
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BasalProgram import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BasalProgram
import java.util.* import java.util.*
import kotlin.math.roundToInt import kotlin.math.roundToInt
fun mapProfileToBasalProgram(profile: Profile): BasalProgram { fun mapProfileToBasalProgram(profile: Profile): BasalProgram {
val basalValues = profile.basalValues val basalValues = profile.getBasalValues()
?: throw IllegalArgumentException("Basal values can not be null")
if (basalValues.isEmpty()) { if (basalValues.isEmpty()) {
throw IllegalArgumentException("Basal values should contain values") throw IllegalArgumentException("Basal values should contain values")
} }
@ -35,7 +34,7 @@ fun mapProfileToBasalProgram(profile: Profile): BasalProgram {
BasalProgram.Segment( BasalProgram.Segment(
(previousBasalValue.timeAsSeconds / 1800).toShort(), (previousBasalValue.timeAsSeconds / 1800).toShort(),
startSlotIndex, startSlotIndex,
(PumpType.Omnipod_Dash.determineCorrectBasalSize(previousBasalValue.value) * 100).roundToInt() (PumpType.OMNIPOD_DASH.determineCorrectBasalSize(previousBasalValue.value) * 100).roundToInt()
) )
) )
} }
@ -55,7 +54,7 @@ fun mapProfileToBasalProgram(profile: Profile): BasalProgram {
BasalProgram.Segment( BasalProgram.Segment(
(previousBasalValue!!.timeAsSeconds / 1800).toShort(), (previousBasalValue!!.timeAsSeconds / 1800).toShort(),
48, 48,
(PumpType.Omnipod_Dash.determineCorrectBasalSize(previousBasalValue.value) * 100).roundToInt() (PumpType.OMNIPOD_DASH.determineCorrectBasalSize(previousBasalValue.value) * 100).roundToInt()
) )
) )