From 83dce8bee3dda1948ff00fb59f84df674af21156 Mon Sep 17 00:00:00 2001 From: Carlos Rafael Giani Date: Sun, 1 Jan 2023 22:27:17 +0100 Subject: [PATCH] comboctl-base: Handle ext/multiwave bolus in PumpIO.deliverCMDStandardBolus Signed-off-by: Carlos Rafael Giani --- .../info/nightscout/comboctl/base/PumpIO.kt | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/pump/combov2/comboctl/src/commonMain/kotlin/info/nightscout/comboctl/base/PumpIO.kt b/pump/combov2/comboctl/src/commonMain/kotlin/info/nightscout/comboctl/base/PumpIO.kt index 0fef728217..2b0970f9bb 100644 --- a/pump/combov2/comboctl/src/commonMain/kotlin/info/nightscout/comboctl/base/PumpIO.kt +++ b/pump/combov2/comboctl/src/commonMain/kotlin/info/nightscout/comboctl/base/PumpIO.kt @@ -1012,11 +1012,29 @@ class PumpIO( * of a packet's payload does not match the expected size. * @throws ComboIOException if IO with the pump fails. */ - suspend fun deliverCMDStandardBolus(bolusAmount: Int): Boolean = + suspend fun deliverCMDStandardBolus(totalBolusAmount: Int): Boolean = + deliverCMDStandardBolus( + totalBolusAmount, + immediateBolusAmount = 0, + durationInMinutes = 0, + bolusType = ApplicationLayer.CMDDeliverBolusType.STANDARD_BOLUS + ) + + suspend fun deliverCMDStandardBolus( + totalBolusAmount: Int, + immediateBolusAmount: Int, + durationInMinutes: Int, + bolusType: ApplicationLayer.CMDDeliverBolusType + ): Boolean = runPumpIOCall("deliver standard bolus", Mode.COMMAND) { val packet = sendPacketWithResponse( - ApplicationLayer.createCMDDeliverBolusPacket(bolusAmount), + ApplicationLayer.createCMDDeliverBolusPacket( + totalBolusAmount, + immediateBolusAmount, + durationInMinutes, + bolusType + ), ApplicationLayer.Command.CMD_DELIVER_BOLUS_RESPONSE )