diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java index 8a461d5b31..4e64ef6092 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/OmnipodManager.java @@ -15,7 +15,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.AcknowledgeAl import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.AssignAddressAction; import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.BolusAction; import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.CancelDeliveryAction; -import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.ConfigurePodAction; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.SetupPodAction; import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.DeactivatePodAction; import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.GetPodInfoAction; import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.GetStatusAction; @@ -93,7 +93,7 @@ public class OmnipodManager { } if (SetupProgress.ADDRESS_ASSIGNED.equals(podState.getSetupProgress())) { - communicationService.executeAction(new ConfigurePodAction(podState)); + communicationService.executeAction(new SetupPodAction(podState)); } communicationService.executeAction(new PrimeAction(new PrimeService(), podState)); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/ConfigurePodAction.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/SetupPodAction.java similarity index 75% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/ConfigurePodAction.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/SetupPodAction.java index 9ac2ccc74e..2a6135e9ab 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/ConfigurePodAction.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/action/SetupPodAction.java @@ -6,7 +6,7 @@ import java.util.Collections; import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage; -import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.ConfigurePodCommand; +import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.SetupPodCommand; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.VersionResponse; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PacketType; import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodProgressStatus; @@ -17,10 +17,10 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPod import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSetupProgressException; import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst; -public class ConfigurePodAction implements OmnipodAction { +public class SetupPodAction implements OmnipodAction { private final PodSessionState podState; - public ConfigurePodAction(PodSessionState podState) { + public SetupPodAction(PodSessionState podState) { this.podState = podState; } @@ -31,13 +31,13 @@ public class ConfigurePodAction implements OmnipodAction { } DateTime activationDate = DateTime.now(podState.getTimeZone()); - ConfigurePodCommand configurePodCommand = new ConfigurePodCommand(podState.getAddress(), activationDate, + SetupPodCommand setupPodCommand = new SetupPodCommand(podState.getAddress(), activationDate, podState.getLot(), podState.getTid()); OmnipodMessage message = new OmnipodMessage(OmnipodConst.DEFAULT_ADDRESS, - Collections.singletonList(configurePodCommand), podState.getMessageNumber()); - VersionResponse configurePodResponse; + Collections.singletonList(setupPodCommand), podState.getMessageNumber()); + VersionResponse setupPodResponse; try { - configurePodResponse = communicationService.exchangeMessages(VersionResponse.class, podState, + setupPodResponse = communicationService.exchangeMessages(VersionResponse.class, podState, message, OmnipodConst.DEFAULT_ADDRESS, podState.getAddress()); } catch (IllegalPacketTypeException ex) { if (PacketType.ACK.equals(ex.getActual())) { @@ -48,12 +48,12 @@ public class ConfigurePodAction implements OmnipodAction { throw ex; } - if (configurePodResponse.getPodProgressStatus() != PodProgressStatus.PAIRING_SUCCESS) { - throw new IllegalPodProgressException(PodProgressStatus.PAIRING_SUCCESS, configurePodResponse.getPodProgressStatus()); + if (setupPodResponse.getPodProgressStatus() != PodProgressStatus.PAIRING_SUCCESS) { + throw new IllegalPodProgressException(PodProgressStatus.PAIRING_SUCCESS, setupPodResponse.getPodProgressStatus()); } podState.setSetupProgress(SetupProgress.POD_CONFIGURED); - return configurePodResponse; + return setupPodResponse; } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/ConfigurePodCommand.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetupPodCommand.java similarity index 90% rename from app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/ConfigurePodCommand.java rename to app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetupPodCommand.java index 0f35a1fa24..7ef667d5b6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/ConfigurePodCommand.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetupPodCommand.java @@ -6,7 +6,7 @@ import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock; import info.nightscout.androidaps.plugins.pump.omnipod.defs.MessageBlockType; -public class ConfigurePodCommand extends MessageBlock { +public class SetupPodCommand extends MessageBlock { private static final byte PACKET_TIMEOUT_LIMIT = 0x04; @@ -15,7 +15,7 @@ public class ConfigurePodCommand extends MessageBlock { private final DateTime date; private final int address; - public ConfigurePodCommand(int address, DateTime date, int lot, int tid) { + public SetupPodCommand(int address, DateTime date, int lot, int tid) { this.address = address; this.lot = lot; this.tid = tid; @@ -46,7 +46,7 @@ public class ConfigurePodCommand extends MessageBlock { @Override public String toString() { - return "ConfigurePodCommand{" + + return "SetupPodCommand{" + "lot=" + lot + ", tid=" + tid + ", date=" + date + diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/ConfigurePodCommandTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetupPodCommandTest.java similarity index 79% rename from app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/ConfigurePodCommandTest.java rename to app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetupPodCommandTest.java index f553bfbc0a..461b351473 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/ConfigurePodCommandTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/command/SetupPodCommandTest.java @@ -7,10 +7,10 @@ import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil; import static org.junit.Assert.assertArrayEquals; -public class ConfigurePodCommandTest { +public class SetupPodCommandTest { @Test public void testEncoding() { - ConfigurePodCommand configurePodCommand = new ConfigurePodCommand( // + SetupPodCommand setupPodCommand = new SetupPodCommand( // 0x1f00ee87, // new DateTime(2013, 4, 5, 22, 52, 0), // 41847, // @@ -18,7 +18,7 @@ public class ConfigurePodCommandTest { assertArrayEquals( // ByteUtil.fromHexString("03131f00ee87140404050d16340000a3770003ab37"), // From https://github.com/openaps/openomni/wiki/Command-03-Setup-Pod - configurePodCommand.getRawData()); + setupPodCommand.getRawData()); } // TODO add tests