fix RunningConfiguration.kt
This commit is contained in:
parent
270b6623ea
commit
3f18f94c79
1 changed files with 26 additions and 19 deletions
|
@ -51,6 +51,7 @@ class RunningConfiguration @Inject constructor(
|
||||||
|
|
||||||
// called in NSClient mode only
|
// called in NSClient mode only
|
||||||
fun apply(configuration: JSONObject) {
|
fun apply(configuration: JSONObject) {
|
||||||
|
if (configuration.has("insulin")) {
|
||||||
val insulin = InsulinInterface.InsulinType.fromInt(JsonHelper.safeGetInt(configuration, "insulin", InsulinInterface.InsulinType.UNKNOWN.value))
|
val insulin = InsulinInterface.InsulinType.fromInt(JsonHelper.safeGetInt(configuration, "insulin", InsulinInterface.InsulinType.UNKNOWN.value))
|
||||||
for (p in activePlugin.getSpecificPluginsListByInterface(InsulinInterface::class.java)) {
|
for (p in activePlugin.getSpecificPluginsListByInterface(InsulinInterface::class.java)) {
|
||||||
val insulinPlugin = p as InsulinInterface
|
val insulinPlugin = p as InsulinInterface
|
||||||
|
@ -62,7 +63,9 @@ class RunningConfiguration @Inject constructor(
|
||||||
insulinPlugin.applyConfiguration(configuration.getJSONObject("insulinConfiguration"))
|
insulinPlugin.applyConfiguration(configuration.getJSONObject("insulinConfiguration"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configuration.has("sensitivity")) {
|
||||||
val sensitivity = SensitivityInterface.SensitivityType.fromInt(JsonHelper.safeGetInt(configuration, "sensitivity", SensitivityInterface.SensitivityType.UNKNOWN.value))
|
val sensitivity = SensitivityInterface.SensitivityType.fromInt(JsonHelper.safeGetInt(configuration, "sensitivity", SensitivityInterface.SensitivityType.UNKNOWN.value))
|
||||||
for (p in activePlugin.getSpecificPluginsListByInterface(SensitivityInterface::class.java)) {
|
for (p in activePlugin.getSpecificPluginsListByInterface(SensitivityInterface::class.java)) {
|
||||||
val sensitivityPlugin = p as SensitivityInterface
|
val sensitivityPlugin = p as SensitivityInterface
|
||||||
|
@ -74,10 +77,14 @@ class RunningConfiguration @Inject constructor(
|
||||||
sensitivityPlugin.applyConfiguration(configuration.getJSONObject("sensitivityConfiguration"))
|
sensitivityPlugin.applyConfiguration(configuration.getJSONObject("sensitivityConfiguration"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configuration.has("pump")) {
|
||||||
val pumpType = JsonHelper.safeGetString(configuration, "pump", PumpType.GenericAAPS.description)
|
val pumpType = JsonHelper.safeGetString(configuration, "pump", PumpType.GenericAAPS.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.setPumpDescription(PumpType.getByDescription(pumpType))
|
||||||
|
aapsLogger.debug(LTag.CORE, "Changing pump type to ${pumpType}")
|
||||||
|
}
|
||||||
|
|
||||||
if (configuration.has("overviewConfiguration"))
|
if (configuration.has("overviewConfiguration"))
|
||||||
activePlugin.activeOverview.applyConfiguration(configuration.getJSONObject("overviewConfiguration"))
|
activePlugin.activeOverview.applyConfiguration(configuration.getJSONObject("overviewConfiguration"))
|
||||||
|
|
Loading…
Reference in a new issue