Rename ConfigurePod* classes to SetupPod*
This commit is contained in:
parent
836bc62c65
commit
355b833cb2
|
@ -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));
|
||||
|
|
|
@ -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<VersionResponse> {
|
||||
public class SetupPodAction implements OmnipodAction<VersionResponse> {
|
||||
private final PodSessionState podState;
|
||||
|
||||
public ConfigurePodAction(PodSessionState podState) {
|
||||
public SetupPodAction(PodSessionState podState) {
|
||||
this.podState = podState;
|
||||
}
|
||||
|
||||
|
@ -31,13 +31,13 @@ public class ConfigurePodAction implements OmnipodAction<VersionResponse> {
|
|||
}
|
||||
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<VersionResponse> {
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -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 +
|
|
@ -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
|
Loading…
Reference in a new issue