Merge pull request #398 from Tornado-Tim/fix-LGS-constraint
Fix Low Glucose Constraint
This commit is contained in:
commit
9345276f94
|
@ -18,6 +18,9 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
|
||||||
fun isClosedLoopAllowed(): Constraint<Boolean> =
|
fun isClosedLoopAllowed(): Constraint<Boolean> =
|
||||||
isClosedLoopAllowed(Constraint(true))
|
isClosedLoopAllowed(Constraint(true))
|
||||||
|
|
||||||
|
fun isLgsAllowed(): Constraint<Boolean> =
|
||||||
|
isLgsAllowed(Constraint(true))
|
||||||
|
|
||||||
fun isAutosensModeEnabled(): Constraint<Boolean> =
|
fun isAutosensModeEnabled(): Constraint<Boolean> =
|
||||||
isAutosensModeEnabled(Constraint(true))
|
isAutosensModeEnabled(Constraint(true))
|
||||||
|
|
||||||
|
@ -77,6 +80,16 @@ class ConstraintChecker @Inject constructor(private val activePlugin: ActivePlug
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isLgsAllowed(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||||
|
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(ConstraintsInterface::class.java)
|
||||||
|
for (p in constraintsPlugins) {
|
||||||
|
val constraint = p as ConstraintsInterface
|
||||||
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue
|
||||||
|
constraint.isLgsAllowed(value)
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
override fun isAutosensModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
override fun isAutosensModeEnabled(value: Constraint<Boolean>): Constraint<Boolean> {
|
||||||
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(ConstraintsInterface::class.java)
|
val constraintsPlugins = activePlugin.getSpecificPluginsListByInterface(ConstraintsInterface::class.java)
|
||||||
for (p in constraintsPlugins) {
|
for (p in constraintsPlugins) {
|
||||||
|
|
Loading…
Reference in a new issue