Refactor: rename PumpDescription.setPumpDescription to pd.fillFor().
This commit is contained in:
parent
18e19ae4c9
commit
970aebc6db
11 changed files with 14 additions and 14 deletions
|
@ -400,7 +400,7 @@ open class VirtualPumpPlugin @Inject constructor(
|
||||||
aapsLogger.debug(LTag.PUMP, "Pump in configuration: $pumpType, PumpType object: $pumpTypeNew")
|
aapsLogger.debug(LTag.PUMP, "Pump in configuration: $pumpType, PumpType object: $pumpTypeNew")
|
||||||
if (this.pumpType == pumpTypeNew) return
|
if (this.pumpType == pumpTypeNew) return
|
||||||
aapsLogger.debug(LTag.PUMP, "New pump configuration found ($pumpTypeNew), changing from previous (${this.pumpType})")
|
aapsLogger.debug(LTag.PUMP, "New pump configuration found ($pumpTypeNew), changing from previous (${this.pumpType})")
|
||||||
pumpDescription.setPumpDescription(pumpTypeNew)
|
pumpDescription.fillFor(pumpTypeNew)
|
||||||
this.pumpType = pumpTypeNew
|
this.pumpType = pumpTypeNew
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
|
||||||
this.pumpSync = pumpSync;
|
this.pumpSync = pumpSync;
|
||||||
this.dateUtil = dateUtil;
|
this.dateUtil = dateUtil;
|
||||||
|
|
||||||
pumpDescription.setPumpDescription(PumpType.ACCU_CHEK_COMBO);
|
pumpDescription.fillFor(PumpType.ACCU_CHEK_COMBO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override protected void onStart() {
|
@Override protected void onStart() {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||||
class PumpDescription() {
|
class PumpDescription() {
|
||||||
|
|
||||||
constructor(pumpType: PumpType) : this() {
|
constructor(pumpType: PumpType) : this() {
|
||||||
setPumpDescription(pumpType)
|
fillFor(pumpType)
|
||||||
}
|
}
|
||||||
|
|
||||||
var pumpType = PumpType.GENERIC_AAPS
|
var pumpType = PumpType.GENERIC_AAPS
|
||||||
|
@ -69,7 +69,7 @@ class PumpDescription() {
|
||||||
hasCustomUnreachableAlertCheck = false
|
hasCustomUnreachableAlertCheck = false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setPumpDescription(pumpType: PumpType) {
|
fun fillFor(pumpType: PumpType) {
|
||||||
resetSettings()
|
resetSettings()
|
||||||
this.pumpType = pumpType
|
this.pumpType = pumpType
|
||||||
val pumpCapability = pumpType.pumpCapability ?: return
|
val pumpCapability = pumpType.pumpCapability ?: return
|
||||||
|
|
|
@ -82,7 +82,7 @@ class RunningConfiguration @Inject constructor(
|
||||||
if (configuration.has("pump")) {
|
if (configuration.has("pump")) {
|
||||||
val pumpType = JsonHelper.safeGetString(configuration, "pump", PumpType.GENERIC_AAPS.description)
|
val pumpType = JsonHelper.safeGetString(configuration, "pump", PumpType.GENERIC_AAPS.description)
|
||||||
sp.putString(R.string.key_virtualpump_type, pumpType)
|
sp.putString(R.string.key_virtualpump_type, pumpType)
|
||||||
activePlugin.activePump.pumpDescription.setPumpDescription(PumpType.getByDescription(pumpType))
|
activePlugin.activePump.pumpDescription.fillFor(PumpType.getByDescription(pumpType))
|
||||||
aapsLogger.debug(LTag.CORE, "Changing pump type to $pumpType")
|
aapsLogger.debug(LTag.CORE, "Changing pump type to $pumpType")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ class PumpDescriptionTest {
|
||||||
|
|
||||||
@Test fun setPumpDescription() {
|
@Test fun setPumpDescription() {
|
||||||
val pumpDescription = PumpDescription()
|
val pumpDescription = PumpDescription()
|
||||||
pumpDescription.setPumpDescription(PumpType.ACCU_CHEK_COMBO)
|
pumpDescription.fillFor(PumpType.ACCU_CHEK_COMBO)
|
||||||
Assert.assertEquals(pumpDescription.bolusStep, PumpType.ACCU_CHEK_COMBO.bolusSize, 0.1)
|
Assert.assertEquals(pumpDescription.bolusStep, PumpType.ACCU_CHEK_COMBO.bolusSize, 0.1)
|
||||||
Assert.assertEquals(pumpDescription.basalMinimumRate, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)
|
Assert.assertEquals(pumpDescription.basalMinimumRate, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)
|
||||||
Assert.assertEquals(pumpDescription.basalStep, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)
|
Assert.assertEquals(pumpDescription.basalStep, PumpType.ACCU_CHEK_COMBO.baseBasalStep, 0.1)
|
||||||
|
|
|
@ -51,7 +51,7 @@ class APSResultTest : TestBaseWithProfile() {
|
||||||
// BASAL RATE IN TEST PROFILE IS 1U/h
|
// BASAL RATE IN TEST PROFILE IS 1U/h
|
||||||
|
|
||||||
// **** PERCENT pump ****
|
// **** PERCENT pump ****
|
||||||
testPumpPlugin.pumpDescription.setPumpDescription(PumpType.CELLNOVO) // % based
|
testPumpPlugin.pumpDescription.fillFor(PumpType.CELLNOVO) // % based
|
||||||
apsResult.usePercent(true)
|
apsResult.usePercent(true)
|
||||||
|
|
||||||
// closed loop mode return original request
|
// closed loop mode return original request
|
||||||
|
@ -109,7 +109,7 @@ class APSResultTest : TestBaseWithProfile() {
|
||||||
Assert.assertEquals(true, apsResult.isChangeRequested)
|
Assert.assertEquals(true, apsResult.isChangeRequested)
|
||||||
|
|
||||||
// **** ABSOLUTE pump ****
|
// **** ABSOLUTE pump ****
|
||||||
testPumpPlugin.pumpDescription.setPumpDescription(PumpType.MEDTRONIC_515_715) // U/h based
|
testPumpPlugin.pumpDescription.fillFor(PumpType.MEDTRONIC_515_715) // U/h based
|
||||||
apsResult.usePercent(false)
|
apsResult.usePercent(false)
|
||||||
|
|
||||||
// open loop
|
// open loop
|
||||||
|
|
|
@ -60,7 +60,7 @@ class DanaRKoreanPlugin @Inject constructor(
|
||||||
init {
|
init {
|
||||||
pluginDescription.description(R.string.description_pump_dana_r_korean)
|
pluginDescription.description(R.string.description_pump_dana_r_korean)
|
||||||
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false)
|
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false)
|
||||||
pumpDescription.setPumpDescription(PumpType.DANA_R_KOREAN)
|
pumpDescription.fillFor(PumpType.DANA_R_KOREAN)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
||||||
getPluginDescription().description(R.string.description_pump_dana_r_v2);
|
getPluginDescription().description(R.string.description_pump_dana_r_v2);
|
||||||
|
|
||||||
useExtendedBoluses = false;
|
useExtendedBoluses = false;
|
||||||
pumpDescription.setPumpDescription(PumpType.DANA_RV2);
|
pumpDescription.fillFor(PumpType.DANA_RV2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
||||||
this.fabricPrivacy = fabricPrivacy;
|
this.fabricPrivacy = fabricPrivacy;
|
||||||
|
|
||||||
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false);
|
useExtendedBoluses = sp.getBoolean(R.string.key_danar_useextended, false);
|
||||||
pumpDescription.setPumpDescription(PumpType.DANA_R);
|
pumpDescription.fillFor(PumpType.DANA_R);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements Pump, Constrai
|
||||||
this.pumpSync = pumpSync;
|
this.pumpSync = pumpSync;
|
||||||
|
|
||||||
pumpDescription = new PumpDescription();
|
pumpDescription = new PumpDescription();
|
||||||
pumpDescription.setPumpDescription(PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH);
|
pumpDescription.fillFor(PumpType.ACCU_CHEK_INSIGHT_BLUETOOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TBROverNotificationBlock getTBROverNotificationBlock() {
|
public TBROverNotificationBlock getTBROverNotificationBlock() {
|
||||||
|
|
|
@ -99,7 +99,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements Pump,
|
||||||
this.sp = sp;
|
this.sp = sp;
|
||||||
this.commandQueue = commandQueue;
|
this.commandQueue = commandQueue;
|
||||||
|
|
||||||
pumpDescription.setPumpDescription(pumpType);
|
pumpDescription.fillFor(pumpType);
|
||||||
this.pumpType = pumpType;
|
this.pumpType = pumpType;
|
||||||
this.dateUtil = dateUtil;
|
this.dateUtil = dateUtil;
|
||||||
this.aapsSchedulers = aapsSchedulers;
|
this.aapsSchedulers = aapsSchedulers;
|
||||||
|
@ -457,7 +457,7 @@ public abstract class PumpPluginAbstract extends PumpPluginBase implements Pump,
|
||||||
|
|
||||||
public void setPumpType(PumpType pumpType) {
|
public void setPumpType(PumpType pumpType) {
|
||||||
this.pumpType = pumpType;
|
this.pumpType = pumpType;
|
||||||
this.pumpDescription.setPumpDescription(pumpType);
|
this.pumpDescription.fillFor(pumpType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue