diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.java index 784e95b40b..3f6ce6d099 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/DeactivateCommand.java @@ -10,13 +10,13 @@ public final class DeactivateCommand extends NonceEnabledCommand { private static final short LENGTH = 6; private static final byte BODY_LENGTH = 4; - DeactivateCommand(int address, short sequenceNumber, boolean multiCommandFlag, int nonce) { - super(CommandType.DEACTIVATE, address, sequenceNumber, multiCommandFlag, nonce); + DeactivateCommand(int uniqueId, short sequenceNumber, boolean multiCommandFlag, int nonce) { + super(CommandType.DEACTIVATE, uniqueId, sequenceNumber, multiCommandFlag, nonce); } @Override public byte[] getEncoded() { return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) // - .put(encodeHeader(address, sequenceNumber, LENGTH, multiCommandFlag)) // + .put(encodeHeader(uniqueId, sequenceNumber, LENGTH, multiCommandFlag)) // .put(commandType.getValue()) // .put(BODY_LENGTH) // .putInt(nonce) // @@ -25,8 +25,9 @@ public final class DeactivateCommand extends NonceEnabledCommand { @Override public String toString() { return "DeactivateCommand{" + - "commandType=" + commandType + - ", address=" + address + + "nonce=" + nonce + + ", commandType=" + commandType + + ", uniqueId=" + uniqueId + ", sequenceNumber=" + sequenceNumber + ", multiCommandFlag=" + multiCommandFlag + '}'; @@ -34,7 +35,7 @@ public final class DeactivateCommand extends NonceEnabledCommand { public static final class Builder extends NonceEnabledCommandBuilder { @Override protected final DeactivateCommand buildCommand() { - return new DeactivateCommand(Builder.this.address, sequenceNumber, multiCommandFlag, nonce); + return new DeactivateCommand(uniqueId, sequenceNumber, multiCommandFlag, nonce); } } } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.java index e8cc704efa..4fce0c11a2 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/GetVersionCommand.java @@ -7,28 +7,28 @@ 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; public final class GetVersionCommand extends HeaderEnabledCommand { - public static final int DEFAULT_ADDRESS = -1; // FIXME move + public static final int DEFAULT_UNIQUE_ID = -1; // FIXME move private static final short LENGTH = 6; private static final byte BODY_LENGTH = 4; - GetVersionCommand(int address, short sequenceNumber, boolean multiCommandFlag) { - super(CommandType.GET_VERSION, address, sequenceNumber, multiCommandFlag); + GetVersionCommand(int uniqueId, short sequenceNumber, boolean multiCommandFlag) { + super(CommandType.GET_VERSION, uniqueId, sequenceNumber, multiCommandFlag); } @Override public byte[] getEncoded() { return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) // - .put(encodeHeader(address, sequenceNumber, LENGTH, multiCommandFlag)) // + .put(encodeHeader(uniqueId, sequenceNumber, LENGTH, multiCommandFlag)) // .put(commandType.getValue()) // .put(BODY_LENGTH) // - .putInt(address) // + .putInt(uniqueId) // .array()); } @Override public String toString() { return "GetVersionCommand{" + "commandType=" + commandType + - ", address=" + address + + ", uniqueId=" + uniqueId + ", sequenceNumber=" + sequenceNumber + ", multiCommandFlag=" + multiCommandFlag + '}'; @@ -36,7 +36,7 @@ public final class GetVersionCommand extends HeaderEnabledCommand { public static final class Builder extends HeaderEnabledCommandBuilder { @Override protected final GetVersionCommand buildCommand() { - return new GetVersionCommand(address, sequenceNumber, multiCommandFlag); + return new GetVersionCommand(uniqueId, sequenceNumber, multiCommandFlag); } } } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommand.java index 30150a086e..39e850736a 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramAlertsCommand.java @@ -12,14 +12,14 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio public final class ProgramAlertsCommand extends NonceEnabledCommand { private final List alertConfigurations; - ProgramAlertsCommand(int address, short sequenceNumber, boolean multiCommandFlag, List alertConfigurations, int nonce) { - super(CommandType.PROGRAM_ALERTS, address, sequenceNumber, multiCommandFlag, nonce); + ProgramAlertsCommand(int uniqueId, short sequenceNumber, boolean multiCommandFlag, List alertConfigurations, int nonce) { + super(CommandType.PROGRAM_ALERTS, uniqueId, sequenceNumber, multiCommandFlag, nonce); this.alertConfigurations = new ArrayList<>(alertConfigurations); } @Override public byte[] getEncoded() { ByteBuffer byteBuffer = ByteBuffer.allocate(getLength() + HEADER_LENGTH) // - .put(encodeHeader(address, sequenceNumber, getLength(), multiCommandFlag)) // + .put(encodeHeader(uniqueId, sequenceNumber, getLength(), multiCommandFlag)) // .put(commandType.getValue()) // .put(getBodyLength()) // .putInt(nonce); @@ -40,8 +40,9 @@ public final class ProgramAlertsCommand extends NonceEnabledCommand { @Override public String toString() { return "ProgramAlertsCommand{" + "alertConfigurations=" + alertConfigurations + + ", nonce=" + nonce + ", commandType=" + commandType + - ", address=" + address + + ", uniqueId=" + uniqueId + ", sequenceNumber=" + sequenceNumber + ", multiCommandFlag=" + multiCommandFlag + '}'; @@ -59,7 +60,7 @@ public final class ProgramAlertsCommand extends NonceEnabledCommand { if (this.alertConfigurations == null) { throw new IllegalArgumentException("alertConfigurations can not be null"); } - return new ProgramAlertsCommand(address, sequenceNumber, multiCommandFlag, alertConfigurations, nonce); + return new ProgramAlertsCommand(uniqueId, sequenceNumber, multiCommandFlag, alertConfigurations, nonce); } } } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommand.java index 7bfb50747e..e111113d81 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramBasalCommand.java @@ -25,8 +25,8 @@ public final class ProgramBasalCommand extends HeaderEnabledCommand { private final short remainingTenthPulsesInCurrentInsulinProgramElement; private final int delayUntilNextTenthPulseInUsec; - ProgramBasalCommand(ProgramInsulinCommand interlockCommand, int address, short sequenceNumber, boolean multiCommandFlag, List insulinProgramElements, ProgramReminder programReminder, byte currentInsulinProgramElementIndex, short remainingTenthPulsesInCurrentInsulinProgramElement, int delayUntilNextTenthPulseInUsec) { - super(CommandType.PROGRAM_BASAL, address, sequenceNumber, multiCommandFlag); + ProgramBasalCommand(ProgramInsulinCommand interlockCommand, int uniqueId, short sequenceNumber, boolean multiCommandFlag, List insulinProgramElements, ProgramReminder programReminder, byte currentInsulinProgramElementIndex, short remainingTenthPulsesInCurrentInsulinProgramElement, int delayUntilNextTenthPulseInUsec) { + super(CommandType.PROGRAM_BASAL, uniqueId, sequenceNumber, multiCommandFlag); this.interlockCommand = interlockCommand; this.insulinProgramElements = new ArrayList<>(insulinProgramElements); @@ -58,7 +58,7 @@ public final class ProgramBasalCommand extends HeaderEnabledCommand { byte[] bolusCommand = buffer.array(); byte[] interlockCommand = this.interlockCommand.getEncoded(); - byte[] header = encodeHeader(address, sequenceNumber, (short) (bolusCommand.length + interlockCommand.length), multiCommandFlag); + byte[] header = encodeHeader(uniqueId, sequenceNumber, (short) (bolusCommand.length + interlockCommand.length), multiCommandFlag); return ByteBuffer.allocate(bolusCommand.length + interlockCommand.length + header.length) // .put(header) // @@ -76,7 +76,7 @@ public final class ProgramBasalCommand extends HeaderEnabledCommand { ", remainingTenthPulsesInCurrentInsulinProgramElement=" + remainingTenthPulsesInCurrentInsulinProgramElement + ", delayUntilNextTenthPulseInUsec=" + delayUntilNextTenthPulseInUsec + ", commandType=" + commandType + - ", address=" + address + + ", uniqueId=" + uniqueId + ", sequenceNumber=" + sequenceNumber + ", multiCommandFlag=" + multiCommandFlag + '}'; @@ -115,16 +115,16 @@ public final class ProgramBasalCommand extends HeaderEnabledCommand { short[] pulsesPerSlot = ProgramBasalUtil.mapBasalProgramToPulsesPerSlot(basalProgram); CurrentSlot currentSlot = ProgramBasalUtil.calculateCurrentSlot(pulsesPerSlot, currentTime); + short checksum = ProgramBasalUtil.createChecksum(pulsesPerSlot, currentSlot); List longInsulinProgramElements = ProgramBasalUtil.mapPulsesPerSlotToLongInsulinProgramElements(pulsesPerSlot); List shortInsulinProgramElements = ProgramBasalUtil.mapPulsesPerSlotToShortInsulinProgramElements(pulsesPerSlot); - short checksum = ProgramBasalUtil.createChecksum(); CurrentLongInsulinProgramElement currentLongInsulinProgramElement = ProgramBasalUtil.calculateCurrentLongInsulinProgramElement(longInsulinProgramElements, currentTime); - ProgramInsulinCommand interlockCommand = new ProgramInsulinCommand(address, sequenceNumber, multiCommandFlag, nonce, + ProgramInsulinCommand interlockCommand = new ProgramInsulinCommand(uniqueId, sequenceNumber, multiCommandFlag, nonce, shortInsulinProgramElements, currentSlot.getIndex(), checksum, (short) (currentSlot.getEighthSecondsRemaining() * 8), currentSlot.getPulsesRemaining(), ProgramInsulinCommand.DeliveryType.BASAL); - return new ProgramBasalCommand(interlockCommand, address, sequenceNumber, multiCommandFlag, + return new ProgramBasalCommand(interlockCommand, uniqueId, sequenceNumber, multiCommandFlag, longInsulinProgramElements, programReminder, currentLongInsulinProgramElement.getIndex(), currentLongInsulinProgramElement.getRemainingTenthPulses(), currentLongInsulinProgramElement.getDelayUntilNextTenthPulseInUsec()); } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramInsulinCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramInsulinCommand.java index 6046e17a57..601d8a6122 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramInsulinCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/ProgramInsulinCommand.java @@ -17,8 +17,8 @@ final class ProgramInsulinCommand extends NonceEnabledCommand { private final short remainingPulsesInCurrentSlot; private final DeliveryType deliveryType; - ProgramInsulinCommand(int address, short sequenceNumber, boolean multiCommandFlag, int nonce, List insulinProgramElements, byte currentSlot, short checksum, short remainingEighthSecondsInCurrentSlot, short remainingPulsesInCurrentSlot, DeliveryType deliveryType) { - super(CommandType.PROGRAM_INSULIN, address, sequenceNumber, multiCommandFlag, nonce); + ProgramInsulinCommand(int uniqueId, short sequenceNumber, boolean multiCommandFlag, int nonce, List insulinProgramElements, byte currentSlot, short checksum, short remainingEighthSecondsInCurrentSlot, short remainingPulsesInCurrentSlot, DeliveryType deliveryType) { + super(CommandType.PROGRAM_INSULIN, uniqueId, sequenceNumber, multiCommandFlag, nonce); this.insulinProgramElements = new ArrayList<>(insulinProgramElements); this.currentSlot = currentSlot; this.checksum = checksum; @@ -79,7 +79,7 @@ final class ProgramInsulinCommand extends NonceEnabledCommand { ", deliveryType=" + deliveryType + ", nonce=" + nonce + ", commandType=" + commandType + - ", address=" + address + + ", uniqueId=" + uniqueId + ", sequenceNumber=" + sequenceNumber + ", multiCommandFlag=" + multiCommandFlag + '}'; diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommand.java index bdf7c0fe05..d43a5fb4be 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SetUniqueIdCommand.java @@ -9,7 +9,7 @@ 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; public final class SetUniqueIdCommand extends HeaderEnabledCommand { - private static final int DEFAULT_ADDRESS = -1; + private static final int DEFAULT_UNIQUE_ID = -1; private static final short LENGTH = 21; private static final byte BODY_LENGTH = 19; @@ -17,8 +17,8 @@ public final class SetUniqueIdCommand extends HeaderEnabledCommand { private final int podSequenceNumber; private final Date initializationTime; - SetUniqueIdCommand(int address, short sequenceNumber, boolean multiCommandFlag, int lotNumber, int podSequenceNumber, Date initializationTime) { - super(CommandType.SET_UNIQUE_ID, address, sequenceNumber, multiCommandFlag); + SetUniqueIdCommand(int uniqueId, short sequenceNumber, boolean multiCommandFlag, int lotNumber, int podSequenceNumber, Date initializationTime) { + super(CommandType.SET_UNIQUE_ID, uniqueId, sequenceNumber, multiCommandFlag); this.lotNumber = lotNumber; this.podSequenceNumber = podSequenceNumber; this.initializationTime = initializationTime; @@ -26,10 +26,10 @@ public final class SetUniqueIdCommand extends HeaderEnabledCommand { @Override public byte[] getEncoded() { return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) // - .put(encodeHeader(DEFAULT_ADDRESS, sequenceNumber, LENGTH, multiCommandFlag)) // + .put(encodeHeader(DEFAULT_UNIQUE_ID, sequenceNumber, LENGTH, multiCommandFlag)) // .put(commandType.getValue()) // .put(BODY_LENGTH) // - .putInt(address) // + .putInt(uniqueId) // .put((byte) 0x14) // FIXME ?? .put((byte) 0x04) // FIXME ?? .put(encodeInitializationTime(initializationTime)) // @@ -57,7 +57,7 @@ public final class SetUniqueIdCommand extends HeaderEnabledCommand { ", podSequenceNumber=" + podSequenceNumber + ", initializationTime=" + initializationTime + ", commandType=" + commandType + - ", address=" + address + + ", uniqueId=" + uniqueId + ", sequenceNumber=" + sequenceNumber + ", multiCommandFlag=" + multiCommandFlag + '}'; @@ -93,7 +93,7 @@ public final class SetUniqueIdCommand extends HeaderEnabledCommand { if (initializationTime == null) { throw new IllegalArgumentException("initializationTime can not be null"); } - return new SetUniqueIdCommand(address, sequenceNumber, multiCommandFlag, lotNumber, podSequenceNumber, initializationTime); + return new SetUniqueIdCommand(uniqueId, sequenceNumber, multiCommandFlag, lotNumber, podSequenceNumber, initializationTime); } } } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommand.java index 9fe21103f3..77341967fa 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/SilenceAlertsCommand.java @@ -14,14 +14,14 @@ public final class SilenceAlertsCommand extends NonceEnabledCommand { private final SilenceAlertCommandParameters parameters; - SilenceAlertsCommand(int address, short sequenceNumber, boolean multiCommandFlag, SilenceAlertCommandParameters parameters, int nonce) { - super(CommandType.SILENCE_ALERTS, address, sequenceNumber, multiCommandFlag, nonce); + SilenceAlertsCommand(int uniqueId, short sequenceNumber, boolean multiCommandFlag, SilenceAlertCommandParameters parameters, int nonce) { + super(CommandType.SILENCE_ALERTS, uniqueId, sequenceNumber, multiCommandFlag, nonce); this.parameters = parameters; } @Override public byte[] getEncoded() { return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) // - .put(encodeHeader(address, sequenceNumber, LENGTH, multiCommandFlag)) // + .put(encodeHeader(uniqueId, sequenceNumber, LENGTH, multiCommandFlag)) // .put(commandType.getValue()) // .put(BODY_LENGTH) // .putInt(nonce) // @@ -32,8 +32,9 @@ public final class SilenceAlertsCommand extends NonceEnabledCommand { @Override public String toString() { return "SilenceAlertsCommand{" + "parameters=" + parameters + + ", nonce=" + nonce + ", commandType=" + commandType + - ", address=" + address + + ", uniqueId=" + uniqueId + ", sequenceNumber=" + sequenceNumber + ", multiCommandFlag=" + multiCommandFlag + '}'; @@ -126,7 +127,7 @@ public final class SilenceAlertsCommand extends NonceEnabledCommand { } @Override protected final SilenceAlertsCommand buildCommand() { - return new SilenceAlertsCommand(address, sequenceNumber, multiCommandFlag, new SilenceAlertCommandParameters(silenceAutoOffAlert, silenceMultiCommandAlert, silenceExpirationImminentAlert, silenceUserSetExpirationAlert, silenceLowReservoirAlert, silenceSuspendInProgressAlert, silenceSuspendEndedAlert, silencePodExpirationAlert), nonce); + return new SilenceAlertsCommand(uniqueId, sequenceNumber, multiCommandFlag, new SilenceAlertCommandParameters(silenceAutoOffAlert, silenceMultiCommandAlert, silenceExpirationImminentAlert, silenceUserSetExpirationAlert, silenceLowReservoirAlert, silenceSuspendInProgressAlert, silenceSuspendEndedAlert, silencePodExpirationAlert), nonce); } } } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommand.java index db6bf0d29f..9c539c3b4a 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/StopDeliveryCommand.java @@ -16,15 +16,15 @@ public final class StopDeliveryCommand extends NonceEnabledCommand { private final DeliveryType deliveryType; private final BeepType beepType; - StopDeliveryCommand(int address, short sequenceNumber, boolean multiCommandFlag, DeliveryType deliveryType, BeepType beepType, int nonce) { - super(CommandType.STOP_DELIVERY, address, sequenceNumber, multiCommandFlag, nonce); + StopDeliveryCommand(int uniqueId, short sequenceNumber, boolean multiCommandFlag, DeliveryType deliveryType, BeepType beepType, int nonce) { + super(CommandType.STOP_DELIVERY, uniqueId, sequenceNumber, multiCommandFlag, nonce); this.deliveryType = deliveryType; this.beepType = beepType; } @Override public byte[] getEncoded() { return appendCrc(ByteBuffer.allocate(LENGTH + HEADER_LENGTH) // - .put(encodeHeader(address, sequenceNumber, LENGTH, multiCommandFlag)) // + .put(encodeHeader(uniqueId, sequenceNumber, LENGTH, multiCommandFlag)) // .put(commandType.getValue()) // .put(BODY_LENGTH) // .putInt(nonce) // @@ -36,8 +36,9 @@ public final class StopDeliveryCommand extends NonceEnabledCommand { return "StopDeliveryCommand{" + "deliveryType=" + deliveryType + ", beepType=" + beepType + + ", nonce=" + nonce + ", commandType=" + commandType + - ", address=" + address + + ", uniqueId=" + uniqueId + ", sequenceNumber=" + sequenceNumber + ", multiCommandFlag=" + multiCommandFlag + '}'; @@ -89,7 +90,7 @@ public final class StopDeliveryCommand extends NonceEnabledCommand { if (beepType == null) { throw new IllegalArgumentException("beepType can not be null"); } - return new StopDeliveryCommand(address, sequenceNumber, multiCommandFlag, deliveryType, beepType, nonce); + return new StopDeliveryCommand(uniqueId, sequenceNumber, multiCommandFlag, deliveryType, beepType, nonce); } } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/HeaderEnabledCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/HeaderEnabledCommand.java index 219dc48724..6a84f37d7f 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/HeaderEnabledCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/HeaderEnabledCommand.java @@ -8,13 +8,13 @@ public abstract class HeaderEnabledCommand implements Command { protected static final short HEADER_LENGTH = 6; protected final CommandType commandType; - protected final int address; + protected final int uniqueId; protected final short sequenceNumber; protected final boolean multiCommandFlag; - protected HeaderEnabledCommand(CommandType commandType, int address, short sequenceNumber, boolean multiCommandFlag) { + protected HeaderEnabledCommand(CommandType commandType, int uniqueId, short sequenceNumber, boolean multiCommandFlag) { this.commandType = commandType; - this.address = address; + this.uniqueId = uniqueId; this.sequenceNumber = sequenceNumber; this.multiCommandFlag = multiCommandFlag; } @@ -30,9 +30,9 @@ public abstract class HeaderEnabledCommand implements Command { .array(); } - protected static byte[] encodeHeader(int address, short sequenceNumber, short length, boolean multiCommandFlag) { + protected static byte[] encodeHeader(int uniqueId, short sequenceNumber, short length, boolean multiCommandFlag) { return ByteBuffer.allocate(6) // - .putInt(address) // + .putInt(uniqueId) // .putShort((short) (((sequenceNumber & 0x0f) << 10) | length | ((multiCommandFlag ? 1 : 0) << 15))) // .array(); } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/NonceEnabledCommand.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/NonceEnabledCommand.java index 16a136601b..744f7eb1e9 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/NonceEnabledCommand.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/NonceEnabledCommand.java @@ -3,8 +3,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command. public abstract class NonceEnabledCommand extends HeaderEnabledCommand { protected final int nonce; - protected NonceEnabledCommand(CommandType commandType, int address, short sequenceNumber, boolean multiCommandFlag, int nonce) { - super(commandType, address, sequenceNumber, multiCommandFlag); + protected NonceEnabledCommand(CommandType commandType, int uniqueId, short sequenceNumber, boolean multiCommandFlag, int nonce) { + super(commandType, uniqueId, sequenceNumber, multiCommandFlag); this.nonce = nonce; } diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/builder/HeaderEnabledCommandBuilder.java b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/builder/HeaderEnabledCommandBuilder.java index 92d1f50c92..30dc425cb8 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/builder/HeaderEnabledCommandBuilder.java +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/command/base/builder/HeaderEnabledCommandBuilder.java @@ -3,13 +3,13 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command. import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.Command; public abstract class HeaderEnabledCommandBuilder, R extends Command> implements CommandBuilder { - protected Integer address; + protected Integer uniqueId; protected Short sequenceNumber; protected boolean multiCommandFlag = false; public R build() { - if (address == null) { - throw new IllegalArgumentException("address can not be null"); + if (uniqueId == null) { + throw new IllegalArgumentException("uniqueId can not be null"); } if (sequenceNumber == null) { throw new IllegalArgumentException("sequenceNumber can not be null"); @@ -17,8 +17,8 @@ public abstract class HeaderEnabledCommandBuilder