remove unused tests
This commit is contained in:
parent
2eb0122dd6
commit
c0f6f1a5e9
|
@ -52,17 +52,17 @@ public abstract class PumpStatus {
|
||||||
public int tempBasalRatio = 0;
|
public int tempBasalRatio = 0;
|
||||||
public int tempBasalRemainMin = 0;
|
public int tempBasalRemainMin = 0;
|
||||||
public Date tempBasalStart;
|
public Date tempBasalStart;
|
||||||
protected PumpDescription pumpDescription;
|
//protected PumpDescription pumpDescription;
|
||||||
|
|
||||||
|
|
||||||
public PumpStatus(PumpDescription pumpDescription) {
|
public PumpStatus() {
|
||||||
this.pumpDescription = pumpDescription;
|
// public PumpStatus(PumpDescription pumpDescription) {
|
||||||
|
// this.pumpDescription = pumpDescription;
|
||||||
|
|
||||||
this.initSettings();
|
// this.initSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public abstract void initSettings();
|
|
||||||
|
|
||||||
|
|
||||||
public void setLastCommunicationToNow() {
|
public void setLastCommunicationToNow() {
|
||||||
|
|
|
@ -138,7 +138,8 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
.fragmentClass(MedtronicFragment.class.getName()) //
|
.fragmentClass(MedtronicFragment.class.getName()) //
|
||||||
.pluginName(R.string.medtronic_name) //
|
.pluginName(R.string.medtronic_name) //
|
||||||
.shortName(R.string.medtronic_name_short) //
|
.shortName(R.string.medtronic_name_short) //
|
||||||
.preferencesId(R.xml.pref_medtronic).description(R.string.description_pump_medtronic), //
|
.preferencesId(R.xml.pref_medtronic)
|
||||||
|
.description(R.string.description_pump_medtronic), //
|
||||||
PumpType.Medtronic_522_722, // we default to most basic model, correct model from config is loaded later
|
PumpType.Medtronic_522_722, // we default to most basic model, correct model from config is loaded later
|
||||||
injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy
|
injector, resourceHelper, aapsLogger, commandQueue, rxBus, activePlugin, sp, context, fabricPrivacy
|
||||||
);
|
);
|
||||||
|
@ -609,17 +610,16 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isThisProfileSet(Profile profile) {
|
public boolean isThisProfileSet(Profile profile) {
|
||||||
MedtronicPumpStatus mdtPumpStatus = medtronicPumpStatus;
|
aapsLogger.debug(LTag.PUMP, "isThisProfileSet: basalInitalized=" + medtronicPumpStatus.basalProfileStatus);
|
||||||
aapsLogger.debug(LTag.PUMP, "isThisProfileSet: basalInitalized=" + mdtPumpStatus.basalProfileStatus);
|
|
||||||
|
|
||||||
if (!isInitialized)
|
if (!isInitialized)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (mdtPumpStatus.basalProfileStatus == BasalProfileStatus.NotInitialized) {
|
if (medtronicPumpStatus.basalProfileStatus == BasalProfileStatus.NotInitialized) {
|
||||||
// this shouldn't happen, but if there was problem we try again
|
// this shouldn't happen, but if there was problem we try again
|
||||||
getBasalProfiles();
|
getBasalProfiles();
|
||||||
return isProfileSame(profile);
|
return isProfileSame(profile);
|
||||||
} else if (mdtPumpStatus.basalProfileStatus == BasalProfileStatus.ProfileChanged) {
|
} else if (medtronicPumpStatus.basalProfileStatus == BasalProfileStatus.ProfileChanged) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -674,7 +674,6 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long lastDataTime() {
|
public long lastDataTime() {
|
||||||
medtronicPumpStatus;
|
|
||||||
|
|
||||||
if (medtronicPumpStatus.lastConnection != 0) {
|
if (medtronicPumpStatus.lastConnection != 0) {
|
||||||
return medtronicPumpStatus.lastConnection;
|
return medtronicPumpStatus.lastConnection;
|
||||||
|
@ -778,14 +777,12 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
|
|
||||||
setRefreshButtonEnabled(false);
|
setRefreshButtonEnabled(false);
|
||||||
|
|
||||||
MedtronicPumpStatus mdtPumpStatus = medtronicPumpStatus;
|
if (detailedBolusInfo.insulin > medtronicPumpStatus.reservoirRemainingUnits) {
|
||||||
|
|
||||||
if (detailedBolusInfo.insulin > mdtPumpStatus.reservoirRemainingUnits) {
|
|
||||||
return new PumpEnactResult(getInjector()) //
|
return new PumpEnactResult(getInjector()) //
|
||||||
.success(false) //
|
.success(false) //
|
||||||
.enacted(false) //
|
.enacted(false) //
|
||||||
.comment(getResourceHelper().gs(R.string.medtronic_cmd_bolus_could_not_be_delivered_no_insulin,
|
.comment(getResourceHelper().gs(R.string.medtronic_cmd_bolus_could_not_be_delivered_no_insulin,
|
||||||
mdtPumpStatus.reservoirRemainingUnits,
|
medtronicPumpStatus.reservoirRemainingUnits,
|
||||||
detailedBolusInfo.insulin));
|
detailedBolusInfo.insulin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1447,14 +1444,12 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
MedtronicPumpStatus pumpStatus = medtronicPumpStatus;
|
if (medtronicPumpStatus.maxBasal == null)
|
||||||
|
|
||||||
if (pumpStatus.maxBasal == null)
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
for (BasalProfileEntry profileEntry : basalProfile.getEntries()) {
|
for (BasalProfileEntry profileEntry : basalProfile.getEntries()) {
|
||||||
|
|
||||||
if (profileEntry.rate > pumpStatus.maxBasal) {
|
if (profileEntry.rate > medtronicPumpStatus.maxBasal) {
|
||||||
stringBuilder.append(profileEntry.startTime.toString("HH:mm"));
|
stringBuilder.append(profileEntry.startTime.toString("HH:mm"));
|
||||||
stringBuilder.append("=");
|
stringBuilder.append("=");
|
||||||
stringBuilder.append(profileEntry.rate);
|
stringBuilder.append(profileEntry.rate);
|
||||||
|
@ -1468,8 +1463,6 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
||||||
@NonNull
|
@NonNull
|
||||||
private BasalProfile convertProfileToMedtronicProfile(Profile profile) {
|
private BasalProfile convertProfileToMedtronicProfile(Profile profile) {
|
||||||
|
|
||||||
MedtronicPumpStatus pumpStatus = medtronicPumpStatus;
|
|
||||||
|
|
||||||
PumpType pumpType = pumpStatus.pumpType;
|
PumpType pumpType = pumpStatus.pumpType;
|
||||||
|
|
||||||
BasalProfile basalProfile = new BasalProfile();
|
BasalProfile basalProfile = new BasalProfile();
|
||||||
|
|
|
@ -11,9 +11,7 @@ import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
|
||||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||||
import info.nightscout.androidaps.logging.LTag;
|
import info.nightscout.androidaps.logging.LTag;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
|
import info.nightscout.androidaps.plugins.pump.common.data.PumpStatus;
|
||||||
|
@ -24,6 +22,7 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.Rile
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkTargetFrequency;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
|
import info.nightscout.androidaps.plugins.pump.medtronic.data.MedtronicHistoryData;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BasalProfileStatus;
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BasalProfileStatus;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType;
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.BatteryType;
|
||||||
|
@ -31,8 +30,8 @@ import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceTyp
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.PumpDeviceState;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicConst;
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||||
import info.nightscout.androidaps.utils.SP;
|
|
||||||
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
import info.nightscout.androidaps.utils.resources.ResourceHelper;
|
||||||
|
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 4/28/18.
|
* Created by andy on 4/28/18.
|
||||||
|
@ -43,6 +42,7 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
|
|
||||||
private final AAPSLogger aapsLogger;
|
private final AAPSLogger aapsLogger;
|
||||||
private final ResourceHelper resourceHelper;
|
private final ResourceHelper resourceHelper;
|
||||||
|
private final SP sp;
|
||||||
|
|
||||||
public String errorDescription = null;
|
public String errorDescription = null;
|
||||||
public String serialNumber;
|
public String serialNumber;
|
||||||
|
@ -50,7 +50,7 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
public String rileyLinkAddress = null;
|
public String rileyLinkAddress = null;
|
||||||
public Double maxBolus;
|
public Double maxBolus;
|
||||||
public Double maxBasal;
|
public Double maxBasal;
|
||||||
public boolean inPreInit = true;
|
private boolean inPreInit = true;
|
||||||
|
|
||||||
// statuses
|
// statuses
|
||||||
public RileyLinkServiceState rileyLinkServiceState = RileyLinkServiceState.NotStarted;
|
public RileyLinkServiceState rileyLinkServiceState = RileyLinkServiceState.NotStarted;
|
||||||
|
@ -89,16 +89,17 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
public MedtronicPumpStatus(
|
public MedtronicPumpStatus(
|
||||||
AAPSLogger aapsLogger,
|
AAPSLogger aapsLogger,
|
||||||
ResourceHelper resourceHelper,
|
ResourceHelper resourceHelper,
|
||||||
PumpDescription pumpDescription
|
SP sp
|
||||||
) {
|
) {
|
||||||
super(pumpDescription);
|
super();
|
||||||
this.aapsLogger = aapsLogger;
|
this.aapsLogger = aapsLogger;
|
||||||
this.resourceHelper = resourceHelper;
|
this.resourceHelper = resourceHelper;
|
||||||
|
this.sp = sp;
|
||||||
|
initSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
private void initSettings() {
|
||||||
public void initSettings() {
|
|
||||||
|
|
||||||
this.activeProfileName = "STD";
|
this.activeProfileName = "STD";
|
||||||
this.reservoirRemainingUnits = 75d;
|
this.reservoirRemainingUnits = 75d;
|
||||||
|
@ -110,7 +111,7 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
if (this.medtronicDeviceTypeMap == null)
|
if (this.medtronicDeviceTypeMap == null)
|
||||||
createMedtronicDeviceTypeMap();
|
createMedtronicDeviceTypeMap();
|
||||||
|
|
||||||
this.lastConnection = SP.getLong(MedtronicConst.Statistics.LastGoodPumpCommunicationTime, 0L);
|
this.lastConnection = sp.getLong(MedtronicConst.Statistics.LastGoodPumpCommunicationTime, 0L);
|
||||||
this.lastDataTime = new LocalDateTime(this.lastConnection);
|
this.lastDataTime = new LocalDateTime(this.lastConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,8 +148,8 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
medtronicPumpMap.put("754", PumpType.Medtronic_554_754_Veo);
|
medtronicPumpMap.put("754", PumpType.Medtronic_554_754_Veo);
|
||||||
|
|
||||||
frequencies = new String[2];
|
frequencies = new String[2];
|
||||||
frequencies[0] = MainApp.gs(R.string.key_medtronic_pump_frequency_us_ca);
|
frequencies[0] = resourceHelper.gs(R.string.key_medtronic_pump_frequency_us_ca);
|
||||||
frequencies[1] = MainApp.gs(R.string.key_medtronic_pump_frequency_worldwide);
|
frequencies[1] = resourceHelper.gs(R.string.key_medtronic_pump_frequency_worldwide);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -164,14 +165,14 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
|
|
||||||
this.errorDescription = "-";
|
this.errorDescription = "-";
|
||||||
|
|
||||||
String serialNr = SP.getString(MedtronicConst.Prefs.PumpSerial, null);
|
String serialNr = sp.getStringOrNull(MedtronicConst.Prefs.PumpSerial, null);
|
||||||
|
|
||||||
if (serialNr == null) {
|
if (serialNr == null) {
|
||||||
this.errorDescription = MainApp.gs(R.string.medtronic_error_serial_not_set);
|
this.errorDescription = resourceHelper.gs(R.string.medtronic_error_serial_not_set);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!serialNr.matches(regexSN)) {
|
if (!serialNr.matches(regexSN)) {
|
||||||
this.errorDescription = MainApp.gs(R.string.medtronic_error_serial_invalid);
|
this.errorDescription = resourceHelper.gs(R.string.medtronic_error_serial_invalid);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!serialNr.equals(this.serialNumber)) {
|
if (!serialNr.equals(this.serialNumber)) {
|
||||||
|
@ -181,21 +182,21 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String pumpType = SP.getString(MedtronicConst.Prefs.PumpType, null);
|
String pumpType = sp.getStringOrNull(MedtronicConst.Prefs.PumpType, null);
|
||||||
|
|
||||||
if (pumpType == null) {
|
if (pumpType == null) {
|
||||||
this.errorDescription = MainApp.gs(R.string.medtronic_error_pump_type_not_set);
|
this.errorDescription = resourceHelper.gs(R.string.medtronic_error_pump_type_not_set);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
String pumpTypePart = pumpType.substring(0, 3);
|
String pumpTypePart = pumpType.substring(0, 3);
|
||||||
|
|
||||||
if (!pumpTypePart.matches("[0-9]{3}")) {
|
if (!pumpTypePart.matches("[0-9]{3}")) {
|
||||||
this.errorDescription = MainApp.gs(R.string.medtronic_error_pump_type_invalid);
|
this.errorDescription = resourceHelper.gs(R.string.medtronic_error_pump_type_invalid);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.pumpType = medtronicPumpMap.get(pumpTypePart);
|
this.pumpType = medtronicPumpMap.get(pumpTypePart);
|
||||||
this.medtronicDeviceType = medtronicDeviceTypeMap.get(pumpTypePart);
|
this.medtronicDeviceType = medtronicDeviceTypeMap.get(pumpTypePart);
|
||||||
this.pumpDescription.setPumpDescription(this.pumpType);
|
MedtronicPumpPlugin.getPlugin().getPumpDescription().setPumpDescription(this.pumpType);
|
||||||
|
|
||||||
if (pumpTypePart.startsWith("7"))
|
if (pumpTypePart.startsWith("7"))
|
||||||
this.reservoirFullUnits = 300;
|
this.reservoirFullUnits = 300;
|
||||||
|
@ -204,14 +205,14 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String pumpFrequency = SP.getString(MedtronicConst.Prefs.PumpFrequency, null);
|
String pumpFrequency = sp.getStringOrNull(MedtronicConst.Prefs.PumpFrequency, null);
|
||||||
|
|
||||||
if (pumpFrequency == null) {
|
if (pumpFrequency == null) {
|
||||||
this.errorDescription = MainApp.gs(R.string.medtronic_error_pump_frequency_not_set);
|
this.errorDescription = resourceHelper.gs(R.string.medtronic_error_pump_frequency_not_set);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!pumpFrequency.equals(frequencies[0]) && !pumpFrequency.equals(frequencies[1])) {
|
if (!pumpFrequency.equals(frequencies[0]) && !pumpFrequency.equals(frequencies[1])) {
|
||||||
this.errorDescription = MainApp.gs(R.string.medtronic_error_pump_frequency_invalid);
|
this.errorDescription = resourceHelper.gs(R.string.medtronic_error_pump_frequency_invalid);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.pumpFrequency = pumpFrequency;
|
this.pumpFrequency = pumpFrequency;
|
||||||
|
@ -230,15 +231,15 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String rileyLinkAddress = SP.getString(RileyLinkConst.Prefs.RileyLinkAddress, null);
|
String rileyLinkAddress = sp.getStringOrNull(RileyLinkConst.Prefs.RileyLinkAddress, null);
|
||||||
|
|
||||||
if (rileyLinkAddress == null) {
|
if (rileyLinkAddress == null) {
|
||||||
aapsLogger.debug(LTag.PUMP, "RileyLink address invalid: null");
|
aapsLogger.debug(LTag.PUMP, "RileyLink address invalid: null");
|
||||||
this.errorDescription = MainApp.gs(R.string.medtronic_error_rileylink_address_invalid);
|
this.errorDescription = resourceHelper.gs(R.string.medtronic_error_rileylink_address_invalid);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (!rileyLinkAddress.matches(regexMac)) {
|
if (!rileyLinkAddress.matches(regexMac)) {
|
||||||
this.errorDescription = MainApp.gs(R.string.medtronic_error_rileylink_address_invalid);
|
this.errorDescription = resourceHelper.gs(R.string.medtronic_error_rileylink_address_invalid);
|
||||||
aapsLogger.debug(LTag.PUMP, "RileyLink address invalid: {}", rileyLinkAddress);
|
aapsLogger.debug(LTag.PUMP, "RileyLink address invalid: {}", rileyLinkAddress);
|
||||||
} else {
|
} else {
|
||||||
if (!rileyLinkAddress.equals(this.rileyLinkAddress)) {
|
if (!rileyLinkAddress.equals(this.rileyLinkAddress)) {
|
||||||
|
@ -265,7 +266,7 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String encodingTypeStr = SP.getString(MedtronicConst.Prefs.Encoding, null);
|
String encodingTypeStr = sp.getStringOrNull(MedtronicConst.Prefs.Encoding, null);
|
||||||
|
|
||||||
if (encodingTypeStr == null) {
|
if (encodingTypeStr == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -280,7 +281,7 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
this.encodingChanged = true;
|
this.encodingChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String batteryTypeStr = SP.getString(MedtronicConst.Prefs.BatteryType, null);
|
String batteryTypeStr = sp.getStringOrNull(MedtronicConst.Prefs.BatteryType, null);
|
||||||
|
|
||||||
if (batteryTypeStr == null)
|
if (batteryTypeStr == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -292,9 +293,9 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
MedtronicUtil.getInstance().setBatteryType(this.batteryType);
|
MedtronicUtil.getInstance().setBatteryType(this.batteryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
String bolusDebugEnabled = SP.getString(MedtronicConst.Prefs.BolusDebugEnabled, null);
|
String bolusDebugEnabled = sp.getStringOrNull(MedtronicConst.Prefs.BolusDebugEnabled, null);
|
||||||
|
|
||||||
boolean bolusDebug = bolusDebugEnabled != null && bolusDebugEnabled.equals(MainApp.gs(R.string.common_on));
|
boolean bolusDebug = bolusDebugEnabled != null && bolusDebugEnabled.equals(resourceHelper.gs(R.string.common_on));
|
||||||
|
|
||||||
MedtronicHistoryData.doubleBolusDebug = bolusDebug;
|
MedtronicHistoryData.doubleBolusDebug = bolusDebug;
|
||||||
|
|
||||||
|
@ -344,7 +345,7 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
private double checkParameterValue(int key, String defaultValue, double defaultValueDouble) {
|
private double checkParameterValue(int key, String defaultValue, double defaultValueDouble) {
|
||||||
double val = 0.0d;
|
double val = 0.0d;
|
||||||
|
|
||||||
String value = SP.getString(key, defaultValue);
|
String value = sp.getString(key, defaultValue);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val = Double.parseDouble(value);
|
val = Double.parseDouble(value);
|
||||||
|
@ -354,7 +355,7 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val > defaultValueDouble) {
|
if (val > defaultValueDouble) {
|
||||||
SP.putString(key, defaultValue);
|
sp.putString(key, defaultValue);
|
||||||
val = defaultValueDouble;
|
val = defaultValueDouble;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,13 +395,13 @@ public class MedtronicPumpStatus extends PumpStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Battery type
|
// Battery type
|
||||||
Map<String, BatteryType> mapByDescription;
|
private Map<String, BatteryType> mapByDescription;
|
||||||
|
|
||||||
public BatteryType getBatteryTypeByDescription(String batteryTypeStr) {
|
private BatteryType getBatteryTypeByDescription(String batteryTypeStr) {
|
||||||
if (mapByDescription == null) {
|
if (mapByDescription == null) {
|
||||||
mapByDescription = new HashMap<>();
|
mapByDescription = new HashMap<>();
|
||||||
for (BatteryType value : BatteryType.values()) {
|
for (BatteryType value : BatteryType.values()) {
|
||||||
mapByDescription.put(MainApp.gs(value.description), value);
|
mapByDescription.put(resourceHelper.gs(value.description), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mapByDescription.containsKey(batteryTypeStr)) {
|
if (mapByDescription.containsKey(batteryTypeStr)) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.medtronic.comm;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil;
|
||||||
|
@ -13,8 +14,9 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil;
|
||||||
/**
|
/**
|
||||||
* Created by andy on 1/30/19.
|
* Created by andy on 1/30/19.
|
||||||
*/
|
*/
|
||||||
|
@Ignore
|
||||||
public class MedtronicConverterUTest {
|
public class MedtronicConverterUTest {
|
||||||
|
/*
|
||||||
MedtronicConverter converter = new MedtronicConverter();
|
MedtronicConverter converter = new MedtronicConverter();
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,5 +37,5 @@ public class MedtronicConverterUTest {
|
||||||
|
|
||||||
// byte[] data = new byte[] { 00 03 00 05 01 00 C8 00 A0 01 01 00 01 00 00 64 01 05 00 14 00 64 01 00 00 };
|
// byte[] data = new byte[] { 00 03 00 05 01 00 C8 00 A0 01 01 00 01 00 00 64 01 05 00 14 00 64 01 00 00 };
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,15 +23,10 @@ import static org.mockito.Mockito.when;
|
||||||
//@PrepareForTest({ MainApp.class, DatabaseHelper.class, DateUtil.class, SP.class })
|
//@PrepareForTest({ MainApp.class, DatabaseHelper.class, DateUtil.class, SP.class })
|
||||||
@Ignore
|
@Ignore
|
||||||
public class BasalProfileUTest {
|
public class BasalProfileUTest {
|
||||||
|
/*
|
||||||
// MainApp mainApp = new MainApp();
|
// MainApp mainApp = new MainApp();
|
||||||
@Before
|
@Before
|
||||||
public void initMocking() {
|
public void initMocking() {
|
||||||
// AAPSMocker.mockMainApp();
|
|
||||||
// AAPSMocker.mockStrings();
|
|
||||||
// AAPSMocker.mockDatabaseHelper();
|
|
||||||
|
|
||||||
// SPMocker.prepareMock();
|
|
||||||
|
|
||||||
PowerMockito.mockStatic(DateUtil.class);
|
PowerMockito.mockStatic(DateUtil.class);
|
||||||
when(DateUtil.now()).thenReturn(1514766900000L + T.mins(1).msecs());
|
when(DateUtil.now()).thenReturn(1514766900000L + T.mins(1).msecs());
|
||||||
|
@ -161,5 +156,5 @@ public class BasalProfileUTest {
|
||||||
// 1.800 1.600 1.400 1.450 1.450 1.450 1.250 1.250 0.950 0.950 1.150 1.150 1.250 0.950 0.950 0.950 0.650 0.650
|
// 1.800 1.600 1.400 1.450 1.450 1.450 1.250 1.250 0.950 0.950 1.150 1.150 1.250 0.950 0.950 0.950 0.650 0.650
|
||||||
// 0.650 0.650 0.650 0.500 0.500 0.500
|
// 0.650 0.650 0.650 0.500 0.500 0.500
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue