Merge pull request #125 from AAPS-Omnipod/omnipod_eros_dev_upstream_merge

Improve RileyLink version detection
This commit is contained in:
Milos Kozak 2020-12-18 23:45:36 +01:00 committed by GitHub
commit 54a81458c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 194 additions and 60 deletions

View file

@ -246,7 +246,7 @@ dependencies {
testImplementation "junit:junit:$junit_version"
testImplementation 'org.json:json:20200518'
testImplementation "org.mockito:mockito-core:2.8.47"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4-rule:${powermockVersion}"

View file

@ -23,6 +23,7 @@ buildscript {
work_version = '2.4.0'
junit_version = '4.13.1'
mockitoVersion = '2.8.47'
powermockVersion = "1.7.3"
dexmakerVersion = "1.2"
retrofit2Version = '2.9.0'

View file

@ -59,7 +59,7 @@ dependencies {
kapt "com.google.dagger:dagger-compiler:$dagger_version"
testImplementation "junit:junit:$junit_version"
testImplementation "org.mockito:mockito-core:2.8.47"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testImplementation "org.powermock:powermock-api-mockito2:$powermockVersion"
testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
testImplementation 'joda-time:joda-time:2.10.6'

View file

@ -50,6 +50,9 @@ dependencies {
kapt "com.google.dagger:dagger-compiler:$dagger_version"
testImplementation "junit:junit:$junit_version"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
androidTestImplementation "androidx.test.ext:junit:$androidx_junit"
androidTestImplementation "androidx.test:rules:$androidx_rules"
}

View file

@ -98,7 +98,9 @@ public class RFSpy {
// firmware version
public void initializeRileyLink() {
bleVersion = getVersion();
rileyLinkServiceData.firmwareVersion = getFirmwareVersion();
String cc1110Version = getCC1110Version();
rileyLinkServiceData.versionCC110 = cc1110Version;
rileyLinkServiceData.firmwareVersion = getFirmwareVersion(aapsLogger, bleVersion, cc1110Version);
}
@ -123,15 +125,7 @@ public class RFSpy {
}
}
public boolean isRileyLinkStillAvailable() {
RileyLinkFirmwareVersion firmwareVersion = getFirmwareVersion();
return (firmwareVersion != RileyLinkFirmwareVersion.UnknownVersion);
}
private RileyLinkFirmwareVersion getFirmwareVersion() {
private String getCC1110Version() {
aapsLogger.debug(LTag.PUMPBTCOMM, "Firmware Version. Get Version - Start");
for (int i = 0; i < 5; i++) {
@ -146,19 +140,29 @@ public class RFSpy {
if (response != null) { // && response[0] == (byte) 0xDD) {
String versionString = StringUtil.fromBytes(response);
RileyLinkFirmwareVersion version = RileyLinkFirmwareVersion.getByVersionString(StringUtil
.fromBytes(response));
aapsLogger.debug(LTag.PUMPBTCOMM, "Firmware Version string: {}, resolved to {}.", versionString, version);
if (version != RileyLinkFirmwareVersion.UnknownVersion)
return version;
if (versionString.length() > 3) {
if (versionString.indexOf('s') >= 0) {
versionString = versionString.substring(versionString.indexOf('s'));
}
return versionString;
}
SystemClock.sleep(1000);
}
}
return null;
}
static RileyLinkFirmwareVersion getFirmwareVersion(AAPSLogger aapsLogger, String bleVersion, String cc1110Version) {
if (cc1110Version != null) {
RileyLinkFirmwareVersion version = RileyLinkFirmwareVersion.getByVersionString(cc1110Version);
aapsLogger.debug(LTag.PUMPBTCOMM, "Firmware Version string: {}, resolved to {}.", cc1110Version, version);
if (version != RileyLinkFirmwareVersion.UnknownVersion) {
return version;
}
}
aapsLogger.error(LTag.PUMPBTCOMM, "Firmware Version can't be determined. Checking with BLE Version [{}].", bleVersion);
if (bleVersion.contains(" 2.")) {
@ -168,7 +172,6 @@ public class RFSpy {
return RileyLinkFirmwareVersion.UnknownVersion;
}
private byte[] writeToDataRaw(byte[] bytes, int responseTimeout_ms) {
SystemClock.sleep(100);
// FIXME drain read queue?
@ -373,7 +376,7 @@ public class RFSpy {
private void setMedtronicEncoding() {
RileyLinkEncodingType encoding = RileyLinkEncodingType.FourByteSixByteLocal;
if (RileyLinkFirmwareVersion.isSameVersion(rileyLinkServiceData.firmwareVersion, RileyLinkFirmwareVersion.Version2AndHigher)) {
if (rileyLinkServiceData.firmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher)) {
if (sp.getString(RileyLinkConst.Prefs.Encoding, "None")
.equals(resourceHelper.gs(R.string.key_medtronic_pump_encoding_4b6b_rileylink))) {
encoding = RileyLinkEncodingType.FourByteSixByteRileyLink;

View file

@ -74,8 +74,7 @@ public class RadioResponse {
}
byte[] encodedPayload;
if (RileyLinkFirmwareVersion.isSameVersion(rileyLinkServiceData.versionCC110,
RileyLinkFirmwareVersion.Version2AndHigher)) {
if (rileyLinkServiceData.firmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher)) {
encodedPayload = ByteUtil.substring(rxData, 3, rxData.length - 3);
rssi = rxData[1];
responseNumber = rxData[2];

View file

@ -1,6 +1,9 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -10,19 +13,22 @@ public enum RileyLinkFirmwareVersion {
Version_0_0(0, 0, "0.0"), // just for defaulting
Version_0_9(0, 9, "0.9"), //
Version_1_0(1, 0, "1.0"), //
Version_1_x(1, null, "1.x"), //
Version_2_0(2, 0, "2.0"), //
Version_2_2(2, 2, "2.2"), //
Version_3_x(3, 0, "3.x"), //
Version_4_x(4, 0, "4.x"), //
UnknownVersion(0, 0, "???"), //
Version1(Version_0_0, Version_0_9, Version_1_0), //
Version2(Version_2_0, Version_2_2), //
Version2AndHigher(Version_2_0, Version_2_2, Version_3_x, Version_4_x), //
;
Version_2_x(2, null, "2.x"), //
Version_3_x(3, null, "3.x"), //
Version_4_x(4, null, "4.x"), //
UnknownVersion(null, null, "???"), //
Version1(Version_0_0, Version_0_9, Version_1_0, Version_1_x), //
Version2(Version_2_0, Version_2_2, Version_2_x), //
Version3(Version_3_x), //
Version4(Version_4_x), //
Version2AndHigher(Version2, Version3, Version4);
private static final String FIRMWARE_IDENTIFICATION_PREFIX = "subg_rfspy ";
private static final Pattern _version_pattern = Pattern.compile(FIRMWARE_IDENTIFICATION_PREFIX
+ "([0-9]+)\\.([0-9]+)");
+ "([0-9]+)\\.([0-9]+)");
static Map<String, RileyLinkFirmwareVersion> mapByVersion;
static {
@ -34,13 +40,12 @@ public enum RileyLinkFirmwareVersion {
}
}
protected RileyLinkFirmwareVersion[] familyMembers;
private int major;
private int minor;
private List<RileyLinkFirmwareVersion> familyMembers;
private Integer major;
private Integer minor;
private String versionKey = "";
RileyLinkFirmwareVersion(int major, int minor, String versionKey) {
RileyLinkFirmwareVersion(Integer major, Integer minor, String versionKey) {
this.major = major;
this.minor = minor;
this.versionKey = versionKey;
@ -48,23 +53,39 @@ public enum RileyLinkFirmwareVersion {
RileyLinkFirmwareVersion(RileyLinkFirmwareVersion... familyMembers) {
this.familyMembers = familyMembers;
this.familyMembers = Arrays.asList(familyMembers);
}
public boolean hasFamilyMembers() {
return familyMembers != null;
}
public static boolean isSameVersion(RileyLinkFirmwareVersion versionWeCheck, RileyLinkFirmwareVersion versionSources) {
if (versionSources.familyMembers != null) {
for (RileyLinkFirmwareVersion vrs : versionSources.familyMembers) {
if (vrs == versionWeCheck)
return true;
private List<RileyLinkFirmwareVersion> getFamilyMembersRecursive() {
List<RileyLinkFirmwareVersion> members = new ArrayList<>();
if (hasFamilyMembers()) {
for (RileyLinkFirmwareVersion version : familyMembers) {
members.add(version);
if (version.hasFamilyMembers()) {
members.addAll(version.getFamilyMembersRecursive());
}
}
} else {
return (versionWeCheck == versionSources);
}
return members;
}
static boolean isSameVersion(RileyLinkFirmwareVersion versionWeCheck, RileyLinkFirmwareVersion versionSources) {
if (versionWeCheck == versionSources) {
return true;
}
if (versionSources.familyMembers != null) {
return versionSources.getFamilyMembersRecursive().contains(versionWeCheck);
}
return false;
}
public static RileyLinkFirmwareVersion getByVersionString(String versionString) {
if (versionString != null) {
Matcher m = _version_pattern.matcher(versionString);
@ -76,7 +97,7 @@ public enum RileyLinkFirmwareVersion {
return mapByVersion.get(versionKey);
} else {
return defaultToLowestMajorVersion(major); // just in case there is new release that we don't cover
// example: 2.3 etc
// example: 2.3 etc
}
}
}
@ -86,8 +107,8 @@ public enum RileyLinkFirmwareVersion {
private static RileyLinkFirmwareVersion defaultToLowestMajorVersion(int major) {
if (mapByVersion.containsKey(major + ".0")) {
return mapByVersion.get(major + ".0");
if (mapByVersion.containsKey(major + ".x")) {
return mapByVersion.get(major + ".x");
}
return UnknownVersion;
}
@ -100,6 +121,9 @@ public enum RileyLinkFirmwareVersion {
@Override
public String toString() {
if (hasFamilyMembers()) {
return FIRMWARE_IDENTIFICATION_PREFIX + name();
}
return FIRMWARE_IDENTIFICATION_PREFIX + versionKey;
}
}

View file

@ -108,13 +108,11 @@ public class RileyLinkStatusGeneralFragment extends DaggerFragment implements Re
"-"
: resourceHelper.gs(rileyLinkServiceData.rileyLinkError.getResourceId(targetDevice)));
RileyLinkFirmwareVersion firmwareVersion = rileyLinkServiceData.versionCC110;
if (firmwareVersion == null) {
this.firmwareVersion.setText("BLE113: -\nCC110: -");
} else {
this.firmwareVersion.setText("BLE113: " + rileyLinkServiceData.versionBLE113 + //
"\nCC110: " + firmwareVersion.toString());
this.firmwareVersion.setText("BLE113: " + rileyLinkServiceData.versionBLE113 +
"\nCC110: " + rileyLinkServiceData.versionCC110);
}
}

View file

@ -159,7 +159,7 @@ public class RileyLinkBroadcastReceiver extends DaggerBroadcastReceiver {
// if (isLoggingEnabled())
aapsLogger.debug(LTag.PUMPBTCOMM, "RfSpy Radio version (CC110): " + rlVersion.name());
this.rileyLinkServiceData.versionCC110 = rlVersion;
this.rileyLinkServiceData.firmwareVersion = rlVersion;
ServiceTask task = new InitializePumpManagerTask(injector, context);
serviceTaskExecutor.startTask(task);

View file

@ -32,7 +32,7 @@ public class RileyLinkServiceData {
public RileyLinkError rileyLinkError;
public RileyLinkServiceState rileyLinkServiceState = RileyLinkServiceState.NotStarted;
private long lastServiceStateChange = 0L;
public RileyLinkFirmwareVersion firmwareVersion;
public RileyLinkFirmwareVersion firmwareVersion; // here we have "compatibility level" version
public RileyLinkTargetFrequency rileyLinkTargetFrequency;
public String rileylinkAddress;
long lastTuneUpTime = 0L;
@ -41,7 +41,8 @@ public class RileyLinkServiceData {
// bt version
public String versionBLE113;
// radio version
public RileyLinkFirmwareVersion versionCC110;
public String versionCC110;
public RileyLinkTargetDevice targetDevice;
@ -77,7 +78,6 @@ public class RileyLinkServiceData {
private synchronized RileyLinkServiceState workWithServiceState(RileyLinkServiceState newState, RileyLinkError errorCode, boolean set) {
if (set) {
rileyLinkServiceState = newState;
lastServiceStateChange = System.currentTimeMillis();
this.rileyLinkError = errorCode;
@ -87,7 +87,6 @@ public class RileyLinkServiceData {
rileyLinkUtil.getRileyLinkHistory().add(new RLHistoryItem(rileyLinkServiceState, errorCode, targetDevice));
rxBus.send(new EventRileyLinkDeviceStatusChange(targetDevice, newState, errorCode));
return null;
} else {
return rileyLinkServiceState;
}

View file

@ -0,0 +1,47 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.powermock.modules.junit4.PowerMockRunner;
import info.nightscout.androidaps.logging.AAPSLogger;
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion;
import static org.junit.Assert.assertEquals;
@RunWith(PowerMockRunner.class)
public class RFSpyTest {
@Mock
private AAPSLogger aapsLogger;
@Test
public void testGetFirmwareVersion() {
assertEquals(RileyLinkFirmwareVersion.Version_1_0, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.0"));
assertEquals(RileyLinkFirmwareVersion.Version_1_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1"));
assertEquals(RileyLinkFirmwareVersion.Version_1_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1.13"));
assertEquals(RileyLinkFirmwareVersion.Version_2_0, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0"));
assertEquals(RileyLinkFirmwareVersion.Version_2_0, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0.1"));
assertEquals(RileyLinkFirmwareVersion.Version_2_2, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2"));
assertEquals(RileyLinkFirmwareVersion.Version_2_2, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.16"));
assertEquals(RileyLinkFirmwareVersion.Version_2_2, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.17"));
assertEquals(RileyLinkFirmwareVersion.Version_2_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3"));
assertEquals(RileyLinkFirmwareVersion.Version_2_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.0"));
assertEquals(RileyLinkFirmwareVersion.Version_2_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.17"));
assertEquals(RileyLinkFirmwareVersion.Version_3_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0"));
assertEquals(RileyLinkFirmwareVersion.Version_3_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0.1"));
assertEquals(RileyLinkFirmwareVersion.Version_3_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1"));
assertEquals(RileyLinkFirmwareVersion.Version_3_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1.13"));
assertEquals(RileyLinkFirmwareVersion.Version_4_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0"));
assertEquals(RileyLinkFirmwareVersion.Version_4_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0.4"));
assertEquals(RileyLinkFirmwareVersion.Version_4_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.3"));
assertEquals(RileyLinkFirmwareVersion.Version_4_x, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.5.7"));
assertEquals(RileyLinkFirmwareVersion.UnknownVersion, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0"));
assertEquals(RileyLinkFirmwareVersion.UnknownVersion, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0.0"));
assertEquals(RileyLinkFirmwareVersion.UnknownVersion, RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.5.5"));
}
}

View file

@ -0,0 +1,60 @@
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class RileyLinkFirmwareVersionTest {
@Test
public void testIsSameVersion() {
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version1, RileyLinkFirmwareVersion.Version1));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_1_0, RileyLinkFirmwareVersion.Version1));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_0_0, RileyLinkFirmwareVersion.Version1));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_0_9, RileyLinkFirmwareVersion.Version1));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_1_x, RileyLinkFirmwareVersion.Version1));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version1, RileyLinkFirmwareVersion.Version_1_0));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_0_0, RileyLinkFirmwareVersion.Version2AndHigher));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_1_0, RileyLinkFirmwareVersion.Version2AndHigher));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_0_9, RileyLinkFirmwareVersion.Version2AndHigher));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_1_x, RileyLinkFirmwareVersion.Version2AndHigher));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version1, RileyLinkFirmwareVersion.Version2AndHigher));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version2, RileyLinkFirmwareVersion.Version1));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version2AndHigher, RileyLinkFirmwareVersion.Version1));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version3, RileyLinkFirmwareVersion.Version1));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version4, RileyLinkFirmwareVersion.Version1));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_2_0, RileyLinkFirmwareVersion.Version1));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_2_2, RileyLinkFirmwareVersion.Version1));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_2_x, RileyLinkFirmwareVersion.Version1));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_3_x, RileyLinkFirmwareVersion.Version1));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_4_x, RileyLinkFirmwareVersion.Version1));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version2, RileyLinkFirmwareVersion.Version2));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version2, RileyLinkFirmwareVersion.Version2AndHigher));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_2_0, RileyLinkFirmwareVersion.Version2));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_2_0, RileyLinkFirmwareVersion.Version2AndHigher));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_2_2, RileyLinkFirmwareVersion.Version2));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_2_2, RileyLinkFirmwareVersion.Version2AndHigher));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_2_x, RileyLinkFirmwareVersion.Version2));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_2_x, RileyLinkFirmwareVersion.Version2AndHigher));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version2, RileyLinkFirmwareVersion.Version_2_x));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version3, RileyLinkFirmwareVersion.Version2));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version4, RileyLinkFirmwareVersion.Version2));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_3_x, RileyLinkFirmwareVersion.Version2));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_4_x, RileyLinkFirmwareVersion.Version2));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version3, RileyLinkFirmwareVersion.Version3));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version3, RileyLinkFirmwareVersion.Version2AndHigher));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_3_x, RileyLinkFirmwareVersion.Version3));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_3_x, RileyLinkFirmwareVersion.Version2AndHigher));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version3, RileyLinkFirmwareVersion.Version_3_x));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version4, RileyLinkFirmwareVersion.Version3));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version4, RileyLinkFirmwareVersion.Version4));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version4, RileyLinkFirmwareVersion.Version2AndHigher));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_4_x, RileyLinkFirmwareVersion.Version4));
assertTrue(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version_4_x, RileyLinkFirmwareVersion.Version2AndHigher));
assertFalse(RileyLinkFirmwareVersion.isSameVersion(RileyLinkFirmwareVersion.Version4, RileyLinkFirmwareVersion.Version_4_x));
}
}

View file

@ -127,7 +127,7 @@ dependencies {
testImplementation "junit:junit:$junit_version"
testImplementation 'org.json:json:20200518'
testImplementation("org.mockito:mockito-core:2.8.47") {
testImplementation("org.mockito:mockito-core:${mockitoVersion}") {
exclude group: 'net.bytebuddy', module: 'byte-buddy'
exclude group: 'net.bytebuddy', module: 'byte-buddy-android'
exclude group: 'net.bytebuddy', module: 'byte-buddy-agent'