Merge branch 'omnipod_eros_dev' of https://github.com/AAPS-Omnipod/AndroidAPS into omnipod_eros_dev

This commit is contained in:
Andy Rozman 2020-04-22 12:53:02 +01:00
commit 37590338ff
7 changed files with 1 additions and 157 deletions

View file

@ -1,50 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
public class PodInfoLowFlashLogDump extends PodInfo {
private static final int MINIMUM_MESSAGE_LENGTH = 8;
private final byte numberOfBytes;
private final byte[] dataFromFlashMemory;
private final int podAddress;
public PodInfoLowFlashLogDump(byte[] encodedData) {
super(encodedData);
if (encodedData.length < MINIMUM_MESSAGE_LENGTH) {
throw new IllegalArgumentException("Not enough data");
}
numberOfBytes = encodedData[2];
podAddress = ByteUtil.toInt((int) encodedData[3], (int) encodedData[4], (int) encodedData[5], (int) encodedData[6], ByteUtil.BitConversion.BIG_ENDIAN);
dataFromFlashMemory = ByteUtil.substring(encodedData, 3, ByteUtil.convertUnsignedByteToInt(encodedData[2]));
}
@Override
public PodInfoType getType() {
return PodInfoType.LOW_FLASH_DUMP_LOG;
}
public byte getNumberOfBytes() {
return numberOfBytes;
}
public byte[] getDataFromFlashMemory() {
return dataFromFlashMemory;
}
public int getPodAddress() {
return podAddress;
}
@Override
public String toString() {
return "PodInfoLowFlashLogDump{" +
"numberOfBytes=" + numberOfBytes +
", dataFromFlashMemory=" + ByteUtil.shortHexString(dataFromFlashMemory) +
", podAddress=" + podAddress +
'}';
}
}

View file

@ -1,55 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
public class PodInfoTestValues extends PodInfo {
private static final int MINIMUM_MESSAGE_LENGTH = 5;
private final byte byte1;
private final byte byte2;
private final byte byte3;
private final byte byte4;
public PodInfoTestValues(byte[] encodedData) {
super(encodedData);
if (encodedData.length < MINIMUM_MESSAGE_LENGTH) {
throw new IllegalArgumentException("Not enough data");
}
byte1 = encodedData[1];
byte2 = encodedData[2];
byte3 = encodedData[3];
byte4 = encodedData[4];
}
@Override
public PodInfoType getType() {
return PodInfoType.HARDCODED_TEST_VALUES;
}
public byte getByte1() {
return byte1;
}
public byte getByte2() {
return byte2;
}
public byte getByte3() {
return byte3;
}
public byte getByte4() {
return byte4;
}
@Override
public String toString() {
return "PodInfoTestValues{" +
"byte1=" + byte1 +
", byte2=" + byte2 +
", byte3=" + byte3 +
", byte4=" + byte4 +
'}';
}
}

View file

