EOPATCH: fix setting of profile
This commit is contained in:
parent
b24fcbfb93
commit
0c833d087b
6 changed files with 46 additions and 34 deletions
|
@ -163,6 +163,8 @@
|
|||
<string name="dia">DIA</string>
|
||||
<string name="ic_short">IC</string>
|
||||
<string name="isf_short">ISF</string>
|
||||
<string name="canceling_tbr_failed">Canceling of temporary basal failed</string>
|
||||
<string name="canceling_eb_failed">Canceling of extended bolus failed</string>
|
||||
|
||||
<!-- Protection-->
|
||||
<string name="wrongpassword">Wrong password</string>
|
||||
|
|
|
@ -823,7 +823,7 @@ public class ComboPlugin extends PumpPluginBase implements Pump, Constraints {
|
|||
);
|
||||
return new PumpEnactResult(getInjector()).isTempCancel(true).success(true).enacted(true);
|
||||
} else {
|
||||
return new PumpEnactResult(getInjector()).success(false).enacted(false);
|
||||
return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(info.nightscout.core.ui.R.string.canceling_eb_failed);
|
||||
}
|
||||
} else if (activeTemp == null) {
|
||||
return new PumpEnactResult(getInjector()).success(true).enacted(false);
|
||||
|
|
|
@ -334,7 +334,7 @@ public abstract class AbstractDanaRPlugin extends PumpPluginBase implements Pump
|
|||
serialNumber()
|
||||
);
|
||||
} else
|
||||
result.success(false).enacted(false).isTempCancel(true);
|
||||
result.success(false).enacted(false).isTempCancel(true).comment(info.nightscout.core.ui.R.string.canceling_eb_failed);
|
||||
} else {
|
||||
result.success(true).comment(info.nightscout.core.ui.R.string.ok).isTempCancel(true);
|
||||
getAapsLogger().debug(LTag.PUMP, "cancelExtendedBolus: OK");
|
||||
|
|
|
@ -353,9 +353,9 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
getPumpDescription().getPumpType(),
|
||||
serialNumber()
|
||||
);
|
||||
result.success(true).enacted(true).isTempCancel(true);
|
||||
result.success(true).enacted(true).isTempCancel(true).comment(info.nightscout.core.ui.R.string.ok);
|
||||
} else
|
||||
result.success(false).enacted(false).isTempCancel(true);
|
||||
result.success(false).enacted(false).isTempCancel(true).comment(info.nightscout.core.ui.R.string.canceling_eb_failed);
|
||||
} else {
|
||||
result.success(true).isTempCancel(true).comment(info.nightscout.core.ui.R.string.ok);
|
||||
aapsLogger.debug(LTag.PUMP, "cancelRealTempBasal: OK");
|
||||
|
|
|
@ -522,35 +522,40 @@ class DanaRSPlugin @Inject constructor(
|
|||
|
||||
@Synchronized
|
||||
override fun cancelTempBasal(enforceNew: Boolean): PumpEnactResult {
|
||||
val result = PumpEnactResult(injector)
|
||||
if (danaPump.isTempBasalInProgress) {
|
||||
aapsLogger.debug(LTag.PUMP, "cancelRealTempBasal: Failed")
|
||||
danaRSService?.tempBasalStop()
|
||||
result.success = !danaPump.isTempBasalInProgress
|
||||
result.enacted = true
|
||||
result.isTempCancel = true
|
||||
return PumpEnactResult(injector)
|
||||
.success(!danaPump.isTempBasalInProgress)
|
||||
.enacted(true)
|
||||
.isTempCancel(true)
|
||||
.comment(info.nightscout.core.ui.R.string.canceling_tbr_failed)
|
||||
} else {
|
||||
result.success = true
|
||||
result.enacted = false
|
||||
result.isTempCancel = true
|
||||
result.comment = rh.gs(info.nightscout.core.ui.R.string.ok)
|
||||
aapsLogger.debug(LTag.PUMP, "cancelRealTempBasal: OK")
|
||||
return PumpEnactResult(injector)
|
||||
.success(true)
|
||||
.enacted(false)
|
||||
.isTempCancel(true)
|
||||
.comment(info.nightscout.core.ui.R.string.ok)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@Synchronized override fun cancelExtendedBolus(): PumpEnactResult {
|
||||
val result = PumpEnactResult(injector)
|
||||
if (danaPump.isExtendedInProgress) {
|
||||
danaRSService?.extendedBolusStop()
|
||||
result.success = !danaPump.isExtendedInProgress
|
||||
result.enacted = true
|
||||
aapsLogger.debug(LTag.PUMP, "cancelExtendedBolus: Failed")
|
||||
return PumpEnactResult(injector)
|
||||
.success(!danaPump.isExtendedInProgress)
|
||||
.enacted(true)
|
||||
.comment(info.nightscout.core.ui.R.string.canceling_eb_failed)
|
||||
} else {
|
||||
result.success = true
|
||||
result.enacted = false
|
||||
result.comment = rh.gs(info.nightscout.core.ui.R.string.ok)
|
||||
aapsLogger.debug(LTag.PUMP, "cancelExtendedBolus: OK")
|
||||
return PumpEnactResult(injector)
|
||||
.success(true)
|
||||
.enacted(false)
|
||||
.isTempCancel(true)
|
||||
.comment(info.nightscout.core.ui.R.string.ok)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
override fun getJSONStatus(profile: Profile, profileName: String, version: String): JSONObject {
|
||||
|
|
|
@ -176,9 +176,15 @@ class EopatchPumpPlugin @Inject constructor(
|
|||
override fun setNewBasalProfile(profile: Profile): PumpEnactResult {
|
||||
mLastDataTime = System.currentTimeMillis()
|
||||
if (patchManager.isActivated) {
|
||||
if (patchManager.patchState.isTempBasalActive || patchManager.patchState.isBolusActive) {
|
||||
return PumpEnactResult(injector)
|
||||
} else {
|
||||
if (patchManager.patchState.isTempBasalActive) {
|
||||
val cancelResult = cancelTempBasal(true)
|
||||
if (!cancelResult.success) return PumpEnactResult(injector).isTempCancel(true).comment(info.nightscout.core.ui.R.string.canceling_tbr_failed)
|
||||
}
|
||||
|
||||
if (patchManager.patchState.isExtBolusActive) {
|
||||
val cancelResult = cancelExtendedBolus()
|
||||
if (!cancelResult.success) return PumpEnactResult(injector).comment(info.nightscout.core.ui.R.string.canceling_eb_failed)
|
||||
}
|
||||
var isSuccess: Boolean? = null
|
||||
val result: BehaviorSubject<Boolean> = BehaviorSubject.create()
|
||||
val disposable = result.hide()
|
||||
|
@ -209,7 +215,6 @@ class EopatchPumpPlugin @Inject constructor(
|
|||
} else {
|
||||
return PumpEnactResult(injector)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
preferenceManager.getNormalBasalManager().setNormalBasal(profile)
|
||||
preferenceManager.flushNormalBasalManager()
|
||||
|
@ -479,7 +484,7 @@ class EopatchPumpPlugin @Inject constructor(
|
|||
.map { PumpEnactResult(injector).success(true).enacted(true).isTempCancel(true) }
|
||||
.onErrorReturnItem(
|
||||
PumpEnactResult(injector).success(false).enacted(false)
|
||||
.comment(rh.gs(info.nightscout.core.ui.R.string.error))
|
||||
.comment(rh.gs(info.nightscout.core.ui.R.string.canceling_eb_failed))
|
||||
)
|
||||
.blockingGet()
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue