set temp basal beeps
This commit is contained in:
parent
3314df7bb7
commit
3b26068faf
|
@ -258,6 +258,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
enforceNew: Boolean,
|
||||
tbrType: PumpSync.TemporaryBasalType
|
||||
): PumpEnactResult {
|
||||
val tempBasalBeeps = sp.getBoolean(R.string.key_omnipod_common_tbr_beeps_enabled, false)
|
||||
|
||||
return Completable.concat(
|
||||
listOf(
|
||||
observeNoActiveTempBasal(enforceNew),
|
||||
|
@ -270,7 +272,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
.ignoreElement(),
|
||||
omnipodManager.setTempBasal(
|
||||
absoluteRate,
|
||||
durationInMinutes.toShort()
|
||||
durationInMinutes.toShort(),
|
||||
tempBasalBeeps,
|
||||
).ignoreElements(),
|
||||
history.updateFromState(podStateManager),
|
||||
podStateManager.updateActiveCommand()
|
||||
|
|
|
@ -24,7 +24,7 @@ interface OmnipodDashManager {
|
|||
|
||||
fun setTime(): Observable<PodEvent>
|
||||
|
||||
fun setTempBasal(rate: Double, durationInMinutes: Short): Observable<PodEvent>
|
||||
fun setTempBasal(rate: Double, durationInMinutes: Short, tempBasalBeeps: Boolean): Observable<PodEvent>
|
||||
|
||||
fun stopTempBasal(): Observable<PodEvent>
|
||||
|
||||
|
|
|
@ -460,14 +460,14 @@ class OmnipodDashManagerImpl @Inject constructor(
|
|||
return Observable.empty()
|
||||
}
|
||||
|
||||
private fun observeSendProgramTempBasalCommand(rate: Double, durationInMinutes: Short): Observable<PodEvent> {
|
||||
private fun observeSendProgramTempBasalCommand(rate: Double, durationInMinutes: Short, tempBasalBeeps: Boolean): Observable<PodEvent> {
|
||||
return Observable.defer {
|
||||
// TODO cancel current temp basal (if active)
|
||||
bleManager.sendCommand(
|
||||
ProgramTempBasalCommand.Builder()
|
||||
.setSequenceNumber(podStateManager.messageSequenceNumber)
|
||||
.setUniqueId(podStateManager.uniqueId!!.toInt())
|
||||
.setNonce(NONCE)
|
||||
.setProgramReminder(ProgramReminder(tempBasalBeeps, tempBasalBeeps, 0))
|
||||
.setRateInUnitsPerHour(rate)
|
||||
.setDurationInMinutes(durationInMinutes)
|
||||
.build(),
|
||||
|
@ -476,11 +476,11 @@ class OmnipodDashManagerImpl @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
override fun setTempBasal(rate: Double, durationInMinutes: Short): Observable<PodEvent> {
|
||||
override fun setTempBasal(rate: Double, durationInMinutes: Short, tempBasalBeeps: Boolean): Observable<PodEvent> {
|
||||
return Observable.concat(
|
||||
observePodRunning,
|
||||
observeConnectToPod,
|
||||
observeSendProgramTempBasalCommand(rate, durationInMinutes)
|
||||
observeSendProgramTempBasalCommand(rate, durationInMinutes, tempBasalBeeps)
|
||||
)
|
||||
// TODO these would be common for any observable returned in a public function in this class
|
||||
.doOnNext(PodEventInterceptor())
|
||||
|
@ -700,7 +700,7 @@ class OmnipodDashManagerImpl @Inject constructor(
|
|||
inner class ErrorInterceptor : Consumer<Throwable> {
|
||||
|
||||
override fun accept(throwable: Throwable) {
|
||||
logger.debug(LTag.PUMP, "Intercepted error in OmnipodDashManagerImpl: ${throwable.javaClass.simpleName}")
|
||||
logger.debug(LTag.PUMP, "Intercepted error in OmnipodDashManagerImpl: ${throwable}")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue