diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.kt index e29fd1de16..8ae51e845a 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.kt @@ -5,13 +5,13 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.b import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.builder.NonceEnabledCommandBuilder import java.nio.ByteBuffer -class DeactivateCommand internal constructor(uniqueId: Int, sequenceNumber: Short, multiCommandFlag: Boolean, nonce: Int) : NonceEnabledCommand(CommandType.DEACTIVATE, uniqueId, sequenceNumber, multiCommandFlag, nonce) { +class DeactivateCommand internal constructor( + uniqueId: Int, + sequenceNumber: Short, + multiCommandFlag: Boolean, + nonce: Int +) : NonceEnabledCommand(CommandType.DEACTIVATE, uniqueId, sequenceNumber, multiCommandFlag, nonce) { - // - // - // - // - // override val encoded: ByteArray get() = appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) // .put(encodeHeader(uniqueId, sequenceNumber, LENGTH, multiCommandFlag)) // diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.kt index 16b3da0583..3300bde757 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.kt @@ -5,13 +5,12 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.b import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.builder.HeaderEnabledCommandBuilder import java.nio.ByteBuffer -class GetVersionCommand internal constructor(uniqueId: Int, sequenceNumber: Short, multiCommandFlag: Boolean) : HeaderEnabledCommand(CommandType.GET_VERSION, uniqueId, sequenceNumber, multiCommandFlag) { +class GetVersionCommand internal constructor( + uniqueId: Int, + sequenceNumber: Short, + multiCommandFlag: Boolean +) : HeaderEnabledCommand(CommandType.GET_VERSION, uniqueId, sequenceNumber, multiCommandFlag) { - // - // - // - // - // override val encoded: ByteArray get() = appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) // .put(encodeHeader(uniqueId, sequenceNumber, LENGTH, multiCommandFlag)) // diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommand.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommand.kt index 7e8dcb7971..594dd1f57c 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommand.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommand.kt @@ -7,7 +7,13 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import java.nio.ByteBuffer import java.util.* -class ProgramAlertsCommand internal constructor(uniqueId: Int, sequenceNumber: Short, multiCommandFlag: Boolean, alertConfigurations: List?, nonce: Int) : NonceEnabledCommand(CommandType.PROGRAM_ALERTS, uniqueId, sequenceNumber, multiCommandFlag, nonce) { +class ProgramAlertsCommand internal constructor( + uniqueId: Int, + sequenceNumber: Short, + multiCommandFlag: Boolean, + alertConfigurations: List?, + nonce: Int +) : NonceEnabledCommand(CommandType.PROGRAM_ALERTS, uniqueId, sequenceNumber, multiCommandFlag, nonce) { private val alertConfigurations: List diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommand.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommand.kt index bc4f724f69..af656989d8 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommand.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommand.kt @@ -12,7 +12,17 @@ import java.nio.ByteBuffer import java.util.* // Always preceded by 0x1a ProgramInsulinCommand -class ProgramBasalCommand internal constructor(private val interlockCommand: ProgramInsulinCommand, uniqueId: Int, sequenceNumber: Short, multiCommandFlag: Boolean, insulinProgramElements: List?, programReminder: ProgramReminder, currentInsulinProgramElementIndex: Byte, remainingTenthPulsesInCurrentInsulinProgramElement: Short, delayUntilNextTenthPulseInUsec: Int) : HeaderEnabledCommand(CommandType.PROGRAM_BASAL, uniqueId, sequenceNumber, multiCommandFlag) { +class ProgramBasalCommand internal constructor( + private val interlockCommand: ProgramInsulinCommand, + uniqueId: Int, + sequenceNumber: Short, + multiCommandFlag: Boolean, + insulinProgramElements: List, + programReminder: ProgramReminder, + currentInsulinProgramElementIndex: Byte, + remainingTenthPulsesInCurrentInsulinProgramElement: Short, + delayUntilNextTenthPulseInUsec: Int +) : HeaderEnabledCommand(CommandType.PROGRAM_BASAL, uniqueId, sequenceNumber, multiCommandFlag) { private val insulinProgramElements: List private val programReminder: ProgramReminder @@ -22,17 +32,8 @@ class ProgramBasalCommand internal constructor(private val interlockCommand: Pro val length: Short get() = (insulinProgramElements.size * 6 + 10).toShort() val bodyLength: Byte - get() = (insulinProgramElements.size * 6 + 8).toByte()// + get() = (insulinProgramElements.size * 6 + 8).toByte() - // - // - // - // - // - // - // - // - // override val encoded: ByteArray get() { val buffer = ByteBuffer.allocate(length.toInt()) // @@ -47,7 +48,7 @@ class ProgramBasalCommand internal constructor(private val interlockCommand: Pro } val basalCommand = buffer.array() val interlockCommand = interlockCommand.encoded - val header: ByteArray = encodeHeader(uniqueId, sequenceNumber, (basalCommand.size + interlockCommand!!.size).toShort(), multiCommandFlag) + val header: ByteArray = encodeHeader(uniqueId, sequenceNumber, (basalCommand.size + interlockCommand.size).toShort(), multiCommandFlag) return appendCrc(ByteBuffer.allocate(basalCommand.size + interlockCommand.size + header.size) // .put(header) // .put(interlockCommand) // diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommand.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommand.kt index 41d1f15df8..dd0db15ee6 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommand.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBolusCommand.kt @@ -9,20 +9,16 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util.Mess import java.nio.ByteBuffer // NOT SUPPORTED: extended bolus -class ProgramBolusCommand internal constructor(private val interlockCommand: ProgramInsulinCommand, uniqueId: Int, sequenceNumber: Short, multiCommandFlag: Boolean, private val programReminder: ProgramReminder, private val numberOfTenthPulses: Short, // - private val delayUntilFirstTenthPulseInUsec: Int) : HeaderEnabledCommand(CommandType.PROGRAM_BOLUS, uniqueId, sequenceNumber, multiCommandFlag) { +class ProgramBolusCommand internal constructor( + private val interlockCommand: ProgramInsulinCommand, + uniqueId: Int, + sequenceNumber: Short, + multiCommandFlag: Boolean, + private val programReminder: ProgramReminder, + private val numberOfTenthPulses: Short, + private val delayUntilFirstTenthPulseInUsec: Int +) : HeaderEnabledCommand(CommandType.PROGRAM_BOLUS, uniqueId, sequenceNumber, multiCommandFlag) { - // - // - // - // - // - // - // - // - // - // Extended bolus pulses - // Delay between tenth extended pulses in usec override val encoded: ByteArray get() { val bolusCommand = ByteBuffer.allocate(LENGTH.toInt()) // @@ -35,7 +31,7 @@ class ProgramBolusCommand internal constructor(private val interlockCommand: Pro .putInt(0) // Delay between tenth extended pulses in usec .array() val interlockCommand = interlockCommand.encoded - val header: ByteArray = encodeHeader(uniqueId, sequenceNumber, (bolusCommand.size + interlockCommand!!.size).toShort(), multiCommandFlag) + val header: ByteArray = encodeHeader(uniqueId, sequenceNumber, (bolusCommand.size + interlockCommand.size).toShort(), multiCommandFlag) return appendCrc(ByteBuffer.allocate(header.size + interlockCommand.size + bolusCommand.size) // .put(header) // .put(interlockCommand) // diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramInsulinCommand.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramInsulinCommand.kt index a357013027..c3b98f69fc 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramInsulinCommand.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramInsulinCommand.kt @@ -7,7 +7,18 @@ import java.nio.ByteBuffer import java.util.* // Always followed by one of: 0x13, 0x16, 0x17 -class ProgramInsulinCommand(uniqueId: Int, sequenceNumber: Short, multiCommandFlag: Boolean, nonce: Int, insulinProgramElements: List, private val checksum: Short, private val byte9: Byte, private val byte10And11: Short, private val byte12And13: Short, private val deliveryType: DeliveryType) : NonceEnabledCommand(CommandType.PROGRAM_INSULIN, uniqueId, sequenceNumber, multiCommandFlag, nonce) { +class ProgramInsulinCommand( + uniqueId: Int, + sequenceNumber: Short, + multiCommandFlag: Boolean, + nonce: Int, insulinProgramElements: + List, + private val checksum: Short, + private val byte9: Byte, + private val byte10And11: Short, + private val byte12And13: Short, + private val deliveryType: DeliveryType +) : NonceEnabledCommand(CommandType.PROGRAM_INSULIN, uniqueId, sequenceNumber, multiCommandFlag, nonce) { private val insulinProgramElements: List = ArrayList(insulinProgramElements) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommand.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommand.kt index 2e3b9d6624..350136a661 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommand.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramTempBasalCommand.kt @@ -11,8 +11,14 @@ import java.nio.ByteBuffer import java.util.* // NOT SUPPORTED: percentage temp basal -class ProgramTempBasalCommand protected constructor(private val interlockCommand: ProgramInsulinCommand, uniqueId: Int, sequenceNumber: Short, multiCommandFlag: Boolean, - private val programReminder: ProgramReminder, insulinProgramElements: List) : HeaderEnabledCommand(CommandType.PROGRAM_TEMP_BASAL, uniqueId, sequenceNumber, multiCommandFlag) { +class ProgramTempBasalCommand protected constructor( + private val interlockCommand: ProgramInsulinCommand, + uniqueId: Int, + sequenceNumber: Short, + multiCommandFlag: Boolean, + private val programReminder: ProgramReminder, + insulinProgramElements: List +) : HeaderEnabledCommand(CommandType.PROGRAM_TEMP_BASAL, uniqueId, sequenceNumber, multiCommandFlag) { private val insulinProgramElements: List fun getBodyLength(): Byte = (insulinProgramElements.size * 6 + 8).toByte() diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommand.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommand.kt index f475558220..6deb03a6ae 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommand.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommand.kt @@ -6,18 +6,15 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.b import java.nio.ByteBuffer import java.util.* -class SetUniqueIdCommand internal constructor(uniqueId: Int, sequenceNumber: Short, multiCommandFlag: Boolean, private val lotNumber: Int, private val podSequenceNumber: Int, private val initializationTime: Date) : HeaderEnabledCommand(CommandType.SET_UNIQUE_ID, uniqueId, sequenceNumber, multiCommandFlag) { +class SetUniqueIdCommand internal constructor( + uniqueId: Int, + sequenceNumber: Short, + multiCommandFlag: Boolean, + private val lotNumber: Int, + private val podSequenceNumber: Int, + private val initializationTime: Date +) : HeaderEnabledCommand(CommandType.SET_UNIQUE_ID, uniqueId, sequenceNumber, multiCommandFlag) { - // - // - // - // - // - // FIXME ?? - // FIXME ?? - // - // - // override val encoded: ByteArray get() = appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) // .put(encodeHeader(DEFAULT_UNIQUE_ID, sequenceNumber, LENGTH, multiCommandFlag)) // diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommand.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommand.kt index ff7072fca6..5db1c248cc 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommand.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommand.kt @@ -1,14 +1,19 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.CommandType -import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.HeaderEnabledCommand import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.NonceEnabledCommand import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.builder.NonceEnabledCommandBuilder import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.Encodable import java.nio.ByteBuffer import java.util.* -class SilenceAlertsCommand internal constructor(uniqueId: Int, sequenceNumber: Short, multiCommandFlag: Boolean, private val parameters: SilenceAlertCommandParameters, nonce: Int) : NonceEnabledCommand(CommandType.SILENCE_ALERTS, uniqueId, sequenceNumber, multiCommandFlag, nonce) { +class SilenceAlertsCommand internal constructor( + uniqueId: Int, + sequenceNumber: Short, + multiCommandFlag: Boolean, + private val parameters: SilenceAlertCommandParameters, + nonce: Int +) : NonceEnabledCommand(CommandType.SILENCE_ALERTS, uniqueId, sequenceNumber, multiCommandFlag, nonce) { override val encoded: ByteArray get() = diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommand.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommand.kt index 368a630cb5..b74a85dd02 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommand.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommand.kt @@ -1,7 +1,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.CommandType -import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.HeaderEnabledCommand import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.NonceEnabledCommand import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.builder.NonceEnabledCommandBuilder import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.BeepType @@ -9,7 +8,14 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import java.nio.ByteBuffer import java.util.* -class StopDeliveryCommand internal constructor(uniqueId: Int, sequenceNumber: Short, multiCommandFlag: Boolean, private val deliveryType: DeliveryType, private val beepType: BeepType, nonce: Int) : NonceEnabledCommand(CommandType.STOP_DELIVERY, uniqueId, sequenceNumber, multiCommandFlag, nonce) { +class StopDeliveryCommand internal constructor( + uniqueId: Int, + sequenceNumber: Short, + multiCommandFlag: Boolean, + private val deliveryType: DeliveryType, + private val beepType: BeepType, + nonce: Int +) : NonceEnabledCommand(CommandType.STOP_DELIVERY, uniqueId, sequenceNumber, multiCommandFlag, nonce) { override val encoded: ByteArray get() { diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/CommandType.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/CommandType.kt index c3715b32cf..57bd0962c8 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/CommandType.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/CommandType.kt @@ -1,6 +1,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base -enum class CommandType(var value: Byte) { +enum class CommandType( + val value: Byte +) { + SET_UNIQUE_ID(0x03.toByte()), GET_VERSION(0x07.toByte()), GET_STATUS(0x0e.toByte()), diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BasalInsulinProgramElement.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BasalInsulinProgramElement.kt index 7121b43a08..cb700d64f2 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BasalInsulinProgramElement.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BasalInsulinProgramElement.kt @@ -2,13 +2,15 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command. import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.insulin.program.util.ProgramBasalUtil import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.Encodable +import java.io.Serializable import java.nio.ByteBuffer -open class BasalInsulinProgramElement(val startSlotIndex: Byte, val numberOfSlots: Byte, val totalTenthPulses: Short) : Encodable { +open class BasalInsulinProgramElement( + val startSlotIndex: Byte, + val numberOfSlots: Byte, + val totalTenthPulses: Short +) : Encodable, Serializable { - // - // - // override val encoded: ByteArray get() = ByteBuffer.allocate(6) // .putShort(totalTenthPulses) // diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BasalShortInsulinProgramElement.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BasalShortInsulinProgramElement.kt index 691c444ff2..f30c4a8170 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BasalShortInsulinProgramElement.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BasalShortInsulinProgramElement.kt @@ -3,15 +3,12 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command. import java.nio.ByteBuffer import kotlin.experimental.and -class BasalShortInsulinProgramElement(// 4 bits - private val numberOfSlots: Byte, // 10 bits - private val pulsesPerSlot: Short, // - private val extraAlternatePulse: Boolean) : ShortInsulinProgramElement { +class BasalShortInsulinProgramElement( + private val numberOfSlots: Byte, // 4 bits + private val pulsesPerSlot: Short, //10 bits + private val extraAlternatePulse: Boolean +) : ShortInsulinProgramElement { - // - // - // - // override val encoded: ByteArray get() { val firstByte = (numberOfSlots - 1 and 0x0f shl 4 // diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BolusShortInsulinProgramElement.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BolusShortInsulinProgramElement.kt index 65938313ed..6a2948404b 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BolusShortInsulinProgramElement.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/BolusShortInsulinProgramElement.kt @@ -2,7 +2,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command. import java.nio.ByteBuffer -class BolusShortInsulinProgramElement(private val numberOfPulses: Short) : ShortInsulinProgramElement { +class BolusShortInsulinProgramElement( + private val numberOfPulses: Short +) : ShortInsulinProgramElement { override val encoded: ByteArray get() = ByteBuffer.allocate(2).putShort(numberOfPulses).array() diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/CurrentBasalInsulinProgramElement.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/CurrentBasalInsulinProgramElement.kt index 87fe2b083b..04f27cf9bf 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/CurrentBasalInsulinProgramElement.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/CurrentBasalInsulinProgramElement.kt @@ -1,6 +1,12 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.insulin.program -class CurrentBasalInsulinProgramElement(val index: Byte, val delayUntilNextTenthPulseInUsec: Int, val remainingTenthPulses: Short) { +import java.io.Serializable + +class CurrentBasalInsulinProgramElement( + val index: Byte, + val delayUntilNextTenthPulseInUsec: Int, + val remainingTenthPulses: Short +) : Serializable { override fun toString(): String = "CurrentLongInsulinProgramElement{" + "index=" + index + diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/CurrentSlot.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/CurrentSlot.kt index d8667fe04c..49b2af59dc 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/CurrentSlot.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/CurrentSlot.kt @@ -1,6 +1,12 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.insulin.program -class CurrentSlot(val index: Byte, val eighthSecondsRemaining: Short, val pulsesRemaining: Short) { +import java.io.Serializable + +class CurrentSlot( + val index: Byte, + val eighthSecondsRemaining: Short, + val pulsesRemaining: Short +) : Serializable { override fun toString(): String = "CurrentSlot{" + "index=" + index + diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/ShortInsulinProgramElement.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/ShortInsulinProgramElement.kt index b5f01ec3df..2ff92c2c24 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/ShortInsulinProgramElement.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/ShortInsulinProgramElement.kt @@ -1,5 +1,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.insulin.program import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.Encodable +import java.io.Serializable -interface ShortInsulinProgramElement : Encodable \ No newline at end of file +interface ShortInsulinProgramElement : Encodable, Serializable \ No newline at end of file diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/TempBasalInsulinProgramElement.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/TempBasalInsulinProgramElement.kt index fc22bef671..4c58755591 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/TempBasalInsulinProgramElement.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/insulin/program/TempBasalInsulinProgramElement.kt @@ -2,10 +2,12 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command. import java.nio.ByteBuffer -class TempBasalInsulinProgramElement(startSlotIndex: Byte, numberOfSlots: Byte, totalTenthPulses: Short) : BasalInsulinProgramElement(startSlotIndex, numberOfSlots, totalTenthPulses) { +class TempBasalInsulinProgramElement( + startSlotIndex: Byte, + numberOfSlots: Byte, + totalTenthPulses: Short +) : BasalInsulinProgramElement(startSlotIndex, numberOfSlots, totalTenthPulses) { - // - // override val encoded: ByteArray get() { val buffer = ByteBuffer.allocate(6) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlarmType.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlarmType.kt index 6e80e8a676..795ddd19f1 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlarmType.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlarmType.kt @@ -1,6 +1,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition -enum class AlarmType(private val value: Byte) { +enum class AlarmType( + private val value: Byte +) { + NONE(0x00.toByte()), ALARM_PW_FLASH_ERASE(0x01.toByte()), ALARM_PW_FLASH_WRITE(0x02.toByte()), diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlertSlot.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlertSlot.kt index 023502ca03..f38a24d154 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlertSlot.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/AlertSlot.kt @@ -1,6 +1,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition -enum class AlertSlot(val value: Byte) { +enum class AlertSlot( + val value: Byte +) { + AUTO_OFF(0x00.toByte()), MULTI_COMMAND(0x01.toByte()), EXPIRATION_IMMINENT(0x02.toByte()), diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BasalProgram.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BasalProgram.kt index 3b63ee207c..998e599805 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BasalProgram.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BasalProgram.kt @@ -2,7 +2,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definiti import java.util.* -class BasalProgram(segments: List) { +class BasalProgram( + segments: List +) { val segments: MutableList = segments.toMutableList() get() = Collections.unmodifiableList(field) // TODO Adrian: moved method here diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepRepetitionType.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepRepetitionType.kt index f13d6bedc5..402141e875 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepRepetitionType.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/BeepRepetitionType.kt @@ -1,14 +1,14 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition // FIXME names -enum class BeepRepetitionType( // Used in lump of coal alert +enum class BeepRepetitionType( val value: Byte ) { - XXX(0x01.toByte()), // Used in low reservoir alert - XXX2(0x03.toByte()), // Used in user pod expiration alert - XXX3(0x05.toByte()), // Used in pod expiration alert - XXX4(0x06.toByte()), // Used in imminent pod expiration alert - XXX5(0x08.toByte()); + XXX(0x01.toByte()), // Used in lump of coal alert + XXX2(0x03.toByte()), // Used in low reservoir alert + XXX3(0x05.toByte()), // Used in user pod expiration alert + XXX4(0x06.toByte()), // Used in pod expiration alert + XXX5(0x08.toByte()); // Used in imminent pod expiration alert } \ No newline at end of file diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/DeliveryStatus.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/DeliveryStatus.kt index 14d6bc1be7..08915f7f7e 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/DeliveryStatus.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/DeliveryStatus.kt @@ -1,6 +1,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition -enum class DeliveryStatus(private val value: Byte) { +enum class DeliveryStatus( + private val value: Byte +) { + SUSPENDED(0x00.toByte()), BASAL_ACTIVE(0x01.toByte()), TEMP_BASAL_ACTIVE(0x02.toByte()), diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/NakErrorType.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/NakErrorType.kt index 4e45da8667..81bbc53c7c 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/NakErrorType.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/NakErrorType.kt @@ -1,6 +1,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition -enum class NakErrorType(private val value: Byte) { +enum class NakErrorType( + private val value: Byte +) { + FLASH_WRITE(0x01.toByte()), FLASH_ERASE(0x02.toByte()), FLASH_OPERATION(0x03.toByte()), diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/PodStatus.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/PodStatus.kt index 9fc650caa5..cdb6ce9be1 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/PodStatus.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/PodStatus.kt @@ -1,6 +1,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition -enum class PodStatus(private val value: Byte) { +enum class PodStatus( + private val value: Byte +) { + UNINITIALIZED(0x00.toByte()), MFG_TEST(0x01.toByte()), FILLED(0x02.toByte()), diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/ProgramReminder.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/ProgramReminder.kt index 732cfb9e09..09a63370f0 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/ProgramReminder.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/ProgramReminder.kt @@ -1,8 +1,13 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition +import java.io.Serializable import kotlin.experimental.and -class ProgramReminder(private val atStart: Boolean, private val atEnd: Boolean, private val atInterval: Byte) : Encodable { +class ProgramReminder( + private val atStart: Boolean, + private val atEnd: Boolean, + private val atInterval: Byte +) : Encodable, Serializable { override val encoded: ByteArray get() = byteArrayOf(((if (atStart) 1 else 0) shl 7 diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/SoftwareVersion.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/SoftwareVersion.kt index e373a1ba41..da619a0428 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/SoftwareVersion.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/SoftwareVersion.kt @@ -2,7 +2,11 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definiti import java.io.Serializable -data class SoftwareVersion(private val major: Short, private val minor: Short, private val interim: Short) : Serializable { +data class SoftwareVersion( + private val major: Short, + private val minor: Short, + private val interim: Short +) : Serializable { override fun toString(): String { return "$major.$minor.$interim" diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AdditionalStatusResponseBase.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AdditionalStatusResponseBase.kt index 5db0f35b44..414a710723 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AdditionalStatusResponseBase.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AdditionalStatusResponseBase.kt @@ -2,4 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.ResponseType.AdditionalStatusResponseType -open class AdditionalStatusResponseBase internal constructor(val statusResponseType: AdditionalStatusResponseType, encoded: ByteArray) : ResponseBase(ResponseType.ADDITIONAL_STATUS_RESPONSE, encoded) \ No newline at end of file +open class AdditionalStatusResponseBase internal constructor( + val statusResponseType: AdditionalStatusResponseType, + encoded: ByteArray +) : ResponseBase(ResponseType.ADDITIONAL_STATUS_RESPONSE, encoded) \ No newline at end of file diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponse.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponse.kt index cfec51058f..4cce00a1c6 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponse.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/AlarmStatusResponse.kt @@ -8,7 +8,9 @@ import java.nio.ByteBuffer import java.util.* import kotlin.experimental.and -class AlarmStatusResponse(encoded: ByteArray) : AdditionalStatusResponseBase(AdditionalStatusResponseType.ALARM_STATUS, encoded) { +class AlarmStatusResponse( + encoded: ByteArray +) : AdditionalStatusResponseBase(AdditionalStatusResponseType.ALARM_STATUS, encoded) { private val messageType: Byte private val messageLength: Short diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponse.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponse.kt index 03dd1b7549..7e83e64ccf 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponse.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/DefaultStatusResponse.kt @@ -4,7 +4,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus import kotlin.experimental.and -class DefaultStatusResponse(encoded: ByteArray) : ResponseBase(ResponseType.DEFAULT_STATUS_RESPONSE, encoded) { +class DefaultStatusResponse( + encoded: ByteArray +) : ResponseBase(ResponseType.DEFAULT_STATUS_RESPONSE, encoded) { // TODO: Here is a lot of bitshifting that had to be changed. we should go over it. private val messageType: Byte = encoded[0] diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponse.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponse.kt index 8b304dec61..a2090d5e58 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponse.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/NakResponse.kt @@ -3,9 +3,10 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.AlarmType import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.NakErrorType import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus -import java.util.* -class NakResponse(encoded: ByteArray) : ResponseBase(ResponseType.NAK_RESPONSE, encoded) { +class NakResponse( + encoded: ByteArray +) : ResponseBase(ResponseType.NAK_RESPONSE, encoded) { private val messageType: Byte // TODO directly assign here private val messageLength: Short diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponse.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponse.kt index db304337f8..daf867f9fa 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponse.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/response/SetUniqueIdResponse.kt @@ -3,10 +3,10 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.ResponseType.ActivationResponseType import java.nio.ByteBuffer -import java.util.* -import kotlin.experimental.and -class SetUniqueIdResponse(encoded: ByteArray) : ActivationResponseBase(ActivationResponseType.SET_UNIQUE_ID_RESPONSE, encoded) { +class SetUniqueIdResponse( + encoded: ByteArray +) : ActivationResponseBase(ActivationResponseType.SET_UNIQUE_ID_RESPONSE, encoded) { private val messageType: Byte // TODO directly assign here private val messageLength: Short @@ -133,20 +133,20 @@ class SetUniqueIdResponse(encoded: ByteArray) : ActivationResponseBase(Activatio init { messageType = encoded[0] - messageLength = (encoded[1].toInt() and 0xff) .toShort() + messageLength = (encoded[1].toInt() and 0xff).toShort() pulseVolumeInTenThousandthMicroLiter = ByteBuffer.wrap(byteArrayOf(encoded[2], encoded[3])).short - pumpRate = (encoded[4].toInt() and 0xff) .toShort() - primePumpRate = (encoded[5].toInt() and 0xff) .toShort() - numberOfEngagingClutchDrivePulses = (encoded[6].toInt() and 0xff) .toShort() - numberOfPrimePulses = (encoded[7].toInt() and 0xff) .toShort() - podExpirationTimeInHours = (encoded[8].toInt() and 0xff) .toShort() - firmwareVersionMajor = (encoded[9].toInt() and 0xff) .toShort() - firmwareVersionMinor = (encoded[10].toInt() and 0xff) .toShort() - firmwareVersionInterim = (encoded[11].toInt() and 0xff) .toShort() - bleVersionMajor = (encoded[12].toInt() and 0xff) .toShort() - bleVersionMinor = (encoded[13].toInt() and 0xff) .toShort() - bleVersionInterim = (encoded[14].toInt() and 0xff) .toShort() - productId = (encoded[15].toInt() and 0xff) .toShort() + pumpRate = (encoded[4].toInt() and 0xff).toShort() + primePumpRate = (encoded[5].toInt() and 0xff).toShort() + numberOfEngagingClutchDrivePulses = (encoded[6].toInt() and 0xff).toShort() + numberOfPrimePulses = (encoded[7].toInt() and 0xff).toShort() + podExpirationTimeInHours = (encoded[8].toInt() and 0xff).toShort() + firmwareVersionMajor = (encoded[9].toInt() and 0xff).toShort() + firmwareVersionMinor = (encoded[10].toInt() and 0xff).toShort() + firmwareVersionInterim = (encoded[11].toInt() and 0xff).toShort() + bleVersionMajor = (encoded[12].toInt() and 0xff).toShort() + bleVersionMinor = (encoded[13].toInt() and 0xff).toShort() + bleVersionInterim = (encoded[14].toInt() and 0xff).toShort() + productId = (encoded[15].toInt() and 0xff).toShort() podStatus = PodStatus.byValue(encoded[16]) lotNumber = ByteBuffer.wrap(byteArrayOf(0, 0, 0, 0, encoded[17], encoded[18], encoded[19], encoded[20])).long podSequenceNumber = ByteBuffer.wrap(byteArrayOf(0, 0, 0, 0, encoded[21], encoded[22], encoded[23], encoded[24])).long