StringUtil -> kt

This commit is contained in:
Milos Kozak 2023-09-21 15:27:20 +02:00
parent 120f1d4e03
commit 6fc572cd14
31 changed files with 233 additions and 264 deletions

View file

@ -131,7 +131,7 @@ abstract class MedtronicHistoryEntry : MedtronicHistoryEntryInterface {
// Log.e("", "DT is null. RawData=" + ByteUtil.getHex(rawData))
// }
sb.append(toStringStart)
sb.append(", DT: " + if (dt == null) "null" else StringUtil.getStringInLength(dt, 19))
sb.append(", DT: " + (dt?.let { StringUtil.getStringInLength(it, 19) } ?: "null"))
sb.append(", length=")
sb.append(headLength)
sb.append(",")

View file

@ -90,9 +90,9 @@ class PumpHistoryEntry : MedtronicHistoryEntry() {
// 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))
sb.append(" " + (dt?.let { StringUtil.getStringInLength(it, 19) } ?: "null"))
val hasData = (decodedData.size > 0)
val hasData = (decodedData.isNotEmpty())
if (hasData) {
if (hasDecodedDataEntry("Object")) {
val oo = getDecodedDataEntry("Object")
@ -105,11 +105,11 @@ class PumpHistoryEntry : MedtronicHistoryEntry() {
sb.append(", head=")
sb.append(ByteUtil.shortHexString(head))
}
if (datetime.size != 0) {
if (datetime.isNotEmpty()) {
sb.append(", datetime=")
sb.append(ByteUtil.shortHexString(datetime))
}
if (body.size != 0) {
if (body.isNotEmpty()) {
sb.append(", body=")
sb.append(ByteUtil.shortHexString(body))
}

View file

@ -10,7 +10,6 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.pump.common.sync.PumpSyncStorage
import info.nightscout.pump.common.utils.ByteUtil
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.sharedtests.TestBase
@ -19,7 +18,6 @@ import org.mockito.Mock
open class MedtronicTestBase : TestBase() {
var byteUtil = ByteUtil()
var rileyLinkUtil = RileyLinkUtil()
@Mock lateinit var pumpSync: PumpSync

View file

@ -37,7 +37,7 @@ import org.mockito.Mock
fun setup() {
medtronicPumpStatus = MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil)
medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, uiInteraction)
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil)
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil)
medtronicHistoryData = MedtronicHistoryData(
packetInjector, aapsLogger, sp, rh, rxBus, activePlugin,
medtronicUtil, decoder, medtronicPumpStatus, pumpSync, pumpSyncStorage, uiInteraction

View file

@ -35,7 +35,7 @@ class MedtronicPumpHistoryDecoderUTest : MedtronicTestBase() {
MedtronicPumpStatus(rh, sp, rxBus, rileyLinkUtil)
medtronicUtil =
MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, uiInteraction)
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, ByteUtil())
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil)
}
/*

View file

@ -24,7 +24,7 @@ class MedtronicHistoryDataUTest : MedtronicTestBase() {
@BeforeEach
fun setUp() {
medtronicUtil = MedtronicUtil(aapsLogger, rxBus, rileyLinkUtil, medtronicPumpStatus, uiInteraction)
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil, byteUtil)
decoder = MedtronicPumpHistoryDecoder(aapsLogger, medtronicUtil)
}
@Test

View file

@ -27,7 +27,7 @@ class BasalScheduleExtraCommandTest {
rateEntries);
Assertions.assertArrayEquals( //
ByteUtil.createByteArrayFromHexString("130e40001aea01312d003840005b8d80"), // From https://github.com/openaps/openomni/wiki/Bolus
ByteUtil.INSTANCE.createByteArrayFromHexString("130e40001aea01312d003840005b8d80"), // From https://github.com/openaps/openomni/wiki/Bolus
basalScheduleExtraCommand.getRawData());
}
@ -68,7 +68,7 @@ class BasalScheduleExtraCommandTest {
BasalScheduleExtraCommand basalScheduleExtraCommand = new BasalScheduleExtraCommand(schedule, Duration.standardMinutes((0x2e + 1) * 30).minus(Duration.standardSeconds(0x1be8 / 8)),
false, true, Duration.ZERO);
Assertions.assertArrayEquals(ByteUtil.fromHexString("131a4002009600a7d8c0089d0105944905a001312d00044c0112a880"),
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("131a4002009600a7d8c0089d0105944905a001312d00044c0112a880"),
basalScheduleExtraCommand.getRawData());
}
@ -152,7 +152,7 @@ class BasalScheduleExtraCommandTest {
// recreating the offset, we can have small errors in reproducing the the encoded output, which we really
// don't care about.
byte[] expected = ByteUtil.fromHexString(expectedHexString);
byte[] expected = ByteUtil.INSTANCE.fromHexString(expectedHexString);
Assertions.assertEquals(extractDelayUntilNextPulseInSeconds(expected), extractDelayUntilNextPulseInSeconds(actual), 0.0001);

View file

@ -13,7 +13,7 @@ class BeepConfigCommandTest {
BeepConfigCommand beepConfigCommand = new BeepConfigCommand(BeepConfigType.BIP_BEEP_BIP_BEEP_BIP_BEEP_BIP_BEEP, true,
Duration.ZERO, true, Duration.ZERO,
true, Duration.ZERO);
Assertions.assertArrayEquals(ByteUtil.fromHexString("1e0402404040"), beepConfigCommand.getRawData());
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("1e0402404040"), beepConfigCommand.getRawData());
}
@Test
@ -21,6 +21,6 @@ class BeepConfigCommandTest {
BeepConfigCommand beepConfigCommand = new BeepConfigCommand(BeepConfigType.NO_BEEP, true,
Duration.ZERO, false, Duration.standardMinutes(60),
false, Duration.standardMinutes(60));
Assertions.assertArrayEquals(ByteUtil.fromHexString("1e040f403c3c"), beepConfigCommand.getRawData());
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("1e040f403c3c"), beepConfigCommand.getRawData());
}
}

View file

@ -14,14 +14,14 @@ class BolusExtraCommandTest {
Duration.standardSeconds(2));
Assertions.assertArrayEquals( //
ByteUtil.createByteArrayFromHexString("170d7c00fa00030d40000000000000"), // From https://github.com/openaps/openomni/wiki/Bolus
ByteUtil.INSTANCE.createByteArrayFromHexString("170d7c00fa00030d40000000000000"), // From https://github.com/openaps/openomni/wiki/Bolus
bolusExtraCommand.getRawData());
}
@Test
void testTypicalPrime() {
BolusExtraCommand bolusExtraCommand = new BolusExtraCommand(2.6, Duration.standardSeconds(1), false, false);
Assertions.assertArrayEquals(ByteUtil.fromHexString("170d000208000186a0000000000000"), //
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("170d000208000186a0000000000000"), //
bolusExtraCommand.getRawData());
}
@ -29,7 +29,7 @@ class BolusExtraCommandTest {
void testBolusExtraCommandWithExtraOddPulseCount() {
BolusExtraCommand bolusExtraCommand = new BolusExtraCommand(1.25, 0D, Duration.ZERO, //
false, true, Duration.standardHours(1), Duration.standardSeconds(2));
Assertions.assertArrayEquals(ByteUtil.fromHexString("170d7c00fa00030d40000000000000"), //
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("170d7c00fa00030d40000000000000"), //
bolusExtraCommand.getRawData());
}
@ -37,7 +37,7 @@ class BolusExtraCommandTest {
void testBolusExtraCommandWithExtraOddPulseCount2() {
BolusExtraCommand bolusExtraCommand = new BolusExtraCommand(2.05, 0D, Duration.ZERO, //
false, false, Duration.standardHours(1), Duration.standardSeconds(2));
Assertions.assertArrayEquals(ByteUtil.fromHexString("170d3c019a00030d40000000000000"), //
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("170d3c019a00030d40000000000000"), //
bolusExtraCommand.getRawData());
}
@ -45,7 +45,7 @@ class BolusExtraCommandTest {
void testLargeBolus() {
BolusExtraCommand bolusExtraCommand = new BolusExtraCommand(30D, 0, Duration.ZERO, //
false, true, Duration.standardHours(1), Duration.standardSeconds(2));
Assertions.assertArrayEquals(ByteUtil.fromHexString("170d7c177000030d40000000000000"), //
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("170d7c177000030d40000000000000"), //
bolusExtraCommand.getRawData());
}
@ -53,7 +53,7 @@ class BolusExtraCommandTest {
void testLargeBolus2() {
BolusExtraCommand bolusExtraCommand = new BolusExtraCommand(29.95, 0, Duration.ZERO, //
false, true, Duration.standardHours(1), Duration.standardSeconds(2));
Assertions.assertArrayEquals(ByteUtil.fromHexString("170d7c176600030d40000000000000"), //
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("170d7c176600030d40000000000000"), //
bolusExtraCommand.getRawData());
}

View file

@ -18,7 +18,7 @@ class CancelDeliveryCommandTest {
void testCancelBolusAndBasalWithBeep() {
CancelDeliveryCommand command = new CancelDeliveryCommand(0x10203040, BeepType.BIP_BIP, EnumSet.of(DeliveryType.BASAL, DeliveryType.BOLUS));
byte[] expected = ByteUtil.fromHexString("1F051020304035");
byte[] expected = ByteUtil.INSTANCE.fromHexString("1F051020304035");
Assertions.assertArrayEquals(expected, command.getRawData());
}
@ -26,7 +26,7 @@ class CancelDeliveryCommandTest {
void testCancelBolusWithBeep() {
CancelDeliveryCommand command = new CancelDeliveryCommand(0x4d91f8ff, BeepType.BEEEEEEP, DeliveryType.BOLUS);
byte[] expected = ByteUtil.fromHexString("1f054d91f8ff64");
byte[] expected = ByteUtil.INSTANCE.fromHexString("1f054d91f8ff64");
Assertions.assertArrayEquals(expected, command.getRawData());
}
@ -34,7 +34,7 @@ class CancelDeliveryCommandTest {
void testSuspendBasalCommandWithoutBeep() {
CancelDeliveryCommand command = new CancelDeliveryCommand(0x6fede14a, BeepType.NO_BEEP, DeliveryType.BASAL);
byte[] expected = ByteUtil.fromHexString("1f056fede14a01");
byte[] expected = ByteUtil.INSTANCE.fromHexString("1f056fede14a01");
Assertions.assertArrayEquals(expected, command.getRawData());
}
@ -42,6 +42,6 @@ class CancelDeliveryCommandTest {
@Test
void testCancelTempBasalWithoutBeep() {
CancelDeliveryCommand cancelDeliveryCommand = new CancelDeliveryCommand(0xf76d34c4, BeepType.NO_BEEP, DeliveryType.TEMP_BASAL);
Assertions.assertArrayEquals(ByteUtil.fromHexString("1f05f76d34c402"), cancelDeliveryCommand.getRawData());
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("1f05f76d34c402"), cancelDeliveryCommand.getRawData());
}
}

View file

@ -31,7 +31,7 @@ class ConfigureAlertsCommandTest {
BeepRepeat.EVERY_MINUTE_FOR_15_MINUTES);
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("79a410df0205"), //
ByteUtil.INSTANCE.fromHexString("79a410df0205"), //
alertConfiguration1.getRawData());
Duration hardExpirationTime = Duration.standardHours(79).minus(Duration.standardMinutes(1));
@ -46,7 +46,7 @@ class ConfigureAlertsCommandTest {
BeepRepeat.EVERY_MINUTE_FOR_15_MINUTES);
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("280012830206"), //
ByteUtil.INSTANCE.fromHexString("280012830206"), //
alertConfiguration2.getRawData());
AlertConfiguration alertConfiguration3 = new AlertConfiguration( //
@ -60,7 +60,7 @@ class ConfigureAlertsCommandTest {
BeepRepeat.EVERY_MINUTE_FOR_15_MINUTES);
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("020f00000202"), //
ByteUtil.INSTANCE.fromHexString("020f00000202"), //
alertConfiguration3.getRawData());
ConfigureAlertsCommand configureAlertsCommand = new ConfigureAlertsCommand( //
@ -68,7 +68,7 @@ class ConfigureAlertsCommandTest {
Arrays.asList(alertConfiguration1, alertConfiguration2, alertConfiguration3));
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("1916feb6268b79a410df0205280012830206020f00000202"), //
ByteUtil.INSTANCE.fromHexString("1916feb6268b79a410df0205280012830206020f00000202"), //
configureAlertsCommand.getRawData());
}
@ -89,7 +89,7 @@ class ConfigureAlertsCommandTest {
Collections.singletonList(alertConfiguration));
Assertions.assertArrayEquals(
ByteUtil.fromHexString("190aae01a66c4c0000640102"), //
ByteUtil.INSTANCE.fromHexString("190aae01a66c4c0000640102"), //
configureAlertsCommand.getRawData());
}
}

View file

@ -11,20 +11,20 @@ class GetStatusCommandTest {
void testPodInfoTypeNormal() {
GetStatusCommand getStatusCommand = new GetStatusCommand(PodInfoType.NORMAL);
Assertions.assertArrayEquals(ByteUtil.fromHexString("0e0100"), getStatusCommand.getRawData());
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("0e0100"), getStatusCommand.getRawData());
}
@Test
void testPodInfoTypeConfiguredAlerts() {
GetStatusCommand getStatusCommand = new GetStatusCommand(PodInfoType.ACTIVE_ALERTS);
Assertions.assertArrayEquals(ByteUtil.fromHexString("0e0101"), getStatusCommand.getRawData());
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("0e0101"), getStatusCommand.getRawData());
}
@Test
void testPodInfoTypeFaultEvents() {
GetStatusCommand getStatusCommand = new GetStatusCommand(PodInfoType.DETAILED_STATUS);
Assertions.assertArrayEquals(ByteUtil.fromHexString("0e0102"), getStatusCommand.getRawData());
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("0e0102"), getStatusCommand.getRawData());
}
}

View file

@ -18,18 +18,18 @@ class SetInsulinScheduleCommandTest {
void testTemporaryBasalScheduleAlternatingSegmentFlag() {
SetInsulinScheduleCommand setInsulinScheduleCommand = new SetInsulinScheduleCommand(0x9746c65b, //
0.05, Duration.standardMinutes(30));
Assertions.assertArrayEquals(ByteUtil.fromHexString("1a0e9746c65b01007901384000000000"), //
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("1a0e9746c65b01007901384000000000"), //
setInsulinScheduleCommand.getRawData());
SetInsulinScheduleCommand setInsulinScheduleCommand2 = new SetInsulinScheduleCommand(0x9746c65b, //
0.05, Duration.standardHours(8).plus(Duration.standardMinutes(30)));
Assertions.assertArrayEquals(ByteUtil.fromHexString("1a109746c65b0100911138400000f8000000"), //
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("1a109746c65b0100911138400000f8000000"), //
setInsulinScheduleCommand2.getRawData());
// Test passed before introducing a maximum temp basal duration of 12 hours
// SetInsulinScheduleCommand setInsulinScheduleCommand3 = new SetInsulinScheduleCommand(0x9746c65b, //
// 0.05, Duration.standardHours(16).plus(Duration.standardMinutes(30)));
// assertArrayEquals(ByteUtil.fromHexString("1a129746c65b0100a92138400000f800f8000000"), //
// assertArrayEquals(ByteUtil.INSTANCE.fromHexString("1a129746c65b0100a92138400000f800f8000000"), //
// setInsulinScheduleCommand3.getRawData());
}
@ -39,7 +39,7 @@ class SetInsulinScheduleCommandTest {
0.2, Duration.standardMinutes(30));
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("1a0eea2d0a3b01007d01384000020002"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/TempBasalTests.swift
ByteUtil.INSTANCE.fromHexString("1a0eea2d0a3b01007d01384000020002"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/TempBasalTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -49,7 +49,7 @@ class SetInsulinScheduleCommandTest {
0.05, Duration.standardMinutes(150));
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("1a0e4e2c271701007f05384000004800"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/TempBasalTests.swift
ByteUtil.INSTANCE.fromHexString("1a0e4e2c271701007f05384000004800"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/TempBasalTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -59,7 +59,7 @@ class SetInsulinScheduleCommandTest {
2D, Duration.standardMinutes(90));
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("1a0e87e8d03a0100cb03384000142014"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/TempBasalTests.swift
ByteUtil.INSTANCE.fromHexString("1a0e87e8d03a0100cb03384000142014"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/TempBasalTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -69,7 +69,7 @@ class SetInsulinScheduleCommandTest {
30D, Duration.standardHours(12));
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("1a10a958c5ad0104f5183840012cf12c712c"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/TempBasalTests.swift
ByteUtil.INSTANCE.fromHexString("1a10a958c5ad0104f5183840012cf12c712c"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/TempBasalTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -83,7 +83,7 @@ class SetInsulinScheduleCommandTest {
Duration.standardHours(8).plus(Duration.standardMinutes(15)));
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("1a1201020304000064101c200000f800f800f800"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
ByteUtil.INSTANCE.fromHexString("1a1201020304000064101c200000f800f800f800"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -111,7 +111,7 @@ class SetInsulinScheduleCommandTest {
Duration.standardMinutes((0x03 + 1) * 30).minus(Duration.standardSeconds(0x0ae8 / 8)));
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("1a2af36a23a3000291030ae80000000d280000111809700a180610052806100600072806001128100009e808"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
ByteUtil.INSTANCE.fromHexString("1a2af36a23a3000291030ae80000000d280000111809700a180610052806100600072806001128100009e808"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -140,7 +140,7 @@ class SetInsulinScheduleCommandTest {
Duration.standardMinutes((0x27 + 1) * 30).minus(Duration.standardSeconds(0x1518 / 8)));
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("1a2a851072aa0001dd2715180003000d280000111809700a180610052806100600072806001118101801e808"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
ByteUtil.INSTANCE.fromHexString("1a2a851072aa0001dd2715180003000d280000111809700a180610052806100600072806001118101801e808"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -163,7 +163,7 @@ class SetInsulinScheduleCommandTest {
Duration.standardMinutes((0x28 + 1) * 30).minus(Duration.standardSeconds(0x1af0 / 8)));
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("1a1ec2a32da800053a281af00010181b00ca003200650001f8008800f0230023"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
ByteUtil.INSTANCE.fromHexString("1a1ec2a32da800053a281af00010181b00ca003200650001f8008800f0230023"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -186,7 +186,7 @@ class SetInsulinScheduleCommandTest {
Duration.standardMinutes((0x2c + 1) * 30).minus(Duration.standardSeconds(0x2190 / 8)));
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("1a18851072aa00021b2c21900004f00600071005b8061801e008"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
ByteUtil.INSTANCE.fromHexString("1a18851072aa00021b2c21900004f00600071005b8061801e008"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -211,7 +211,7 @@ class SetInsulinScheduleCommandTest {
Duration.standardMinutes((0x2a + 1) * 30).minus(Duration.standardSeconds(0x1e50 / 8)));
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("1a1a851072aa0002422a1e50000650083009f808380850073009700b"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
ByteUtil.INSTANCE.fromHexString("1a1a851072aa0002422a1e50000650083009f808380850073009700b"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BasalScheduleTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -221,7 +221,7 @@ class SetInsulinScheduleCommandTest {
SetInsulinScheduleCommand setInsulinScheduleCommand = new SetInsulinScheduleCommand(0xbed2e16b, bolusDeliverySchedule);
Assertions.assertArrayEquals( //
ByteUtil.createByteArrayFromHexString("1a0ebed2e16b02010a0101a000340034"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BolusTests.swift
ByteUtil.INSTANCE.createByteArrayFromHexString("1a0ebed2e16b02010a0101a000340034"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BolusTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -231,7 +231,7 @@ class SetInsulinScheduleCommandTest {
SetInsulinScheduleCommand setInsulinScheduleCommand = new SetInsulinScheduleCommand(0xcf9e81ac, bolusDeliverySchedule);
Assertions.assertArrayEquals( //
ByteUtil.createByteArrayFromHexString("1a0ecf9e81ac0200e501029000290029"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BolusTests.swift
ByteUtil.INSTANCE.createByteArrayFromHexString("1a0ecf9e81ac0200e501029000290029"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BolusTests.swift
setInsulinScheduleCommand.getRawData());
}
@ -241,7 +241,7 @@ class SetInsulinScheduleCommandTest {
SetInsulinScheduleCommand setInsulinScheduleCommand = new SetInsulinScheduleCommand(0x31204ba7, bolusDeliverySchedule);
Assertions.assertArrayEquals( //
ByteUtil.createByteArrayFromHexString("1a0e31204ba702014801257002570257"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BolusTests.swift
ByteUtil.INSTANCE.createByteArrayFromHexString("1a0e31204ba702014801257002570257"), // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/BolusTests.swift
setInsulinScheduleCommand.getRawData());
}
}

View file

@ -16,7 +16,7 @@ class SetupPodCommandTest {
240439);
Assertions.assertArrayEquals( //
ByteUtil.fromHexString("03131f00ee87140404050d16340000a3770003ab37"), // From https://github.com/openaps/openomni/wiki/Command-03-Setup-Pod
ByteUtil.INSTANCE.fromHexString("03131f00ee87140404050d16340000a3770003ab37"), // From https://github.com/openaps/openomni/wiki/Command-03-Setup-Pod
setupPodCommand.getRawData());
}

View file

@ -11,7 +11,7 @@ class TempBasalExtraCommandTest {
void testTempBasalExtraCommand() {
TempBasalExtraCommand tempBasalExtraCommand = new TempBasalExtraCommand(30D, Duration.standardMinutes(30),
false, true, Duration.standardHours(1));
Assertions.assertArrayEquals(ByteUtil.fromHexString("160e7c000bb8000927c00bb8000927c0"),
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("160e7c000bb8000927c00bb8000927c0"),
tempBasalExtraCommand.getRawData());
}
@ -19,22 +19,22 @@ class TempBasalExtraCommandTest {
void testBasalExtraCommandForOddPulseCountRate() {
TempBasalExtraCommand tempBasalExtraCommand = new TempBasalExtraCommand(0.05, Duration.standardMinutes(30),
false, true, Duration.standardHours(1));
Assertions.assertArrayEquals(ByteUtil.fromHexString("160e7c00000515752a00000515752a00"),
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("160e7c00000515752a00000515752a00"),
tempBasalExtraCommand.getRawData());
TempBasalExtraCommand tempBasalExtraCommand2 = new TempBasalExtraCommand(2.05, Duration.standardMinutes(30),
false, false, Duration.standardHours(1));
Assertions.assertArrayEquals(ByteUtil.fromHexString("160e3c0000cd0085fac700cd0085fac7"),
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("160e3c0000cd0085fac700cd0085fac7"),
tempBasalExtraCommand2.getRawData());
TempBasalExtraCommand tempBasalExtraCommand3 = new TempBasalExtraCommand(2.10, Duration.standardMinutes(30),
false, false, Duration.standardHours(1));
Assertions.assertArrayEquals(ByteUtil.fromHexString("160e3c0000d20082ca2400d20082ca24"),
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("160e3c0000d20082ca2400d20082ca24"),
tempBasalExtraCommand3.getRawData());
TempBasalExtraCommand tempBasalExtraCommand4 = new TempBasalExtraCommand(2.15, Duration.standardMinutes(30),
false, false, Duration.standardHours(1));
Assertions.assertArrayEquals(ByteUtil.fromHexString("160e3c0000d7007fbf7d00d7007fbf7d"),
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("160e3c0000d7007fbf7d00d7007fbf7d"),
tempBasalExtraCommand4.getRawData());
}
@ -42,7 +42,7 @@ class TempBasalExtraCommandTest {
void testBasalExtraCommandPulseCount() {
TempBasalExtraCommand tempBasalExtraCommand = new TempBasalExtraCommand(27.35, Duration.standardHours(12),
false, false, Duration.ZERO);
Assertions.assertArrayEquals(ByteUtil.fromHexString("16140000f5b9000a0ad7f5b9000a0ad70aaf000a0ad7"),
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("16140000f5b9000a0ad7f5b9000a0ad70aaf000a0ad7"),
tempBasalExtraCommand.getRawData());
}
@ -50,12 +50,12 @@ class TempBasalExtraCommandTest {
void testTempBasalExtraCommandExtremeValues() {
TempBasalExtraCommand tempBasalExtraCommand2 = new TempBasalExtraCommand(29.95, Duration.standardHours(12),
false, false, Duration.standardHours(1));
Assertions.assertArrayEquals(ByteUtil.fromHexString("16143c00f5af00092ba9f5af00092ba9231900092ba9"),
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("16143c00f5af00092ba9f5af00092ba9231900092ba9"),
tempBasalExtraCommand2.getRawData());
TempBasalExtraCommand tempBasalExtraCommand = new TempBasalExtraCommand(30D, Duration.standardHours(12),
false, false, Duration.standardHours(1));
Assertions.assertArrayEquals(ByteUtil.fromHexString("16143c00f618000927c0f618000927c02328000927c0"),
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("16143c00f618000927c0f618000927c02328000927c0"),
tempBasalExtraCommand.getRawData());
}
@ -63,12 +63,12 @@ class TempBasalExtraCommandTest {
void testTempBasalExtraCommandZeroBasal() {
TempBasalExtraCommand tempBasalExtraCommand = new TempBasalExtraCommand(0D, Duration.standardMinutes(30),
false, true, Duration.standardHours(1));
Assertions.assertArrayEquals(ByteUtil.fromHexString("160e7c0000006b49d20000006b49d200"),
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("160e7c0000006b49d20000006b49d200"),
tempBasalExtraCommand.getRawData());
TempBasalExtraCommand tempBasalExtraCommand2 = new TempBasalExtraCommand(0D, Duration.standardHours(3),
false, true, Duration.standardHours(1));
Assertions.assertArrayEquals(ByteUtil.fromHexString("162c7c0000006b49d20000006b49d20000006b49d20000006b49d20000006b49d20000006b49d20000006b49d200"),
Assertions.assertArrayEquals(ByteUtil.INSTANCE.fromHexString("162c7c0000006b49d20000006b49d20000006b49d20000006b49d20000006b49d20000006b49d20000006b49d200"),
tempBasalExtraCommand2.getRawData());
}
}

View file

@ -10,7 +10,7 @@ import info.nightscout.pump.common.utils.ByteUtil;
class ErrorResponseTest {
@Test
void testGetRawData() {
byte[] encodedData = ByteUtil.fromHexString("060314fa92");
byte[] encodedData = ByteUtil.INSTANCE.fromHexString("060314fa92");
ErrorResponse errorResponse = new ErrorResponse(encodedData);
Assertions.assertArrayEquals(encodedData, errorResponse.getRawData());
@ -18,8 +18,8 @@ class ErrorResponseTest {
@Test
void testGetRawDataWithLongerMessage() {
byte[] encodedData = ByteUtil.fromHexString("060314fa9201");
byte[] expected = ByteUtil.fromHexString("060314fa92");
byte[] encodedData = ByteUtil.INSTANCE.fromHexString("060314fa9201");
byte[] expected = ByteUtil.INSTANCE.fromHexString("060314fa92");
ErrorResponse errorResponse = new ErrorResponse(encodedData);
@ -28,7 +28,7 @@ class ErrorResponseTest {
@Test
void testBadNonce() {
byte[] encodedData = ByteUtil.fromHexString("060314fa92");
byte[] encodedData = ByteUtil.INSTANCE.fromHexString("060314fa92");
ErrorResponse errorResponse = new ErrorResponse(encodedData);
Assertions.assertEquals(ErrorResponse.ERROR_RESPONSE_CODE_BAD_NONCE, errorResponse.getErrorResponseCode());
@ -39,7 +39,7 @@ class ErrorResponseTest {
@Test
void testOtherError() {
ErrorResponse errorResponse = new ErrorResponse(ByteUtil.fromHexString("0603101308"));
ErrorResponse errorResponse = new ErrorResponse(ByteUtil.INSTANCE.fromHexString("0603101308"));
Assertions.assertEquals(0x10, errorResponse.getErrorResponseCode());
Assertions.assertEquals(FaultEventCode.MESSAGE_LENGTH_TOO_LONG, errorResponse.getFaultEventCode());
Assertions.assertEquals(PodProgressStatus.ABOVE_FIFTY_UNITS, errorResponse.getPodProgressStatus());

View file

@ -15,7 +15,7 @@ class StatusResponseTest {
@Test
void testRawData() {
byte[] encodedData = ByteUtil.fromHexString("1d080000000038800000");
byte[] encodedData = ByteUtil.INSTANCE.fromHexString("1d080000000038800000");
StatusResponse statusResponse = new StatusResponse(encodedData);
@ -24,8 +24,8 @@ class StatusResponseTest {
@Test
void testRawDataWithLongerMessage() {
byte[] encodedData = ByteUtil.fromHexString("1d08000000003880000001");
byte[] expected = ByteUtil.fromHexString("1d080000000038800000");
byte[] encodedData = ByteUtil.INSTANCE.fromHexString("1d08000000003880000001");
byte[] expected = ByteUtil.INSTANCE.fromHexString("1d080000000038800000");
StatusResponse statusResponse = new StatusResponse(encodedData);
@ -34,7 +34,7 @@ class StatusResponseTest {
@Test
void testWithSampleCapture() {
byte[] bytes = ByteUtil.fromHexString("1d180258f80000146fff"); // From https://github.com/openaps/openomni/wiki/Command-1D-Status-response
byte[] bytes = ByteUtil.INSTANCE.fromHexString("1d180258f80000146fff"); // From https://github.com/openaps/openomni/wiki/Command-1D-Status-response
StatusResponse statusResponse = new StatusResponse(bytes);
assertThat(statusResponse.getDeliveryStatus()).isEqualTo(DeliveryStatus.NORMAL);
@ -47,12 +47,12 @@ class StatusResponseTest {
assertThat(statusResponse.getBolusNotDelivered()).isWithin(0.000001).of(0);
assertThat(statusResponse.getUnacknowledgedAlerts().getAlertSlots()).isEmpty();
assertThat(statusResponse.getRawData()).isEqualTo(ByteUtil.fromHexString("1d180258f80000146fff"));
assertThat(statusResponse.getRawData()).isEqualTo(ByteUtil.INSTANCE.fromHexString("1d180258f80000146fff"));
}
@Test
void testWithSampleCaptureWithChangePodSoonAlert() {
byte[] bytes = ByteUtil.fromHexString("1d19061f6800044295e8"); // From https://github.com/openaps/openomni/wiki/Status-Response-1D-long-run-%28Lytrix%29
byte[] bytes = ByteUtil.INSTANCE.fromHexString("1d19061f6800044295e8"); // From https://github.com/openaps/openomni/wiki/Status-Response-1D-long-run-%28Lytrix%29
StatusResponse statusResponse = new StatusResponse(bytes);
assertThat(statusResponse.getDeliveryStatus()).isEqualTo(DeliveryStatus.NORMAL);
@ -65,12 +65,12 @@ class StatusResponseTest {
assertThat(statusResponse.getBolusNotDelivered()).isWithin(0.000001).of(0);
assertThat(statusResponse.getUnacknowledgedAlerts().getAlertSlots()).containsExactly(AlertSlot.SLOT3);
assertThat(statusResponse.getRawData()).isEqualTo(ByteUtil.fromHexString("1d19061f6800044295e8"));
assertThat(statusResponse.getRawData()).isEqualTo(ByteUtil.INSTANCE.fromHexString("1d19061f6800044295e8"));
}
@Test
void testLargeValues() {
byte[] bytes = ByteUtil.fromHexString("1d11ffffffffffffffff");
byte[] bytes = ByteUtil.INSTANCE.fromHexString("1d11ffffffffffffffff");
StatusResponse statusResponse = new StatusResponse(bytes);
assertThat(statusResponse.getTimeActive().getMillis()).isEqualTo(Duration.standardMinutes(8191).getMillis());
@ -82,12 +82,12 @@ class StatusResponseTest {
assertThat(statusResponse.getPodMessageCounter()).isEqualTo(15);
assertThat(statusResponse.getUnacknowledgedAlerts().getAlertSlots()).hasSize(8);
assertThat(statusResponse.getRawData()).isEqualTo(ByteUtil.fromHexString("1d11ffffffffffffffff"));
assertThat(statusResponse.getRawData()).isEqualTo(ByteUtil.INSTANCE.fromHexString("1d11ffffffffffffffff"));
}
@Test
void testWithReservoirLevel() {
byte[] bytes = ByteUtil.fromHexString("1d19050ec82c08376f98");
byte[] bytes = ByteUtil.INSTANCE.fromHexString("1d19050ec82c08376f98");
StatusResponse statusResponse = new StatusResponse(bytes);
assertThat(statusResponse.getTimeActive()).isEqualTo(Duration.standardMinutes(3547));
@ -99,6 +99,6 @@ class StatusResponseTest {
assertThat(statusResponse.getBolusNotDelivered()).isWithin(0.0001).of(2.2);
assertThat(statusResponse.getPodMessageCounter()).isEqualTo(9);
assertThat(statusResponse.getRawData()).isEqualTo(ByteUtil.fromHexString("1d19050ec82c08376f98"));
assertThat(statusResponse.getRawData()).isEqualTo(ByteUtil.INSTANCE.fromHexString("1d19050ec82c08376f98"));
}
}

View file

@ -9,7 +9,7 @@ import info.nightscout.pump.common.utils.ByteUtil;
class VersionResponseTest {
@Test
void testRawDataAssignAddressVersionResponse() {
byte[] encodedData = ByteUtil.fromHexString("011502070002070002020000a64000097c279c1f08ced2");
byte[] encodedData = ByteUtil.INSTANCE.fromHexString("011502070002070002020000a64000097c279c1f08ced2");
VersionResponse versionResponse = new VersionResponse(encodedData);
Assertions.assertArrayEquals(encodedData, versionResponse.getRawData());
@ -17,8 +17,8 @@ class VersionResponseTest {
@Test
void testRawDataAssignAddressVersionResponseWithLongerMessage() {
byte[] encodedData = ByteUtil.fromHexString("011502070002070002020000a64000097c279c1f08ced201");
byte[] expected = ByteUtil.fromHexString("011502070002070002020000a64000097c279c1f08ced2");
byte[] encodedData = ByteUtil.INSTANCE.fromHexString("011502070002070002020000a64000097c279c1f08ced201");
byte[] expected = ByteUtil.INSTANCE.fromHexString("011502070002070002020000a64000097c279c1f08ced2");
VersionResponse versionResponse = new VersionResponse(encodedData);
Assertions.assertArrayEquals(expected, versionResponse.getRawData());
@ -26,7 +26,7 @@ class VersionResponseTest {
@Test
void testRawDataSetupPodVersionResponse() {
byte[] encodedData = ByteUtil.fromHexString("011b13881008340a5002070002070002030000a3770003ab371f00ee87");
byte[] encodedData = ByteUtil.INSTANCE.fromHexString("011b13881008340a5002070002070002030000a3770003ab371f00ee87");
VersionResponse versionResponse = new VersionResponse(encodedData);
@ -35,8 +35,8 @@ class VersionResponseTest {
@Test
void testRawDataSetupPodVersionResponseWithLongerMessage() {
byte[] encodedData = ByteUtil.fromHexString("011b13881008340a5002070002070002030000a3770003ab371f00ee8701");
byte[] expected = ByteUtil.fromHexString("011b13881008340a5002070002070002030000a3770003ab371f00ee87");
byte[] encodedData = ByteUtil.INSTANCE.fromHexString("011b13881008340a5002070002070002030000a3770003ab371f00ee8701");
byte[] expected = ByteUtil.INSTANCE.fromHexString("011b13881008340a5002070002070002030000a3770003ab371f00ee87");
VersionResponse versionResponse = new VersionResponse(encodedData);
Assertions.assertArrayEquals(expected, versionResponse.getRawData());
@ -44,7 +44,7 @@ class VersionResponseTest {
@Test
void testAssignAddressVersionResponse() {
VersionResponse versionResponse = new VersionResponse(ByteUtil.fromHexString("011502070002070002020000a64000097c279c1f08ced2"));
VersionResponse versionResponse = new VersionResponse(ByteUtil.INSTANCE.fromHexString("011502070002070002020000a64000097c279c1f08ced2"));
Assertions.assertTrue(versionResponse.isAssignAddressVersionResponse());
Assertions.assertFalse(versionResponse.isSetupPodVersionResponse());
@ -59,7 +59,7 @@ class VersionResponseTest {
@Test
void testSetupPodVersionResponse() {
VersionResponse versionResponse = new VersionResponse(ByteUtil.fromHexString("011b13881008340a5002070002070002030000a3770003ab371f00ee87"));
VersionResponse versionResponse = new VersionResponse(ByteUtil.INSTANCE.fromHexString("011b13881008340a5002070002070002030000a3770003ab371f00ee87"));
Assertions.assertFalse(versionResponse.isAssignAddressVersionResponse());
Assertions.assertTrue(versionResponse.isSetupPodVersionResponse());

View file

@ -12,7 +12,7 @@ import info.nightscout.pump.common.utils.ByteUtil;
class PodInfoActiveAlertsTest {
@Test
void testNoActiveAlerts() {
byte[] encodedMessage = ByteUtil.fromHexString("01000000000000000000000000000000000000"); // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/PodInfoTests.swift
byte[] encodedMessage = ByteUtil.INSTANCE.fromHexString("01000000000000000000000000000000000000"); // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/PodInfoTests.swift
PodInfoActiveAlerts podInfoActiveAlerts = new PodInfoActiveAlerts(encodedMessage);
List<PodInfoActiveAlerts.AlertActivation> alertActivations = podInfoActiveAlerts.getAlertActivations();
@ -21,7 +21,7 @@ class PodInfoActiveAlertsTest {
@Test
void testChangePodAfter3Days() {
byte[] encodedMessage = ByteUtil.fromHexString("010000000000000000000000000000000010e1"); // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/PodInfoTests.swift
byte[] encodedMessage = ByteUtil.INSTANCE.fromHexString("010000000000000000000000000000000010e1"); // from https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/PodInfoTests.swift
PodInfoActiveAlerts podInfoActiveAlerts = new PodInfoActiveAlerts(encodedMessage);
List<PodInfoActiveAlerts.AlertActivation> alertActivations = podInfoActiveAlerts.getAlertActivations();

View file

@ -11,7 +11,7 @@ import info.nightscout.pump.common.utils.ByteUtil;
class PodInfoDataLogTest {
@Test
void testDecoding() {
PodInfoDataLog podInfoDataLog = new PodInfoDataLog(ByteUtil.fromHexString("030100010001043c"), 8); // From https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/PodInfoTests.swift
PodInfoDataLog podInfoDataLog = new PodInfoDataLog(ByteUtil.INSTANCE.fromHexString("030100010001043c"), 8); // From https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/PodInfoTests.swift
assertThat(podInfoDataLog.getFaultEventCode()).isEqualTo(FaultEventCode.FAILED_FLASH_ERASE);
assertThat(podInfoDataLog.getTimeFaultEvent()).isEqualTo(Duration.standardMinutes(1));

View file

@ -17,7 +17,7 @@ import info.nightscout.pump.common.utils.ByteUtil;
class PodInfoDetailedStatusTest {
@Test
void testPodInfoFaultEventNoFaultAlerts() {
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.fromHexString("02080100000a003800000003ff008700000095ff0000"));
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.INSTANCE.fromHexString("02080100000a003800000003ff008700000095ff0000"));
assertThat(podInfoDetailedStatus.getPodProgressStatus()).isEqualTo(PodProgressStatus.ABOVE_FIFTY_UNITS);
assertThat(podInfoDetailedStatus.getDeliveryStatus()).isEqualTo(DeliveryStatus.NORMAL);
@ -38,7 +38,7 @@ class PodInfoDetailedStatusTest {
@Test
void testPodInfoFaultEventDeliveryErrorDuringPriming() {
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.fromHexString("020f0000000900345c000103ff0001000005ae056029"));
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.INSTANCE.fromHexString("020f0000000900345c000103ff0001000005ae056029"));
assertThat(podInfoDetailedStatus.getPodProgressStatus()).isEqualTo(PodProgressStatus.INACTIVE);
assertThat(podInfoDetailedStatus.getDeliveryStatus()).isEqualTo(DeliveryStatus.SUSPENDED);
@ -62,7 +62,7 @@ class PodInfoDetailedStatusTest {
@Test
void testPodInfoFaultEventErrorShuttingDown() {
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.fromHexString("020d0000000407f28609ff03ff0a0200000823080000"));
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.INSTANCE.fromHexString("020d0000000407f28609ff03ff0a0200000823080000"));
assertThat(podInfoDetailedStatus.getPodProgressStatus()).isEqualTo(PodProgressStatus.FAULT_EVENT_OCCURRED);
assertThat(podInfoDetailedStatus.getDeliveryStatus()).isEqualTo(DeliveryStatus.SUSPENDED);
@ -87,7 +87,7 @@ class PodInfoDetailedStatusTest {
@Test
void testPodInfoFaultEventInsulinNotDelivered() {
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.fromHexString("020f0000010200ec6a026803ff026b000028a7082023"));
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.INSTANCE.fromHexString("020f0000010200ec6a026803ff026b000028a7082023"));
assertThat(podInfoDetailedStatus.getPodProgressStatus()).isEqualTo(PodProgressStatus.INACTIVE);
assertThat(podInfoDetailedStatus.getDeliveryStatus()).isEqualTo(DeliveryStatus.SUSPENDED);
@ -112,7 +112,7 @@ class PodInfoDetailedStatusTest {
@Test
void testPodInfoFaultEventMaxBolusNotDelivered() {
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.fromHexString("020f00ffff0200ec6a026803ff026b000028a7082023"));
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.INSTANCE.fromHexString("020f00ffff0200ec6a026803ff026b000028a7082023"));
assertThat(podInfoDetailedStatus.getPodProgressStatus()).isEqualTo(PodProgressStatus.INACTIVE);
assertThat(podInfoDetailedStatus.getDeliveryStatus()).isEqualTo(DeliveryStatus.SUSPENDED);
@ -137,7 +137,7 @@ class PodInfoDetailedStatusTest {
@Test
void testPodInfoFaultEventInsulinStateTableCorruptionFoundDuringErrorLogging() {
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.fromHexString("020D00000000000012FFFF03FF00160000879A070000"));
PodInfoDetailedStatus podInfoDetailedStatus = new PodInfoDetailedStatus(ByteUtil.INSTANCE.fromHexString("020D00000000000012FFFF03FF00160000879A070000"));
assertThat(podInfoDetailedStatus.getPodProgressStatus()).isEqualTo(PodProgressStatus.FAULT_EVENT_OCCURRED);
assertThat(podInfoDetailedStatus.getDeliveryStatus()).isEqualTo(DeliveryStatus.SUSPENDED);

View file

@ -12,7 +12,7 @@ import info.nightscout.pump.common.utils.ByteUtil;
class PodInfoFaultAndInitializationTimeTest {
@Test
void testDecoding() {
PodInfoFaultAndInitializationTime podInfoFaultAndInitializationTime = new PodInfoFaultAndInitializationTime(ByteUtil.fromHexString("059200010000000000000000091912170e")); // From https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/PodInfoTests.swift
PodInfoFaultAndInitializationTime podInfoFaultAndInitializationTime = new PodInfoFaultAndInitializationTime(ByteUtil.INSTANCE.fromHexString("059200010000000000000000091912170e")); // From https://github.com/ps2/rileylink_ios/blob/omnipod-testing/OmniKitTests/PodInfoTests.swift
assertThat(podInfoFaultAndInitializationTime.getFaultEventCode()).isEqualTo(FaultEventCode.BAD_PUMP_REQ_2_STATE);
assertThat(podInfoFaultAndInitializationTime.getTimeFaultEvent()).isEqualTo(Duration.standardMinutes(1));

View file

@ -8,7 +8,7 @@ import info.nightscout.pump.common.utils.ByteUtil;
class PodInfoRecentPulseLogTest {
@Test
void testDecoding() {
PodInfoRecentPulseLog podInfoRecentPulseLog = new PodInfoRecentPulseLog(ByteUtil.fromHexString("3d313b004030350045303a00483033004d313a005031310054313f00583038805d302d806030368001313b800c3033801130388014313480193138801c313280213039802431360029313d002c31390031303f0034313900393140003c31390041313e00443137004905723a80087335800d733a801073358015733a80187235801d7338802073338025733a00287235002d723b003072360035703b00383134"), 160);
PodInfoRecentPulseLog podInfoRecentPulseLog = new PodInfoRecentPulseLog(ByteUtil.INSTANCE.fromHexString("3d313b004030350045303a00483033004d313a005031310054313f00583038805d302d806030368001313b800c3033801130388014313480193138801c313280213039802431360029313d002c31390031303f0034313900393140003c31390041313e00443137004905723a80087335800d733a801073358015733a80187235801d7338802073338025733a00287235002d723b003072360035703b00383134"), 160);
Assertions.assertEquals(39, podInfoRecentPulseLog.getDwords().size());
}

View file

@ -381,6 +381,7 @@ object ByteUtil {
}
// 000300050100C800A0
@JvmOverloads
fun createByteArrayFromCompactString(dataFull: String, startIndex: Int = 0, length: Int = dataFull.length): ByteArray {
var data = dataFull.substring(startIndex)
data = data.substring(0, length)

View file

@ -1,121 +0,0 @@
package info.nightscout.pump.common.utils;
import org.joda.time.LocalDateTime;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
/**
* Created by geoff on 4/28/15.
* modified by Andy
*/
public class StringUtil {
public static DecimalFormat[] DecimalFormatters = {
new DecimalFormat("#0"), new DecimalFormat("#0.0"), new DecimalFormat("#0.00"), new DecimalFormat("#0.000")};
public static String fromBytes(byte[] ra) {
if (ra == null)
return "null array";
else
return new String(ra, StandardCharsets.UTF_8);
}
// these should go in some project-wide string utils package
public static String join(ArrayList<String> ra, String joiner) {
int sz = ra.size();
String rval = "";
int n;
for (n = 0; n < sz; n++) {
rval = rval + ra.get(n);
if (n < sz - 1) {
rval = rval + joiner;
}
}
return rval;
}
public static String testJoin() {
ArrayList<String> ra = new ArrayList<>();
ra.add("one");
ra.add("two");
ra.add("three");
return join(ra, "+");
}
/**
* Append To StringBuilder
*
* @param stringBuilder
* @param stringToAdd
* @param delimiter
* @return
*/
public static void appendToStringBuilder(StringBuilder stringBuilder, String stringToAdd, String delimiter) {
if (stringBuilder.length() > 0) {
stringBuilder.append(delimiter + stringToAdd);
} else {
stringBuilder.append(stringToAdd);
}
}
public static String getFormattedValueUS(Number value, int decimals) {
return DecimalFormatters[decimals].format(value).replace(",", ".");
}
public static String getLeadingZero(int number, int places) {
String nn = "" + number;
while (nn.length() < places) {
nn = "0" + nn;
}
return nn;
}
public static String toDateTimeString(LocalDateTime localDateTime) {
return localDateTime.toString("dd.MM.yyyy HH:mm:ss");
}
public static String getStringInLength(String value, int length) {
StringBuilder val = new StringBuilder(value);
if (val.length() > length) {
return val.substring(0, length);
}
for (int i = val.length(); i < length; i++) {
val.append(" ");
}
return val.toString();
}
public static List<String> splitString(String s, int characters) {
List<String> outString = new ArrayList<>();
do {
if (s.length() > characters) {
String token = s.substring(0, characters);
outString.add(token);
s = s.substring(characters);
}
} while (s.length() > characters);
outString.add(s);
return outString;
}
}

View file

@ -0,0 +1,57 @@
package info.nightscout.pump.common.utils
import java.nio.charset.StandardCharsets
import java.text.DecimalFormat
object StringUtil {
private var DecimalFormatters = arrayOf(
DecimalFormat("#0"), DecimalFormat("#0.0"), DecimalFormat("#0.00"), DecimalFormat("#0.000")
)
fun fromBytes(ra: ByteArray?): String =
if (ra == null) "null array"
else String(ra, StandardCharsets.UTF_8)
/**
* Append To StringBuilder
*
* @param stringBuilder
* @param stringToAdd
* @param delimiter
* @return
*/
fun appendToStringBuilder(stringBuilder: StringBuilder, stringToAdd: String, delimiter: String): StringBuilder =
if (stringBuilder.isNotEmpty()) stringBuilder.append(delimiter + stringToAdd)
else stringBuilder.append(stringToAdd)
fun getFormattedValueUS(value: Number?, decimals: Int): String =
DecimalFormatters[decimals].format(value).replace(",", ".")
fun getLeadingZero(number: Int, places: Int): String {
var nn = "" + number
while (nn.length < places) nn = "0$nn"
return nn
}
fun getStringInLength(value: String, length: Int): String {
val v = StringBuilder(value)
if (v.length > length) return v.substring(0, length)
for (i in v.length until length) v.append(" ")
return v.toString()
}
fun splitString(str: String, characters: Int): List<String> {
var s = str
val outString: MutableList<String> = ArrayList()
do {
if (s.length > characters) {
val token = s.substring(0, characters)
outString.add(token)
s = s.substring(characters)
}
} while (s.length > characters)
outString.add(s)
return outString
}
}

View file

@ -0,0 +1,38 @@
package info.nightscout.pump.common.utils
import com.google.common.truth.Truth.assertThat
import org.junit.jupiter.api.Test
internal class StringUtilTest {
@Test fun fromBytes() {
assertThat(StringUtil.fromBytes(null)).isEqualTo("null array")
assertThat(StringUtil.fromBytes(byteArrayOf('a'.code.toByte(), 'b'.code.toByte(), 'c'.code.toByte()))).isEqualTo("abc")
}
@Test fun appendToStringBuilder() {
val sb = StringBuilder()
StringUtil.appendToStringBuilder(sb, "a", ",")
assertThat(sb.toString()).isEqualTo("a")
StringUtil.appendToStringBuilder(sb, "b", ",")
assertThat(sb.toString()).isEqualTo("a,b")
}
@Test fun getFormattedValueUS() {
assertThat(StringUtil.getFormattedValueUS(3.2, 3)).isEqualTo("3.200")
}
@Test fun getLeadingZero() {
assertThat(StringUtil.getLeadingZero(5, 3)).isEqualTo("005")
}
@Test fun getStringInLength() {
assertThat(StringUtil.getStringInLength("a", 3)).isEqualTo("a ")
assertThat(StringUtil.getStringInLength("abcdef", 3)).isEqualTo("abc")
}
@Test fun splitString() {
assertThat(StringUtil.splitString("abcdefgh", 2)[0]).isEqualTo("ab")
assertThat(StringUtil.splitString("abcdefghi", 2)[4]).isEqualTo("i")
}
}

View file

@ -152,7 +152,7 @@ public class RFSpy {
public String getVersion() {
BLECommOperationResult result = rileyLinkBle.readCharacteristicBlocking(radioServiceUUID, radioVersionUUID);
if (result.resultCode == BLECommOperationResult.RESULT_SUCCESS) {
String version = StringUtil.fromBytes(result.value);
String version = StringUtil.INSTANCE.fromBytes(result.value);
aapsLogger.debug(LTag.PUMPBTCOMM, "BLE Version: " + version);
return version;
} else {
@ -175,7 +175,7 @@ public class RFSpy {
if (response != null) { // && response[0] == (byte) 0xDD) {
String versionString = StringUtil.fromBytes(response);
String versionString = StringUtil.INSTANCE.fromBytes(response);
if (versionString.length() > 3) {
if (versionString.indexOf('s') >= 0) {
versionString = versionString.substring(versionString.indexOf('s'));

View file

@ -11,12 +11,10 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLin
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.pump.common.utils.StringUtil
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import info.nightscout.shared.utils.DateUtil
import org.joda.time.LocalDateTime
import javax.inject.Inject
class RileyLinkStatusGeneralFragment : DaggerFragment() {
@ -85,7 +83,7 @@ class RileyLinkStatusGeneralFragment : DaggerFragment() {
}
val lastConnectionTimeMillis = rileyLinkPumpDevice.lastConnectionTimeMillis
if (lastConnectionTimeMillis == 0L) binding.lastDeviceContact.text = rh.gs(R.string.riley_link_ble_config_connected_never)
else binding.lastDeviceContact.text = StringUtil.toDateTimeString(LocalDateTime(lastConnectionTimeMillis))
else binding.lastDeviceContact.text = dateUtil.dateAndTimeAndSecondsString(lastConnectionTimeMillis)
}
companion object {

View file

@ -29,28 +29,26 @@ public class RFToolsParametrizedUTest {
public static Collection<Object[]> data() {
return Arrays
.asList(new Object[][]{ //
{ByteUtil.createByteArrayFromCompactString("00"), ByteUtil.createByteArrayFromCompactString("5555")},
{ByteUtil.INSTANCE.createByteArrayFromCompactString("00"), ByteUtil.INSTANCE.createByteArrayFromCompactString("5555")},
//
{
ByteUtil.createByteArrayFromCompactString("0000"),
ByteUtil.createByteArrayFromCompactString("555555")}, //
ByteUtil.INSTANCE.createByteArrayFromCompactString("0000"),
ByteUtil.INSTANCE.createByteArrayFromCompactString("555555")}, //
{
ByteUtil.createByteArrayFromCompactString("A71289865D00BE"),
ByteUtil.createByteArrayFromCompactString("A96C726996A694D5552CE5")}, //
ByteUtil.INSTANCE.createByteArrayFromCompactString("A71289865D00BE"),
ByteUtil.INSTANCE.createByteArrayFromCompactString("A96C726996A694D5552CE5")}, //
{
ByteUtil.createByteArrayFromCompactString("A7128986060015"),
ByteUtil.createByteArrayFromCompactString("A96C726996A6566555C655")}, //
ByteUtil.INSTANCE.createByteArrayFromCompactString("A7128986060015"),
ByteUtil.INSTANCE.createByteArrayFromCompactString("A96C726996A6566555C655")}, //
{
ByteUtil.createByteArrayFromCompactString("A7128986150956"),
ByteUtil.createByteArrayFromCompactString("A96C726996A6C655599665")}, //
ByteUtil.INSTANCE.createByteArrayFromCompactString("A7128986150956"),
ByteUtil.INSTANCE.createByteArrayFromCompactString("A96C726996A6C655599665")}, //
{
ByteUtil.createByteArrayFromCompactString("A71289868D00B0"),
ByteUtil.createByteArrayFromCompactString("A96C726996A668D5552D55")}, //
ByteUtil.INSTANCE.createByteArrayFromCompactString("A71289868D00B0"),
ByteUtil.INSTANCE.createByteArrayFromCompactString("A96C726996A668D5552D55")}, //
{
ByteUtil
.createByteArrayFromCompactString("A71289868D090337323200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000039"),
ByteUtil
.createByteArrayFromCompactString("A96C726996A668D5595638D68F28F25555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555558D95")
ByteUtil.INSTANCE.createByteArrayFromCompactString("A71289868D090337323200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000039"),
ByteUtil.INSTANCE.createByteArrayFromCompactString("A96C726996A668D5595638D68F28F25555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555558D95")
//
}, //
});
@ -72,22 +70,22 @@ public class RFToolsParametrizedUTest {
// byte[] s1 = { 0, 1, 2 };
// byte[] s2 = { 2, 1, 0, 3 };
// byte[] s3 = { 0, 1, 2, 3 };
// if (ByteUtil.compare(s1, s1) != 0) {
// if (ByteUtil.INSTANCE.compare(s1, s1) != 0) {
// LOG.error("test: compare failed.");
// }
// if (ByteUtil.compare(s1, s2) >= 0) {
// if (ByteUtil.INSTANCE.compare(s1, s2) >= 0) {
// LOG.error("test: compare failed.");
// }
// if (ByteUtil.compare(s2, s1) <= 0) {
// if (ByteUtil.INSTANCE.compare(s2, s1) <= 0) {
// LOG.error("test: compare failed.");
// }
// if (ByteUtil.compare(s1, s3) >= 0) {
// if (ByteUtil.INSTANCE.compare(s1, s3) >= 0) {
// LOG.error("test: compare failed.");
// }
// testCompose(new byte[] {(byte)0xa7, (byte)0xa7});
byte[] bs = decoder.encode4b6b(new byte[]{(byte) 0xa7});
byte[] out = new byte[]{(byte) (0xa9), 0x65};
if (ByteUtil.compare(bs, out) != 0) {
if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
Log.e(
TAG,
"encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -96,7 +94,7 @@ public class RFToolsParametrizedUTest {
}
bs = decoder.encode4b6b(new byte[]{(byte) 0xa7, 0x12});
out = new byte[]{(byte) (0xa9), 0x6c, 0x72};
if (ByteUtil.compare(bs, out) != 0) {
if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
Log.e(
TAG,
"encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -105,7 +103,7 @@ public class RFToolsParametrizedUTest {
}
bs = decoder.encode4b6b(new byte[]{(byte) 0xa7, 0x12, (byte) 0xa7});
out = new byte[]{(byte) (0xa9), 0x6c, 0x72, (byte) 0xa9, 0x65};
if (ByteUtil.compare(bs, out) != 0) {
if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
Log.e(
TAG,
"encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -125,7 +123,7 @@ public class RFToolsParametrizedUTest {
byte[] encodedX = decoder.encode4b6b(this.decoded);
// if (ByteUtil.compare(encodedX, this.encoded) != 0) {
// if (ByteUtil.INSTANCE.compare(encodedX, this.encoded) != 0) {
// Assert.assertEquals(encodedX, encoded);
// }

View file

@ -20,22 +20,22 @@ class RFToolsUTest {
// // byte[] s1 = { 0, 1, 2 };
// // byte[] s2 = { 2, 1, 0, 3 };
// // byte[] s3 = { 0, 1, 2, 3 };
// // if (ByteUtil.compare(s1, s1) != 0) {
// // if (ByteUtil.INSTANCE.compare(s1, s1) != 0) {
// // LOG.error("test: compare failed.");
// // }
// // if (ByteUtil.compare(s1, s2) >= 0) {
// // if (ByteUtil.INSTANCE.compare(s1, s2) >= 0) {
// // LOG.error("test: compare failed.");
// // }
// // if (ByteUtil.compare(s2, s1) <= 0) {
// // if (ByteUtil.INSTANCE.compare(s2, s1) <= 0) {
// // LOG.error("test: compare failed.");
// // }
// // if (ByteUtil.compare(s1, s3) >= 0) {
// // if (ByteUtil.INSTANCE.compare(s1, s3) >= 0) {
// // LOG.error("test: compare failed.");
// // }
// // testCompose(new byte[] {(byte)0xa7, (byte)0xa7});
// byte[] bs = RFTools.encode4b6b(new byte[] { (byte)0xa7 });
// byte[] out = new byte[] { (byte)(0xa9), 0x65 };
// if (ByteUtil.compare(bs, out) != 0) {
// if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
// Log.e(
// TAG,
// "encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -44,7 +44,7 @@ class RFToolsUTest {
// }
// bs = RFTools.encode4b6b(new byte[] { (byte)0xa7, 0x12 });
// out = new byte[] { (byte)(0xa9), 0x6c, 0x72 };
// if (ByteUtil.compare(bs, out) != 0) {
// if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
// Log.e(
// TAG,
// "encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -53,7 +53,7 @@ class RFToolsUTest {
// }
// bs = RFTools.encode4b6b(new byte[] { (byte)0xa7, 0x12, (byte)0xa7 });
// out = new byte[] { (byte)(0xa9), 0x6c, 0x72, (byte)0xa9, 0x65 };
// if (ByteUtil.compare(bs, out) != 0) {
// if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
// Log.e(
// TAG,
// "encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -75,16 +75,16 @@ class RFToolsUTest {
// // byte[] s1 = { 0, 1, 2 };
// // byte[] s2 = { 2, 1, 0, 3 };
// // byte[] s3 = { 0, 1, 2, 3 };
// // if (ByteUtil.compare(s1, s1) != 0) {
// // if (ByteUtil.INSTANCE.compare(s1, s1) != 0) {
// // LOG.error("test: compare failed.");
// // }
// // if (ByteUtil.compare(s1, s2) >= 0) {
// // if (ByteUtil.INSTANCE.compare(s1, s2) >= 0) {
// // LOG.error("test: compare failed.");
// // }
// // if (ByteUtil.compare(s2, s1) <= 0) {
// // if (ByteUtil.INSTANCE.compare(s2, s1) <= 0) {
// // LOG.error("test: compare failed.");
// // }
// // if (ByteUtil.compare(s1, s3) >= 0) {
// // if (ByteUtil.INSTANCE.compare(s1, s3) >= 0) {
// // LOG.error("test: compare failed.");
// // }
// // testCompose(new byte[] {(byte)0xa7, (byte)0xa7});
@ -93,7 +93,7 @@ class RFToolsUTest {
//
// System.out.println("EncodeGo: " + ByteUtil.getHex(bs));
//
// if (ByteUtil.compare(bs, out) != 0) {
// if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
// Log.e(
// TAG,
// "encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -103,7 +103,7 @@ class RFToolsUTest {
//
// bs = RFTools.encode4b6b_go(new byte[] { (byte)0xa7, 0x12 });
// out = new byte[] { (byte)(0xa9), 0x6c, 0x72 };
// if (ByteUtil.compare(bs, out) != 0) {
// if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
// Log.e(
// TAG,
// "encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -113,7 +113,7 @@ class RFToolsUTest {
//
// bs = RFTools.encode4b6b_go(new byte[] { (byte)0xa7, 0x12, (byte)0xa7 });
// out = new byte[] { (byte)(0xa9), 0x6c, 0x72, (byte)0xa9, 0x65 };
// if (ByteUtil.compare(bs, out) != 0) {
// if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
// Log.e(
// TAG,
// "encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -130,7 +130,7 @@ class RFToolsUTest {
// // testCompose(new byte[] {(byte)0xa7, (byte)0xa7});
// byte[] bs = RFTools.encode4b6b(new byte[] { (byte)0xa7 });
// byte[] out = new byte[] { (byte)(0xa9), 0x65 };
// if (ByteUtil.compare(bs, out) != 0) {
// if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
// Log.e(
// TAG,
// "encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -139,7 +139,7 @@ class RFToolsUTest {
//
// byte[] back = RFTools.decode4b6b(out);
//
// if (ByteUtil.compare(back, bs) != 0) {
// if (ByteUtil.INSTANCE.compare(back, bs) != 0) {
// Log.e(
// TAG,
// "decode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -149,7 +149,7 @@ class RFToolsUTest {
//
// bs = RFTools.encode4b6b(new byte[] { (byte)0xa7, 0x12 });
// out = new byte[] { (byte)(0xa9), 0x6c, 0x72 };
// if (ByteUtil.compare(bs, out) != 0) {
// if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
// Log.e(
// TAG,
// "encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -158,7 +158,7 @@ class RFToolsUTest {
//
// back = RFTools.decode4b6b(out);
//
// if (ByteUtil.compare(back, bs) != 0) {
// if (ByteUtil.INSTANCE.compare(back, bs) != 0) {
// Log.e(
// TAG,
// "decode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -168,7 +168,7 @@ class RFToolsUTest {
//
// bs = RFTools.encode4b6b(new byte[] { (byte)0xa7, 0x12, (byte)0xa7 });
// out = new byte[] { (byte)(0xa9), 0x6c, 0x72, (byte)0xa9, 0x65 };
// if (ByteUtil.compare(bs, out) != 0) {
// if (ByteUtil.INSTANCE.compare(bs, out) != 0) {
// Log.e(
// TAG,
// "encode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "
@ -177,7 +177,7 @@ class RFToolsUTest {
//
// back = RFTools.decode4b6b(out);
//
// if (ByteUtil.compare(back, bs) != 0) {
// if (ByteUtil.INSTANCE.compare(back, bs) != 0) {
// Log.e(
// TAG,
// "decode Data failed: expected " + ByteUtil.INSTANCE.shortHexString(out) + " but got "