[bug1724] Problem with IOB and TBR on Medtronic

- TBR calculations get wrong, if pump is Rewinded, when TBR is supposed to be running
This commit is contained in:
Andy Rozman 2022-05-29 20:41:19 +01:00
parent 69ad28eaa0
commit e0daa11ccd
12 changed files with 380 additions and 146 deletions

View file

@ -273,6 +273,13 @@ public class DateTimeUtil {
}
public static long getATDWithAddedMinutes(Long atd, int minutesDiff) {
GregorianCalendar oldestEntryTime = DateTimeUtil.toGregorianCalendar(atd);
oldestEntryTime.add(Calendar.MINUTE, minutesDiff);
return toATechDate(oldestEntryTime);
}
public static long getATDWithAddedMinutes(GregorianCalendar oldestEntryTime, int minutesDiff) {
oldestEntryTime.add(Calendar.MINUTE, minutesDiff);

View file

@ -140,6 +140,8 @@ abstract class MedtronicHistoryEntry : MedtronicHistoryEntryInterface {
val bodyLength: Int
get() = sizes[2]
abstract fun toEntryString(): String
override fun toString(): String {
val sb = StringBuilder()
// if (DT == null) {
@ -156,6 +158,7 @@ abstract class MedtronicHistoryEntry : MedtronicHistoryEntryInterface {
sb.append("(")
sb.append(headLength + dateTimeLength + bodyLength)
sb.append(")")
val hasData = hasData()
if (hasData) {
sb.append(", data=$decodedDataAsString")

View file

@ -60,4 +60,9 @@ class CGMSHistoryEntry : MedtronicHistoryEntry() {
fun setDateTime(timeStamp: LocalDateTime, getIndex: Int) {
atechDateTime = (DateTimeUtil.toATechDate(timeStamp.plusMinutes(getIndex * 5)))
}
override fun toEntryString(): String {
// TODO fixme if needed
return toString()
}
}

View file

@ -84,6 +84,45 @@ class PumpHistoryEntry : MedtronicHistoryEntry() {
return atechDateTime < this.atechDateTime
}
override fun toEntryString(): String {
val sb = StringBuilder()
// if (DT == null) {
// Log.e("", "DT is null. RawData=" + ByteUtil.getHex(rawData))
// }
sb.append("PumpHistoryEntry [type=" + StringUtil.getStringInLength(entryType.name, 20))
sb.append(" " + if (DT == null) "null" else StringUtil.getStringInLength(DT, 19))
val hasData = (decodedData.size > 0)
if (hasData) {
if (hasDecodedDataEntry("Object")) {
val oo = getDecodedDataEntry("Object")
sb.append(", $oo")
} else {
sb.append(", data=$decodedDataAsString")
}
} else {
if (head.isNotEmpty()) {
sb.append(", head=")
sb.append(ByteUtil.shortHexString(head))
}
if (datetime.size != 0) {
sb.append(", datetime=")
sb.append(ByteUtil.shortHexString(datetime))
}
if (body.size != 0) {
sb.append(", body=")
sb.append(ByteUtil.shortHexString(body))
}
sb.append(", rawData=")
sb.append(ByteUtil.shortHexString(rawData))
sb.append("]")
}
// sb.append(" Ext: ");
return sb.toString()
}
class Comparator : java.util.Comparator<PumpHistoryEntry> {
override fun compare(o1: PumpHistoryEntry, o2: PumpHistoryEntry): Int {

View file

@ -357,7 +357,7 @@ class MedtronicHistoryData @Inject constructor(
aapsLogger.debug(LTag.PUMP, String.format(Locale.ENGLISH, "ProcessHistoryData: TBRs Processed [count=%d, items=%s]", tbrs.size, gson.toJson(tbrs)))
if (tbrs.isNotEmpty()) {
try {
processTBREntries(tbrs)
processTBREntries(tbrs, rewindRecords)
} catch (ex: Exception) {
aapsLogger.error(LTag.PUMP, "ProcessHistoryData: Error processing TBR entries: " + ex.message, ex)
throw ex
@ -582,7 +582,7 @@ class MedtronicHistoryData @Inject constructor(
}
}
private fun processTBREntries(entryList: MutableList<PumpHistoryEntry>) {
private fun processTBREntries(entryList: MutableList<PumpHistoryEntry>, rewindList: MutableList<PumpHistoryEntry>) {
entryList.reverse()
val tbr = entryList[0].getDecodedDataEntry("Object") as TempBasalPair
// var readOldItem = false
@ -606,7 +606,7 @@ class MedtronicHistoryData @Inject constructor(
val tbrRecords = pumpSyncStorage.getTBRs()
val processList: MutableList<TempBasalProcessDTO> = createTBRProcessList(entryList)
val processList: MutableList<TempBasalProcessDTO> = createTBRProcessList(entryList, rewindList)
if (processList.isNotEmpty()) {
for (tempBasalProcessDTO in processList) {
@ -729,7 +729,8 @@ class MedtronicHistoryData @Inject constructor(
} // collection
}
fun createTBRProcessList(entryList: MutableList<PumpHistoryEntry>) : MutableList<TempBasalProcessDTO> {
fun createTBRProcessList(entryList: MutableList<PumpHistoryEntry>, rewindList: MutableList<PumpHistoryEntry>) : MutableList<TempBasalProcessDTO> {
aapsLogger.debug(LTag.PUMP, "${ProcessHistoryRecord.TBR.description} List (before filter): ${gson.toJson(entryList)}")
@ -795,6 +796,23 @@ class MedtronicHistoryData @Inject constructor(
}
}
// see if rewind items, need to fix any of current tempBasalProcessDTO items (bug 1724)
if (rewindList.isNotEmpty()) {
for (rewindEntry in rewindList) {
for (tempBasalProcessDTO in processList) {
if (tempBasalProcessDTO.itemTwo==null) {
val endTime: Long = DateTimeUtil.getATDWithAddedMinutes(tempBasalProcessDTO.itemOne.atechDateTime, tempBasalProcessDTO.itemOneTbr!!.durationMinutes)
if ((rewindEntry.atechDateTime > tempBasalProcessDTO.itemOne.atechDateTime) &&
(rewindEntry.atechDateTime < endTime)) {
tempBasalProcessDTO.itemTwo = rewindEntry
continue
}
}
}
}
}
return processList
}
@ -1174,7 +1192,7 @@ class MedtronicHistoryData @Inject constructor(
return getFilteredItems(newHistory, entryTypes)
}
private fun getFilteredItems(entryType: PumpHistoryEntryType): MutableList<PumpHistoryEntry> {
fun getFilteredItems(entryType: PumpHistoryEntryType): MutableList<PumpHistoryEntry> {
return getFilteredItems(newHistory, setOf(entryType))
}
@ -1188,7 +1206,7 @@ class MedtronicHistoryData @Inject constructor(
}
}
private fun getFilteredItems(inList: MutableList<PumpHistoryEntry>?, entryType: PumpHistoryEntryType): MutableList<PumpHistoryEntry> {
fun getFilteredItems(inList: MutableList<PumpHistoryEntry>?, entryType: PumpHistoryEntryType): MutableList<PumpHistoryEntry> {
return getFilteredItems(inList, setOf(entryType))
}

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.pump.medtronic.data.dto
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntryType
class TempBasalProcessDTO constructor(var itemOne: PumpHistoryEntry,
var aapsLogger: AAPSLogger,
@ -13,7 +14,11 @@ class TempBasalProcessDTO constructor(var itemOne: PumpHistoryEntry,
field = value
if (objectType == ObjectType.TemporaryBasal) {
if (value!=null) {
itemTwoTbr = value.getDecodedDataEntry("Object") as TempBasalPair
if (value.entryType == PumpHistoryEntryType.TempBasalCombined) {
itemTwoTbr = value.getDecodedDataEntry("Object") as TempBasalPair
} else {
itemTwoRewind = value
}
} else {
itemTwoTbr = null
}
@ -22,6 +27,7 @@ class TempBasalProcessDTO constructor(var itemOne: PumpHistoryEntry,
var itemOneTbr: TempBasalPair? = null
var itemTwoTbr: TempBasalPair? = null
var itemTwoRewind: PumpHistoryEntry? = null
val atechDateTime: Long
get() = itemOne.atechDateTime
@ -41,6 +47,9 @@ class TempBasalProcessDTO constructor(var itemOne: PumpHistoryEntry,
//aapsLogger.error("Couldn't find TempBasalPair in entry: $itemOne")
return 0
}
} else if (itemTwoRewind!=null) {
val secondsDiff = DateTimeUtil.getATechDateDiferenceAsSeconds(itemOne.atechDateTime, DateTimeUtil.getATDWithAddedSeconds(itemTwo!!.atechDateTime, -2))
return secondsDiff
} else {
//aapsLogger.debug(LTag.PUMP, "Found 2 items for duration: itemOne=$itemOne, itemTwo=$itemTwo")
val secondsDiff = DateTimeUtil.getATechDateDiferenceAsSeconds(itemOne.atechDateTime, itemTwo!!.atechDateTime)

View file

@ -1,10 +1,24 @@
package info.nightscout.androidaps
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.PumpSync
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.pump.common.sync.PumpSyncStorage
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntryType
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.shared.logging.AAPSLoggerTest
import info.nightscout.androidaps.utils.rx.AapsSchedulers
import info.nightscout.androidaps.utils.rx.TestAapsSchedulers
import info.nightscout.shared.sharedPreferences.SP
import org.junit.Before
import org.junit.Rule
import org.mockito.Answers
import org.mockito.Mock
import org.mockito.Mockito
import org.mockito.junit.MockitoJUnit
import org.mockito.junit.MockitoRule
@ -14,6 +28,26 @@ open class TestBase {
val aapsLogger = AAPSLoggerTest()
val aapsSchedulers: AapsSchedulers = TestAapsSchedulers()
var rxBus: RxBus = RxBus(TestAapsSchedulers(), aapsLogger)
@Mock lateinit var pumpSync: PumpSync
@Mock lateinit var pumpSyncStorage: PumpSyncStorage
@Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin
@Mock lateinit var sp: SP
@Mock lateinit var rh: ResourceHelper
lateinit var medtronicUtil : MedtronicUtil
lateinit var decoder : MedtronicPumpHistoryDecoder
val packetInjector = HasAndroidInjector {
AndroidInjector {
}
}
// Add a JUnit rule that will setup the @Mock annotated vars and log.
// Another possibility would be to add `MockitoAnnotations.initMocks(this) to the setup method.
@ -34,6 +68,52 @@ open class TestBase {
return uninitialized()
}
fun preProcessListTBR(inputList: MutableList<PumpHistoryEntry>) {
var tbrs: MutableList<PumpHistoryEntry> = mutableListOf()
for (pumpHistoryEntry in inputList) {
if (pumpHistoryEntry.entryType === PumpHistoryEntryType.TempBasalRate ||
pumpHistoryEntry.entryType === PumpHistoryEntryType.TempBasalDuration) {
tbrs.add(pumpHistoryEntry)
}
}
inputList.removeAll(tbrs)
inputList.addAll(preProcessTBRs(tbrs))
sort(inputList)
//return inputList
}
private fun preProcessTBRs(TBRs_Input: MutableList<PumpHistoryEntry>): MutableList<PumpHistoryEntry> {
val tbrs: MutableList<PumpHistoryEntry> = mutableListOf()
val map: MutableMap<String?, PumpHistoryEntry?> = HashMap()
for (pumpHistoryEntry in TBRs_Input) {
if (map.containsKey(pumpHistoryEntry.DT)) {
decoder.decodeTempBasal(map[pumpHistoryEntry.DT]!!, pumpHistoryEntry)
pumpHistoryEntry.setEntryType(medtronicUtil.medtronicPumpModel, PumpHistoryEntryType.TempBasalCombined)
tbrs.add(pumpHistoryEntry)
map.remove(pumpHistoryEntry.DT)
} else {
map[pumpHistoryEntry.DT] = pumpHistoryEntry
}
}
return tbrs
}
private fun sort(list: MutableList<PumpHistoryEntry>) {
// if (list != null && !list.isEmpty()) {
// Collections.sort(list, PumpHistoryEntry.Comparator())
// }
list.sortWith(PumpHistoryEntry.Comparator())
}
@Suppress("Unchecked_Cast")
fun <T> uninitialized(): T = null as T
}

View file

@ -1,113 +0,0 @@
package info.nightscout.androidaps.plugins.pump.medtronic.comm;
//import uk.org.lidalia.slf4jtest.TestLogger;
//import uk.org.lidalia.slf4jtest.TestLoggerFactory;
/**
* Created by andy on 3/10/19.
*/
public class MedtronicHistoryDataUTest {
/*
//TestLogger LOGGER = TestLoggerFactory.getTestLogger(MedtronicHistoryDataUTest.class);
byte[] historyPageData = ByteUtil
.createByteArrayFromString("16 00 12 EC 14 47 13 33 00 14 F2 14 47 13 00 16 01 14 F2 14 47 13 33 00 1C C9 15 47 13 00 16 00 1C C9 15 47 13 33 4E 31 D3 15 47 13 00 16 01 31 D3 15 47 13 33 00 1A F1 15 47 13 00 16 00 1A F1 15 47 13 33 50 1D F1 15 47 13 00 16 01 1D F1 15 47 13 33 50 11 D8 16 47 13 00 16 01 11 D8 16 47 13 33 50 31 FB 16 47 13 00 16 01 31 FB 16 47 13 33 50 12 E3 17 47 13 00 16 01 12 E3 17 47 13 33 00 1E FB 17 47 13 00 16 00 1E FB 17 47 13 33 D8 21 FB 17 47 13 00 16 01 21 FB 17 47 13 07 00 00 05 CC 27 93 6D 27 93 05 0C 00 E8 00 00 00 00 05 CC 05 CC 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 33 00 36 C4 00 48 13 00 16 00 36 C4 00 48 13 33 D8 29 C9 00 48 13 00 16 01 29 C9 00 48 13 33 00 12 E7 00 48 13 00 16 00 12 E7 00 48 13 33 BC 19 C9 01 48 13 00 16 01 19 C9 01 48 13 33 00 26 CE 01 48 13 00 16 00 26 CE 01 48 13 33 44 29 CE 01 48 13 00 16 01 29 CE 01 48 13 33 00 13 D3 01 48 13 00 16 00 13 D3 01 48 13 33 64 31 F1 01 48 13 00 16 01 31 F1 01 48 13 33 00 0B F7 01 48 13 00 16 00 0B F7 01 48 13 33 00 12 D8 02 48 13 00 16 01 12 D8 02 48 13 33 00 10 F1 02 48 13 00 16 00 10 F1 02 48 13 33 00 30 C4 03 48 13 00 16 01 30 C4 03 48 13 33 00 04 CA 03 48 13 00 16 00 04 CA 03 48 13 33 00 2F D3 03 48 13 00 16 01 2F D3 03 48 13 33 00 30 D8 03 48 13 00 16 00 30 D8 03 48 13 33 00 13 E7 03 48 13 00 16 01 13 E7 03 48 13 33 00 2E FB 03 48 13 00 16 00 2E FB 03 48 13 19 00 00 C1 04 08 13 07 00 00 04 0C 28 93 6D 28 93 05 0C 00 E8 00 00 00 00 04 0C 04 0C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 06 3E 03 7A 19 DC 48 49 13 0C 3E 0C E6 08 09 13 07 00 00 01 E4 29 93 6D 29 93 05 0C 00 E8 00 00 00 00 01 E4 01 E4 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 1A 00 13 D2 0D 0A 13 1A 01 28 D2 0D 0A 13 21 00 2A D8 0D 0A 13 03 00 00 00 0E 2D D9 2D 0A 13 33 98 26 DE 0D 4A 13 00 16 01 26 DE 0D 4A 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 70");
MedtronicPumpHistoryDecoder decoder = new MedtronicPumpHistoryDecoder();
// Logger LOGGER = StacktraceLoggerWrapper.getLogger(MedtronicHistoryDataUTest.class);
//@Before
public void setup() {
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "trace");
// final TestAppender appender = new TestAppender();
// final Logger logger = Logger.getRootLogger();
// logger.addAppender(appender);
// try {
// Logger.getLogger(MyTest.class).info("Test");
// } finally {
// logger.removeAppender(appender);
// }
}
@Before
public void prepareMocks() throws Exception {
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "trace");
when(SP.getString(R.string.key_danars_address, "")).thenReturn("");
//danaRPlugin = DanaRPlugin.getPlugin();
}
//@Test
public void testTBR() throws Exception {
RawHistoryPage historyPage = new RawHistoryPage();
historyPage.appendData(historyPageData);
List<PumpHistoryEntry> pumpHistoryEntries = decoder.processPageAndCreateRecords(historyPage);
System.out.println("PumpHistoryEntries: " + pumpHistoryEntries.size());
Log.d("Test", "Log.d");
//LOGGER.debug("Logger.debug");
for (PumpHistoryEntry pumpHistoryEntry : pumpHistoryEntries) {
Log.d("MedtronicHistoryDataUTest", pumpHistoryEntry.toString());
}
}
public void testRussel() throws Exception {
byte[] historyPageData = ByteUtil
.createByteArrayFromString("06 15 04 F6 00 40 60 01 05 06 36 04 FE 00 40 60 01 05 06 2F 18 1A 00 40 20 C1 05 06 2F 0C 45 00 40 20 C1 05 06 2F 0C 56 00 40 20 C1 05 06 2F 0C 78 00 40 20 C1 05 06 2F 0C AD 00 40 20 C1 05 06 15 04 BA 00 40 40 A1 05 0C 15 0E 40 00 01 05 64 00 0D 44 00 01 05 17 00 14 44 00 01 05 18 00 00 44 00 01 05 21 00 07 44 00 01 05 21 00 0C 4E 00 01 05 07 00 00 00 00 01 85 6D 01 85 06 08 00 2B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 2B 00 00 00 03 00 00 00 15 00 67 35 02 05 03 00 03 00 03 1C 67 15 02 05 07 00 00 00 40 02 85 6D 02 85 06 08 00 2B 00 00 00 00 00 40 00 40 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 2B 00 00 00 2C 78 39 5F 17 03 05 07 00 00 02 6C 03 85 6D 03 85 06 08 00 2B 00 00 00 00 02 6C 02 6C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 2B 00 00 00 26 01 33 44 01 04 05 27 03 74 41 01 B2 07 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 29 74");
RawHistoryPage historyPage = new RawHistoryPage();
historyPage.appendData(historyPageData);
List<PumpHistoryEntry> pumpHistoryEntries = decoder.processPageAndCreateRecords(historyPage);
System.out.println("PumpHistoryEntries: " + pumpHistoryEntries.size());
Log.d("Test", "Log.d");
//LOGGER.debug("Logger.debug");
for (PumpHistoryEntry pumpHistoryEntry : pumpHistoryEntries) {
Log.d("MedtronicHistoryDataUTest", pumpHistoryEntry.toString());
}
}
// @Test
public void testJRoth_2111() throws Exception {
byte[] historyPageData = ByteUtil
.createByteArrayFromString("01 03 03 00 8E 85 52 48 13 33 00 AB 89 12 48 13 00 16 00 AB 89 12 48 13 33 34 AD 89 12 48 13 00 16 01 AD 89 12 48 13 01 01 01 00 B8 8A 52 48 13 01 08 08 00 9F 8C 52 48 13 33 00 91 8F 12 48 13 00 16 00 91 8F 12 48 13 33 00 92 8F 12 48 13 00 16 03 92 8F 12 48 13 33 00 BA A7 12 48 13 00 16 04 BA A7 12 48 13 01 19 19 00 AF B0 52 48 13 33 00 8C 8A 13 48 13 00 16 04 8C 8A 13 48 13 33 00 9D A8 13 48 13 00 16 04 9D A8 13 48 13 33 00 AA 85 14 48 13 00 16 04 AA 85 14 48 13 33 00 8D A1 14 48 13 00 16 04 8D A1 14 48 13 33 10 89 BA 14 48 13 00 16 01 89 BA 14 48 13 33 00 AD 88 15 48 13 00 16 00 AD 88 15 48 13 33 00 AF 88 15 48 13 00 16 01 AF 88 15 48 13 01 1D 1D 00 95 8D 55 48 13 33 00 95 92 15 48 13 00 16 04 95 92 15 48 13 33 1E B7 9C 15 48 13 00 16 01 B7 9C 15 48 13 33 00 AA A6 15 48 13 00 16 00 AA A6 15 48 13 33 00 AC A6 15 48 13 00 16 04 AC A6 15 48 13 01 02 02 00 B7 A6 55 48 13 01 01 01 00 A6 AC 55 48 13 33 00 B3 8D 16 48 13 00 16 04 B3 8D 16 48 13 33 00 B7 97 16 48 13 00 16 04 B7 97 16 48 13 33 18 A7 B2 16 48 13 00 16 01 A7 B2 16 48 13 33 00 8B B8 16 48 13 00 16 00 8B B8 16 48 13 33 00 8D B8 16 48 13 00 16 03 8D B8 16 48 13 33 18 AE 85 17 48 13 00 16 01 AE 85 17 48 13 33 00 92 8A 17 48 13 00 16 00 92 8A 17 48 13 33 00 94 8A 17 48 13 00 16 01 94 8A 17 48 13 01 02 02 00 9F 8A 57 48 13 33 06 AC 8F 17 48 13 00 16 01 AC 8F 17 48 13 01 02 02 00 B8 8F 57 48 13 33 00 98 94 17 48 13 00 16 00 98 94 17 48 13 33 0C 9A 94 17 48 13 00 16 01 9A 94 17 48 13 01 02 02 00 A5 94 57 48 13 33 00 9C 99 17 48 13 00 16 00 9C 99 17 48 13 33 00 9E 99 17 48 13 00 16 01 9E 99 17 48 13 01 02 02 00 A9 99 57 48 13 01 02 02 00 84 9F 57 48 13 01 02 02 00 A7 A6 57 48 13 33 00 A4 AB 17 48 13 00 16 00 A4 AB 17 48 13 01 02 02 00 B0 AB 57 48 13 33 00 A7 B0 17 48 13 00 16 02 A7 B0 17 48 13 01 01 01 00 B2 B0 57 48 13 33 00 AD BA 17 48 13 00 16 04 AD BA 17 48 13 07 00 00 05 3A A8 13 6D A8 13 05 0C 00 E8 00 00 00 00 05 3A 00 F6 12 04 44 52 00 00 04 44 52 00 00 00 00 00 00 04 44 64 35 00 00 00 35 0C 00 E8 00 00 00 06 0A 1D 66 80 81 60 09 13 0C 0A 8D 82 00 09 13 1A 00 9A 82 00 09 13 1A 01 AF 82 00 09 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05 28");
RawHistoryPage historyPage = new RawHistoryPage();
historyPage.appendData(historyPageData);
List<PumpHistoryEntry> pumpHistoryEntries = decoder.processPageAndCreateRecords(historyPage);
System.out.println("PumpHistoryEntries: " + pumpHistoryEntries.size());
Log.d("Test", "Log.d");
//LOGGER.debug("Logger.debug");
for (PumpHistoryEntry pumpHistoryEntry : pumpHistoryEntries) {
Log.d("MedtronicHistoryDataUTest", pumpHistoryEntry.toString());
}
}
*/
}

View file

@ -0,0 +1,187 @@
package info.nightscout.androidaps.plugins.pump.medtronic.comm
import android.util.Log
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil
import org.mockito.Mock
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.interfaces.ResourceHelper
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.shared.logging.AAPSLogger
import info.nightscout.shared.logging.AAPSLoggerTest
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.MedtronicPumpHistoryDecoder
import kotlin.Throws
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntryType
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.TempBasalProcessDTO
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
import info.nightscout.androidaps.utils.rx.TestAapsSchedulers
import info.nightscout.androidaps.utils.serialisation.SealedClassHelper.gson
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers
import org.mockito.Mockito
import org.mockito.MockitoAnnotations
import java.lang.Exception
//import uk.org.lidalia.slf4jtest.TestLogger;
//import uk.org.lidalia.slf4jtest.TestLoggerFactory;
/**
* Created by andy on 3/10/19.
*/
class MedtronicHistoryDataUTest : TestBase() {
//TestLogger LOGGER = TestLoggerFactory.getTestLogger(MedtronicHistoryDataUTest.class);
// var historyPageData = ByteUtil
// .createByteArrayFromString(
// "16 00 12 EC 14 47 13 33 00 14 F2 14 47 13 00 16 01 14 F2 14 47 13 33 00 1C C9 15 47 13 00 16 00 1C C9 15 47 13 33 4E 31 D3 15 47 13 00 16 01 31 D3 15 47 13 33 00 1A F1 15 47 13 00 16 00 1A F1 15 47 13 33 50 1D F1 15 47 13 00 16 01 1D F1 15 47 13 33 50 11 D8 16 47 13 00 16 01 11 D8 16 47 13 33 50 31 FB 16 47 13 00 16 01 31 FB 16 47 13 33 50 12 E3 17 47 13 00 16 01 12 E3 17 47 13 33 00 1E FB 17 47 13 00 16 00 1E FB 17 47 13 33 D8 21 FB 17 47 13 00 16 01 21 FB 17 47 13 07 00 00 05 CC 27 93 6D 27 93 05 0C 00 E8 00 00 00 00 05 CC 05 CC 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 33 00 36 C4 00 48 13 00 16 00 36 C4 00 48 13 33 D8 29 C9 00 48 13 00 16 01 29 C9 00 48 13 33 00 12 E7 00 48 13 00 16 00 12 E7 00 48 13 33 BC 19 C9 01 48 13 00 16 01 19 C9 01 48 13 33 00 26 CE 01 48 13 00 16 00 26 CE 01 48 13 33 44 29 CE 01 48 13 00 16 01 29 CE 01 48 13 33 00 13 D3 01 48 13 00 16 00 13 D3 01 48 13 33 64 31 F1 01 48 13 00 16 01 31 F1 01 48 13 33 00 0B F7 01 48 13 00 16 00 0B F7 01 48 13 33 00 12 D8 02 48 13 00 16 01 12 D8 02 48 13 33 00 10 F1 02 48 13 00 16 00 10 F1 02 48 13 33 00 30 C4 03 48 13 00 16 01 30 C4 03 48 13 33 00 04 CA 03 48 13 00 16 00 04 CA 03 48 13 33 00 2F D3 03 48 13 00 16 01 2F D3 03 48 13 33 00 30 D8 03 48 13 00 16 00 30 D8 03 48 13 33 00 13 E7 03 48 13 00 16 01 13 E7 03 48 13 33 00 2E FB 03 48 13 00 16 00 2E FB 03 48 13 19 00 00 C1 04 08 13 07 00 00 04 0C 28 93 6D 28 93 05 0C 00 E8 00 00 00 00 04 0C 04 0C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 06 3E 03 7A 19 DC 48 49 13 0C 3E 0C E6 08 09 13 07 00 00 01 E4 29 93 6D 29 93 05 0C 00 E8 00 00 00 00 01 E4 01 E4 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 1A 00 13 D2 0D 0A 13 1A 01 28 D2 0D 0A 13 21 00 2A D8 0D 0A 13 03 00 00 00 0E 2D D9 2D 0A 13 33 98 26 DE 0D 4A 13 00 16 01 26 DE 0D 4A 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 70"
// )
var byteUtil = ByteUtil()
var rileyLinkUtil = RileyLinkUtil()
//lateinit var rxBus: RxBus
lateinit var medtronicHistoryData: MedtronicHistoryData
lateinit var medtronicPumpStatus : MedtronicPumpStatus
@Before
fun setup() {
MockitoAnnotations.initMocks(this)
rxBus = RxBus(TestAapsSchedulers(), aapsLogger)
medtronicPumpStatus = MedtronicPumpStatus(
rh, sp, rxBus,
rileyLinkUtil
)
medtronicUtil = MedtronicUtil(
aapsLogger, rxBus, rileyLinkUtil,
medtronicPumpStatus
)
decoder = MedtronicPumpHistoryDecoder(
aapsLogger,
medtronicUtil, byteUtil
)
medtronicHistoryData = MedtronicHistoryData(packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
medtronicUtil, decoder,
medtronicPumpStatus,
pumpSync,
pumpSyncStorage)
System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "trace")
}
//@Test
@Throws(Exception::class) fun testTBR() {
var historyPageData = ByteUtil
.createByteArrayFromString(
"16 00 12 EC 14 47 13 33 00 14 F2 14 47 13 00 16 01 14 F2 14 47 13 33 00 1C C9 15 47 13 00 16 00 1C C9 15 47 13 33 4E 31 D3 15 47 13 00 16 01 31 D3 15 47 13 33 00 1A F1 15 47 13 00 16 00 1A F1 15 47 13 33 50 1D F1 15 47 13 00 16 01 1D F1 15 47 13 33 50 11 D8 16 47 13 00 16 01 11 D8 16 47 13 33 50 31 FB 16 47 13 00 16 01 31 FB 16 47 13 33 50 12 E3 17 47 13 00 16 01 12 E3 17 47 13 33 00 1E FB 17 47 13 00 16 00 1E FB 17 47 13 33 D8 21 FB 17 47 13 00 16 01 21 FB 17 47 13 07 00 00 05 CC 27 93 6D 27 93 05 0C 00 E8 00 00 00 00 05 CC 05 CC 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 33 00 36 C4 00 48 13 00 16 00 36 C4 00 48 13 33 D8 29 C9 00 48 13 00 16 01 29 C9 00 48 13 33 00 12 E7 00 48 13 00 16 00 12 E7 00 48 13 33 BC 19 C9 01 48 13 00 16 01 19 C9 01 48 13 33 00 26 CE 01 48 13 00 16 00 26 CE 01 48 13 33 44 29 CE 01 48 13 00 16 01 29 CE 01 48 13 33 00 13 D3 01 48 13 00 16 00 13 D3 01 48 13 33 64 31 F1 01 48 13 00 16 01 31 F1 01 48 13 33 00 0B F7 01 48 13 00 16 00 0B F7 01 48 13 33 00 12 D8 02 48 13 00 16 01 12 D8 02 48 13 33 00 10 F1 02 48 13 00 16 00 10 F1 02 48 13 33 00 30 C4 03 48 13 00 16 01 30 C4 03 48 13 33 00 04 CA 03 48 13 00 16 00 04 CA 03 48 13 33 00 2F D3 03 48 13 00 16 01 2F D3 03 48 13 33 00 30 D8 03 48 13 00 16 00 30 D8 03 48 13 33 00 13 E7 03 48 13 00 16 01 13 E7 03 48 13 33 00 2E FB 03 48 13 00 16 00 2E FB 03 48 13 19 00 00 C1 04 08 13 07 00 00 04 0C 28 93 6D 28 93 05 0C 00 E8 00 00 00 00 04 0C 04 0C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 06 3E 03 7A 19 DC 48 49 13 0C 3E 0C E6 08 09 13 07 00 00 01 E4 29 93 6D 29 93 05 0C 00 E8 00 00 00 00 01 E4 01 E4 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0C 00 E8 00 00 00 1A 00 13 D2 0D 0A 13 1A 01 28 D2 0D 0A 13 21 00 2A D8 0D 0A 13 03 00 00 00 0E 2D D9 2D 0A 13 33 98 26 DE 0D 4A 13 00 16 01 26 DE 0D 4A 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5D 70"
)
val historyPage = RawHistoryPage(aapsLogger)
historyPage.appendData(historyPageData)
val pumpHistoryEntries: List<PumpHistoryEntry> = decoder.processPageAndCreateRecords(historyPage)
println("PumpHistoryEntries: " + pumpHistoryEntries.size)
Log.d("Test", "Log.d")
//LOGGER.debug("Logger.debug");
for (pumpHistoryEntry in pumpHistoryEntries) {
Log.d("MedtronicHistoryDataUTest", pumpHistoryEntry.toString())
}
}
@Throws(Exception::class) fun testRussel() {
val historyPageData = ByteUtil
.createByteArrayFromString(
"06 15 04 F6 00 40 60 01 05 06 36 04 FE 00 40 60 01 05 06 2F 18 1A 00 40 20 C1 05 06 2F 0C 45 00 40 20 C1 05 06 2F 0C 56 00 40 20 C1 05 06 2F 0C 78 00 40 20 C1 05 06 2F 0C AD 00 40 20 C1 05 06 15 04 BA 00 40 40 A1 05 0C 15 0E 40 00 01 05 64 00 0D 44 00 01 05 17 00 14 44 00 01 05 18 00 00 44 00 01 05 21 00 07 44 00 01 05 21 00 0C 4E 00 01 05 07 00 00 00 00 01 85 6D 01 85 06 08 00 2B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 2B 00 00 00 03 00 00 00 15 00 67 35 02 05 03 00 03 00 03 1C 67 15 02 05 07 00 00 00 40 02 85 6D 02 85 06 08 00 2B 00 00 00 00 00 40 00 40 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 2B 00 00 00 2C 78 39 5F 17 03 05 07 00 00 02 6C 03 85 6D 03 85 06 08 00 2B 00 00 00 00 02 6C 02 6C 64 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00 2B 00 00 00 26 01 33 44 01 04 05 27 03 74 41 01 B2 07 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 29 74"
)
val historyPage = RawHistoryPage(aapsLogger)
historyPage.appendData(historyPageData)
val pumpHistoryEntries: List<PumpHistoryEntry> = decoder.processPageAndCreateRecords(historyPage)
println("PumpHistoryEntries: " + pumpHistoryEntries.size)
Log.d("Test", "Log.d")
//LOGGER.debug("Logger.debug");
for (pumpHistoryEntry in pumpHistoryEntries) {
Log.d("MedtronicHistoryDataUTest", pumpHistoryEntry.toString())
}
}
// @Test
@Throws(Exception::class) fun testJRoth_2111() {
val historyPageData = ByteUtil
.createByteArrayFromString(
"01 03 03 00 8E 85 52 48 13 33 00 AB 89 12 48 13 00 16 00 AB 89 12 48 13 33 34 AD 89 12 48 13 00 16 01 AD 89 12 48 13 01 01 01 00 B8 8A 52 48 13 01 08 08 00 9F 8C 52 48 13 33 00 91 8F 12 48 13 00 16 00 91 8F 12 48 13 33 00 92 8F 12 48 13 00 16 03 92 8F 12 48 13 33 00 BA A7 12 48 13 00 16 04 BA A7 12 48 13 01 19 19 00 AF B0 52 48 13 33 00 8C 8A 13 48 13 00 16 04 8C 8A 13 48 13 33 00 9D A8 13 48 13 00 16 04 9D A8 13 48 13 33 00 AA 85 14 48 13 00 16 04 AA 85 14 48 13 33 00 8D A1 14 48 13 00 16 04 8D A1 14 48 13 33 10 89 BA 14 48 13 00 16 01 89 BA 14 48 13 33 00 AD 88 15 48 13 00 16 00 AD 88 15 48 13 33 00 AF 88 15 48 13 00 16 01 AF 88 15 48 13 01 1D 1D 00 95 8D 55 48 13 33 00 95 92 15 48 13 00 16 04 95 92 15 48 13 33 1E B7 9C 15 48 13 00 16 01 B7 9C 15 48 13 33 00 AA A6 15 48 13 00 16 00 AA A6 15 48 13 33 00 AC A6 15 48 13 00 16 04 AC A6 15 48 13 01 02 02 00 B7 A6 55 48 13 01 01 01 00 A6 AC 55 48 13 33 00 B3 8D 16 48 13 00 16 04 B3 8D 16 48 13 33 00 B7 97 16 48 13 00 16 04 B7 97 16 48 13 33 18 A7 B2 16 48 13 00 16 01 A7 B2 16 48 13 33 00 8B B8 16 48 13 00 16 00 8B B8 16 48 13 33 00 8D B8 16 48 13 00 16 03 8D B8 16 48 13 33 18 AE 85 17 48 13 00 16 01 AE 85 17 48 13 33 00 92 8A 17 48 13 00 16 00 92 8A 17 48 13 33 00 94 8A 17 48 13 00 16 01 94 8A 17 48 13 01 02 02 00 9F 8A 57 48 13 33 06 AC 8F 17 48 13 00 16 01 AC 8F 17 48 13 01 02 02 00 B8 8F 57 48 13 33 00 98 94 17 48 13 00 16 00 98 94 17 48 13 33 0C 9A 94 17 48 13 00 16 01 9A 94 17 48 13 01 02 02 00 A5 94 57 48 13 33 00 9C 99 17 48 13 00 16 00 9C 99 17 48 13 33 00 9E 99 17 48 13 00 16 01 9E 99 17 48 13 01 02 02 00 A9 99 57 48 13 01 02 02 00 84 9F 57 48 13 01 02 02 00 A7 A6 57 48 13 33 00 A4 AB 17 48 13 00 16 00 A4 AB 17 48 13 01 02 02 00 B0 AB 57 48 13 33 00 A7 B0 17 48 13 00 16 02 A7 B0 17 48 13 01 01 01 00 B2 B0 57 48 13 33 00 AD BA 17 48 13 00 16 04 AD BA 17 48 13 07 00 00 05 3A A8 13 6D A8 13 05 0C 00 E8 00 00 00 00 05 3A 00 F6 12 04 44 52 00 00 04 44 52 00 00 00 00 00 00 04 44 64 35 00 00 00 35 0C 00 E8 00 00 00 06 0A 1D 66 80 81 60 09 13 0C 0A 8D 82 00 09 13 1A 00 9A 82 00 09 13 1A 01 AF 82 00 09 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 05 28"
)
val historyPage = RawHistoryPage(aapsLogger)
historyPage.appendData(historyPageData)
val pumpHistoryEntries: List<PumpHistoryEntry> = decoder.processPageAndCreateRecords(historyPage)
println("PumpHistoryEntries: " + pumpHistoryEntries.size)
Log.d("Test", "Log.d")
//LOGGER.debug("Logger.debug");
for (pumpHistoryEntry in pumpHistoryEntries) {
Log.d("MedtronicHistoryDataUTest", pumpHistoryEntry.toString())
}
}
@Test @Throws(Exception::class) fun test_1724() {
val historyPageData = ByteUtil
.createByteArrayFromString(
"33 20 53 78 15 51 16 00 16 01 53 78 15 51 16 33 00 6F 40 16 51 16 00 16 00 6F 40 16 51 16 7B 16 6F 40 16 11 16 2C 1E 00 33 30 71 40 16 51 16 00 16 01 71 40 16 51 16 33 00 6E 45 16 51 16 00 16 00 6E 45 16 51 16 7B 16 6E 45 16 11 16 2C 1E 00 33 3A 70 45 16 51 16 00 16 01 70 45 16 51 16 33 00 71 5E 16 51 16 00 16 00 71 5E 16 51 16 7B 16 71 5E 16 11 16 2C 1E 00 33 40 73 5E 16 51 16 00 16 01 73 5E 16 51 16 33 00 74 6D 16 51 16 00 16 00 74 6D 16 51 16 7B 16 74 6D 16 11 16 2C 1E 00 33 14 76 6D 16 51 16 00 16 01 76 6D 16 51 16 33 00 77 72 16 51 16 00 16 00 77 72 16 51 16 7B 16 77 72 16 11 16 2C 1E 00 7B 17 40 40 17 11 16 2E 1E 00 33 28 51 41 17 51 16 00 16 01 51 41 17 51 16 33 00 56 46 17 51 16 00 16 00 56 46 17 51 16 7B 17 56 46 17 11 16 2E 1E 00 33 34 59 46 17 51 16 00 16 01 59 46 17 51 16 33 00 70 4A 17 51 16 00 16 00 70 4A 17 51 16 7B 17 70 4A 17 11 16 2E 1E 00 33 58 72 4A 17 51 16 00 16 01 72 4A 17 51 16 33 00 6E 59 17 51 16 00 16 00 6E 59 17 51 16 7B 17 6E 59 17 11 16 2E 1E 00 33 18 70 59 17 51 16 00 16 01 70 59 17 51 16 33 00 70 5E 17 51 16 00 16 00 70 5E 17 51 16 7B 17 70 5E 17 11 16 2E 1E 00 33 0C 72 5E 17 51 16 00 16 01 72 5E 17 51 16 33 00 72 63 17 51 16 00 16 00 72 63 17 51 16 7B 17 72 63 17 11 16 2E 1E 00 33 1C 70 72 17 51 16 00 16 01 70 72 17 51 16 33 00 51 78 17 51 16 00 16 00 51 78 17 51 16 7B 17 52 78 17 11 16 2E 1E 00 33 12 54 78 17 51 16 00 16 01 54 78 17 51 16 07 00 00 04 4E 51 96 00 00 00 6E 51 96 05 00 00 00 00 00 00 00 04 4E 03 A2 54 00 AC 10 00 00 00 00 00 00 00 00 00 AC 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 00 46 46 00 52 16 00 16 00 46 46 00 52 16 7B 00 47 46 00 12 16 00 1E 00 33 20 47 64 00 52 16 00 16 01 47 64 00 52 16 33 00 6D 77 00 52 16 00 16 00 6D 77 00 52 16 7B 00 6D 77 00 12 16 00 1E 00 33 12 70 77 00 52 16 00 16 01 70 77 00 52 16 33 00 58 78 00 52 16 00 16 00 58 78 00 52 16 7B 00 59 78 00 12 16 00 1E 00 33 00 5C 78 00 52 16 00 16 02 5C 78 00 52 16 21 00 66 79 00 12 16 03 00 00 00 9C 74 42 21 12 16 03 00 03 00 03 6E 4D 01 12 16 33 00 79 4E 01 52 16 00 16 00 79 4E 01 52 16 7B 01 79 4E 01 12 16 02 1E 00 33 2A 6B 4F 01 52 16 00 16 01 6B 4F 01 52 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2E D1"
//"33 20 53 78 15 51 16 00 16 01 53 78 15 51 16 33 00 6F 40 16 51 16 00 16 00 6F 40 16 51 16 7B 16 6F 40 16 11 16 2C 1E 00 33 30 71 40 16 51 16 00 16 01 71 40 16 51 16 33 00 6E 45
// 16 51 16 00 16 00 6E 45 16 51 16 7B 16 6E 45 16 11 16 2C 1E 00 33 3A 70 45 16 51 16 00 16 01 70 45 16 51 16 33 00 71 5E 16 51 16 00 16 00 71 5E 16 51 16 7B 16 71 5E 16 11 16 2C 1E 00 33 40 73 5E 16 51 16 00 16 01 73 5E 16 51 16 33 00 74 6D 16 51 16 00 16 00 74 6D 16 51 16 7B 16 74 6D 16 11 16 2C 1E 00 33 14 76 6D 16 51 16 00 16 01 76 6D 16 51 16 33 00 77 72 16 51 16 00 16 00 77 72 16 51 16 7B 16 77 72 16 11 16 2C 1E 00 7B 17 40 40 17 11 16 2E 1E 00 33 28 51 41 17 51 16 00 16 01 51 41 17 51 16 33 00 56 46 17 51 16 00 16 00 56 46 17 51 16 7B 17 56 46 17 11 16 2E 1E 00 33 34 59 46 17 51 16 00 16 01 59 46 17 51 16 33 00 70 4A 17 51 16 00 16 00 70 4A 17 51 16 7B 17 70 4A 17 11 16 2E 1E 00 33 58 72 4A 17 51 16 00 16 01 72 4A 17 51 16 33 00 6E 59 17 51 16 00 16 00 6E 59 17 51 16 7B 17 6E 59 17 11 16 2E 1E 00 33 18 70 59 17 51 16 00 16 01 70 59 17 51 16 33 00 70 5E 17 51 16 00 16 00 70 5E 17 51 16 7B 17 70 5E 17 11 16 2E 1E 00 33 0C 72 5E 17 51 16 00 16 01 72 5E 17 51 16 33 00 72 63 17 51 16 00 16 00 72 63 17 51 16 7B 17 72 63 17 11 16 2E 1E 00 33 1C 70 72 17 51 16 00 16 01 70 72 17 51 16 33 00 51 78 17 51 16 00 16 00 51 78 17 51 16 7B 17 52 78 17 11 16 2E 1E 00 33 12 54 78 17 51 16 00 16 01 54 78 17 51 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4D 6D"
)
medtronicUtil.medtronicPumpModel =MedtronicDeviceType.Medtronic_723_Revel
medtronicUtil.isModelSet = true
val historyPage = RawHistoryPage(aapsLogger)
historyPage.appendData(historyPageData)
val pumpHistoryEntries: MutableList<PumpHistoryEntry> = decoder.processPageAndCreateRecords(historyPage)
println("PumpHistoryEntries: " + pumpHistoryEntries.size)
val rewindRecords: MutableList<PumpHistoryEntry> = medtronicHistoryData.getFilteredItems(pumpHistoryEntries, PumpHistoryEntryType.Rewind)
preProcessListTBR(pumpHistoryEntries)
println("PumpHistoryEntries: after: " + pumpHistoryEntries.size)
Log.d("Test", "Log.d")
//LOGGER.debug("Logger.debug");
for (pumpHistoryEntry in pumpHistoryEntries) {
println(pumpHistoryEntry.toEntryString())
}
println("PumpHistoryEntries: after: " + pumpHistoryEntries.size)
val tbrs: MutableList<PumpHistoryEntry> = medtronicHistoryData.getFilteredItems(pumpHistoryEntries, PumpHistoryEntryType.TempBasalCombined)
tbrs.reverse()
println("PumpHistoryEntries: getFilteredItems: " + tbrs.size)
println("PumpHistoryEntries: getRewindItems: $rewindRecords.size : " + gson.toJson(rewindRecords) )
val processList: MutableList<TempBasalProcessDTO> = medtronicHistoryData.createTBRProcessList(tbrs, rewindRecords)
println("PumpHistoryEntries: processList: " + processList.size)
for (tempBasalProcessDTO in processList) {
println(tempBasalProcessDTO.toTreatmentString())
}
}
}

View file

@ -1,8 +1,7 @@
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
import dagger.android.HasAndroidInjector
//import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil
@ -25,15 +24,15 @@ import org.mockito.Mock
@Suppress("SpellCheckingInspection")
class MedtronicPumpHistoryDecoderUTest : TestBase() {
@Mock lateinit var injector: HasAndroidInjector
@Mock lateinit var rh: ResourceHelper
@Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin
//@Mock lateinit var injector: HasAndroidInjector
//@Mock lateinit var rh: ResourceHelper
// @Mock(answer = Answers.RETURNS_DEEP_STUBS) lateinit var activePlugin: ActivePlugin
@Mock lateinit var rileyLinkUtil: RileyLinkUtil
@Mock lateinit var sp: SP
//@Mock lateinit var sp: SP
private var medtronicPumpStatus: MedtronicPumpStatus? = null
private var medtronicUtil: MedtronicUtil? = null
private var decoder: MedtronicPumpHistoryDecoder? = null
//private var medtronicUtil: MedtronicUtil? = null
//private var decoder: MedtronicPumpHistoryDecoder? = null
var rxBusWrapper = RxBus(TestAapsSchedulers(), aapsLogger)
@Before fun setup() {
medtronicPumpStatus =

View file

@ -4,8 +4,8 @@ import java.lang.reflect.Type
import com.google.gson.reflect.TypeToken
import com.google.gson.Gson
import com.google.gson.internal.LinkedTreeMap
import dagger.android.AndroidInjector
import dagger.android.HasAndroidInjector
// import dagger.android.AndroidInjector
// import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.TestBase
import info.nightscout.androidaps.interfaces.ActivePlugin
import info.nightscout.androidaps.interfaces.PumpSync
@ -24,28 +24,27 @@ import org.mockito.Mock
class MedtronicHistoryDataUTest : TestBase() {
@Mock lateinit var activePlugin: ActivePlugin
@Mock lateinit var medtronicUtil: MedtronicUtil
@Mock lateinit var medtronicPumpHistoryDecoder: MedtronicPumpHistoryDecoder
//@Mock lateinit var activePlugin: ActivePlugin
//@Mock lateinit var medtronicUtil: MedtronicUtil
//@Mock lateinit var medtronicPumpHistoryDecoder: MedtronicPumpHistoryDecoder
@Mock lateinit var medtronicPumpStatus: MedtronicPumpStatus
@Mock lateinit var pumpSync: PumpSync
@Mock lateinit var pumpSyncStorage: PumpSyncStorage
@Mock lateinit var sp: SP
@Mock lateinit var rh: ResourceHelper
@Mock lateinit var rxBus: RxBus
// @Mock lateinit var pumpSync: PumpSync
// @Mock lateinit var pumpSyncStorage: PumpSyncStorage
private val packetInjector = HasAndroidInjector {
AndroidInjector {
//@Mock lateinit var rxBus: RxBus
}
}
// val packetInjector = HasAndroidInjector {
// AndroidInjector {
//
// }
// }
@Test
fun createTBRProcessList() {
var unitToTest = MedtronicHistoryData(packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
medtronicUtil, medtronicPumpHistoryDecoder,
medtronicUtil, decoder,
medtronicPumpStatus,
pumpSync,
pumpSyncStorage)
@ -72,7 +71,7 @@ class MedtronicHistoryDataUTest : TestBase() {
System.out.println("TBR Pre-Process List: " + gson.toJson(yourClassList))
val createTBRProcessList = unitToTest.createTBRProcessList(yourClassList)
val createTBRProcessList = unitToTest.createTBRProcessList(yourClassList, mutableListOf())
System.out.println("TBR Process List: " + createTBRProcessList.size)
@ -86,7 +85,7 @@ class MedtronicHistoryDataUTest : TestBase() {
fun createTBRProcessList_SpecialCase() {
var unitToTest = MedtronicHistoryData(packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
medtronicUtil, medtronicPumpHistoryDecoder,
medtronicUtil, decoder,
medtronicPumpStatus,
pumpSync,
pumpSyncStorage)
@ -113,7 +112,7 @@ class MedtronicHistoryDataUTest : TestBase() {
System.out.println("TBR Pre-Process List (Special): " + gson.toJson(yourClassList))
val createTBRProcessList = unitToTest.createTBRProcessList(yourClassList)
val createTBRProcessList = unitToTest.createTBRProcessList(yourClassList, mutableListOf())
System.out.println("TBR Process List (Special): " + createTBRProcessList.size)

View file

@ -0,0 +1 @@
33 20 53 78 15 51 16 00 16 01 53 78 15 51 16 33 00 6F 40 16 51 16 00 16 00 6F 40 16 51 16 7B 16 6F 40 16 11 16 2C 1E 00 33 30 71 40 16 51 16 00 16 01 71 40 16 51 16 33 00 6E 45 16 51 16 00 16 00 6E 45 16 51 16 7B 16 6E 45 16 11 16 2C 1E 00 33 3A 70 45 16 51 16 00 16 01 70 45 16 51 16 33 00 71 5E 16 51 16 00 16 00 71 5E 16 51 16 7B 16 71 5E 16 11 16 2C 1E 00 33 40 73 5E 16 51 16 00 16 01 73 5E 16 51 16 33 00 74 6D 16 51 16 00 16 00 74 6D 16 51 16 7B 16 74 6D 16 11 16 2C 1E 00 33 14 76 6D 16 51 16 00 16 01 76 6D 16 51 16 33 00 77 72 16 51 16 00 16 00 77 72 16 51 16 7B 16 77 72 16 11 16 2C 1E 00 7B 17 40 40 17 11 16 2E 1E 00 33 28 51 41 17 51 16 00 16 01 51 41 17 51 16 33 00 56 46 17 51 16 00 16 00 56 46 17 51 16 7B 17 56 46 17 11 16 2E 1E 00 33 34 59 46 17 51 16 00 16 01 59 46 17 51 16 33 00 70 4A 17 51 16 00 16 00 70 4A 17 51 16 7B 17 70 4A 17 11 16 2E 1E 00 33 58 72 4A 17 51 16 00 16 01 72 4A 17 51 16 33 00 6E 59 17 51 16 00 16 00 6E 59 17 51 16 7B 17 6E 59 17 11 16 2E 1E 00 33 18 70 59 17 51 16 00 16 01 70 59 17 51 16 33 00 70 5E 17 51 16 00 16 00 70 5E 17 51 16 7B 17 70 5E 17 11 16 2E 1E 00 33 0C 72 5E 17 51 16 00 16 01 72 5E 17 51 16 33 00 72 63 17 51 16 00 16 00 72 63 17 51 16 7B 17 72 63 17 11 16 2E 1E 00 33 1C 70 72 17 51 16 00 16 01 70 72 17 51 16 33 00 51 78 17 51 16 00 16 00 51 78 17 51 16 7B 17 52 78 17 11 16 2E 1E 00 33 12 54 78 17 51 16 00 16 01 54 78 17 51 16 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4D 6D