comboctl-base: Handle ext/multiwave bolus in PumpIO.deliverCMDStandardBolus

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
This commit is contained in:
Carlos Rafael Giani 2023-01-01 22:27:17 +01:00
parent 05674ba552
commit 83dce8bee3

View file

@ -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
)