@ -5,10 +5,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.pod
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoDataLog; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoDataLog;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultAndInitializationTime; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultAndInitializationTime;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoLowFlashLogDump;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoOlderPulseLog; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoOlderPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog; import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoTestValues;
public enum PodInfoType { public enum PodInfoType {
NORMAL((byte) 0x00), NORMAL((byte) 0x00),
@ -16,8 +14,6 @@ public enum PodInfoType {
FAULT_EVENT((byte) 0x02), FAULT_EVENT((byte) 0x02),
DATA_LOG((byte) 0x03), // Similar to types $50 & $51. Returns up to the last 60 dwords of data. DATA_LOG((byte) 0x03), // Similar to types $50 & $51. Returns up to the last 60 dwords of data.
FAULT_AND_INITIALIZATION_TIME((byte) 0x05), FAULT_AND_INITIALIZATION_TIME((byte) 0x05),
HARDCODED_TEST_VALUES((byte) 0x06),
LOW_FLASH_DUMP_LOG((byte) 0x46), // Starting at $4000
RECENT_PULSE_LOG((byte) 0x50), // Starting at $4200 RECENT_PULSE_LOG((byte) 0x50), // Starting at $4200
OLDER_PULSE_LOG((byte) 0x51); // Starting at $4200 but dumps entries before the last 50 OLDER_PULSE_LOG((byte) 0x51); // Starting at $4200 but dumps entries before the last 50
@ -54,10 +50,6 @@ public enum PodInfoType {
return new PodInfoDataLog(encodedData, bodyLength); return new PodInfoDataLog(encodedData, bodyLength);
case FAULT_AND_INITIALIZATION_TIME: case FAULT_AND_INITIALIZATION_TIME:
return new PodInfoFaultAndInitializationTime(encodedData); return new PodInfoFaultAndInitializationTime(encodedData);
case HARDCODED_TEST_VALUES:
return new PodInfoTestValues(encodedData);
case LOW_FLASH_DUMP_LOG:
return new PodInfoLowFlashLogDump(encodedData);
case RECENT_PULSE_LOG: case RECENT_PULSE_LOG:
return new PodInfoRecentPulseLog(encodedData, bodyLength); return new PodInfoRecentPulseLog(encodedData, bodyLength);
case OLDER_PULSE_LOG: case OLDER_PULSE_LOG:

View file

@ -28,11 +28,4 @@ public class GetStatusCommandTest {
assertArrayEquals(ByteUtil.fromHexString("0e0102"), getStatusCommand.getRawData()); assertArrayEquals(ByteUtil.fromHexString("0e0102"), getStatusCommand.getRawData());
} }
@Test
public void testPodInfoTypeResetStatus() {
GetStatusCommand getStatusCommand = new GetStatusCommand(PodInfoType.LOW_FLASH_DUMP_LOG);
assertArrayEquals(ByteUtil.fromHexString("0e0146"), getStatusCommand.getRawData());
}
} }

View file

@ -176,7 +176,7 @@ public class SetInsulinScheduleCommandTest {
new BasalScheduleEntry(0.5, Duration.standardMinutes(510)), // new BasalScheduleEntry(0.5, Duration.standardMinutes(510)), //
new BasalScheduleEntry(0.65, Duration.standardMinutes(570)), // new BasalScheduleEntry(0.65, Duration.standardMinutes(570)), //
new BasalScheduleEntry(0.15, Duration.standardMinutes(930)), // new BasalScheduleEntry(0.15, Duration.standardMinutes(930)), //
new BasalScheduleEntry(0.8, Duration.standardMinutes(978)) // new BasalScheduleEntry(0.8, Duration.standardMinutes(990)) //
); );
BasalSchedule basalSchedule = new BasalSchedule(entries); BasalSchedule basalSchedule = new BasalSchedule(entries);

View file

@ -1,17 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
import org.junit.Test;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import static org.junit.Assert.assertEquals;
public class PodInfoLowFlashLogDumpTest {
@Test
public void testDecoding() {
PodInfoLowFlashLogDump podInfoLowFlashLogDump = new PodInfoLowFlashLogDump(ByteUtil.fromHexString("4600791f00ee841f00ee84ff00ff00ffffffffffff0000ffffffffffffffffffffffff04060d10070000a62b0004e3db0000ffffffffffffff32cd50af0ff014eb01fe01fe06f9ff00ff0002fd649b14eb14eb07f83cc332cd05fa02fd58a700ffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/PodInfoTests.swift
assertEquals(121, podInfoLowFlashLogDump.getNumberOfBytes());
assertEquals(0x1f00ee84, podInfoLowFlashLogDump.getPodAddress());
}
}

View file

@ -1,19 +0,0 @@
package info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo;
import org.junit.Test;
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
import static org.junit.Assert.assertEquals;
public class PodInfoTestValuesTest {
@Test
public void testDecoding() {
PodInfoTestValues podInfoTestValues = new PodInfoTestValues(ByteUtil.fromHexString("0601003FA8"));
assertEquals((byte) 0x01, podInfoTestValues.getByte1());
assertEquals((byte) 0x00, podInfoTestValues.getByte2());
assertEquals((byte) 0x3f, podInfoTestValues.getByte3());
assertEquals((byte) 0xa8, podInfoTestValues.getByte4());
}
}