fix command sending failure
This commit is contained in:
parent
100f2b9e69
commit
665444ea9e
3 changed files with 14 additions and 15 deletions
|
@ -189,7 +189,7 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
|
|
||||||
override fun setNewBasalProfile(profile: Profile): PumpEnactResult {
|
override fun setNewBasalProfile(profile: Profile): PumpEnactResult {
|
||||||
if (!podStateManager.isActivationCompleted) {
|
if (!podStateManager.isActivationCompleted) {
|
||||||
return PumpEnactResult(injector).success(true).enacted(false)
|
return PumpEnactResult(injector).success(true).enacted(true)
|
||||||
}
|
}
|
||||||
val basalProgram = mapProfileToBasalProgram(profile)
|
val basalProgram = mapProfileToBasalProgram(profile)
|
||||||
return executeProgrammingCommand(
|
return executeProgrammingCommand(
|
||||||
|
@ -773,10 +773,14 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deactivatePod(): PumpEnactResult {
|
private fun deactivatePod(): PumpEnactResult {
|
||||||
return executeProgrammingCommand(
|
val ret = executeProgrammingCommand(
|
||||||
historyEntry = history.createRecord(OmnipodCommandType.DEACTIVATE_POD),
|
historyEntry = history.createRecord(OmnipodCommandType.DEACTIVATE_POD),
|
||||||
command = omnipodManager.deactivatePod().ignoreElements()
|
command = omnipodManager.deactivatePod().ignoreElements()
|
||||||
).toPumpEnactResult()
|
).toPumpEnactResult()
|
||||||
|
if (podStateManager.activeCommand != null) {
|
||||||
|
ret.success(false)
|
||||||
|
}
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleTimeChange(): PumpEnactResult {
|
private fun handleTimeChange(): PumpEnactResult {
|
||||||
|
|
|
@ -166,7 +166,7 @@ class OmnipodDashManagerImpl @Inject constructor(
|
||||||
.setUniqueId(podStateManager.uniqueId!!.toInt())
|
.setUniqueId(podStateManager.uniqueId!!.toInt())
|
||||||
.setSequenceNumber(podStateManager.messageSequenceNumber)
|
.setSequenceNumber(podStateManager.messageSequenceNumber)
|
||||||
.setNonce(NONCE)
|
.setNonce(NONCE)
|
||||||
.setProgramReminder(ProgramReminder(atStart = hasBasalBeepEnabled, atEnd = hasBasalBeepEnabled, atInterval = 0))
|
.setProgramReminder(ProgramReminder(atStart = hasBasalBeepEnabled, atEnd = false, atInterval = 0))
|
||||||
.setBasalProgram(basalProgram)
|
.setBasalProgram(basalProgram)
|
||||||
.setCurrentTime(currentTime)
|
.setCurrentTime(currentTime)
|
||||||
.build(),
|
.build(),
|
||||||
|
@ -436,18 +436,11 @@ class OmnipodDashManagerImpl @Inject constructor(
|
||||||
beepEnabled: Boolean
|
beepEnabled: Boolean
|
||||||
): Observable<PodEvent> {
|
): Observable<PodEvent> {
|
||||||
return Observable.defer {
|
return Observable.defer {
|
||||||
val beepType = if (!beepEnabled) {
|
val beepType = if (!beepEnabled)
|
||||||
BeepType.SILENT
|
BeepType.SILENT
|
||||||
} else {
|
else
|
||||||
when (deliveryType) {
|
BeepType.LONG_SINGLE_BEEP
|
||||||
StopDeliveryCommand.DeliveryType.ALL, StopDeliveryCommand.DeliveryType.BASAL ->
|
|
||||||
BeepType.FOUR_TIMES_BIP_BEEP
|
|
||||||
StopDeliveryCommand.DeliveryType.TEMP_BASAL ->
|
|
||||||
BeepType.LONG_SINGLE_BEEP
|
|
||||||
StopDeliveryCommand.DeliveryType.BOLUS ->
|
|
||||||
BeepType.LONG_SINGLE_BEEP
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bleManager.sendCommand(
|
bleManager.sendCommand(
|
||||||
StopDeliveryCommand.Builder()
|
StopDeliveryCommand.Builder()
|
||||||
.setSequenceNumber(podStateManager.messageSequenceNumber)
|
.setSequenceNumber(podStateManager.messageSequenceNumber)
|
||||||
|
|
|
@ -14,6 +14,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activati
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashPodManagementBinding
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashPodManagementBinding
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ActivationProgress
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ActivationProgress
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodStatus
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.activation.DashPodActivationWizardActivity
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.activation.DashPodActivationWizardActivity
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.deactivation.DashPodDeactivationWizardActivity
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.deactivation.DashPodDeactivationWizardActivity
|
||||||
|
@ -124,7 +125,8 @@ class DashPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
binding.buttonActivatePod.isEnabled = podStateManager.activationProgress.isBefore(ActivationProgress.COMPLETED)
|
binding.buttonActivatePod.isEnabled = podStateManager.activationProgress.isBefore(ActivationProgress.COMPLETED)
|
||||||
binding.buttonDeactivatePod.isEnabled =
|
binding.buttonDeactivatePod.isEnabled =
|
||||||
podStateManager.activationProgress.isAtLeast(ActivationProgress.PHASE_1_COMPLETED)
|
podStateManager.activationProgress.isAtLeast(ActivationProgress.PHASE_1_COMPLETED) ||
|
||||||
|
podStateManager.podStatus == PodStatus.ALARM
|
||||||
|
|
||||||
if (podStateManager.activationProgress.isAtLeast(ActivationProgress.PHASE_1_COMPLETED)) {
|
if (podStateManager.activationProgress.isAtLeast(ActivationProgress.PHASE_1_COMPLETED)) {
|
||||||
if (commandQueue.isCustomCommandInQueue(CommandPlayTestBeep::class.java)) {
|
if (commandQueue.isCustomCommandInQueue(CommandPlayTestBeep::class.java)) {
|
||||||
|
|
Loading…
Reference in a new issue