tempbasal will be applied without confirm(otp) on pump version 3.52 above
This commit is contained in:
parent
294f3cb789
commit
7e6da9323b
|
@ -21,13 +21,14 @@ class DiaconnG8Pump @Inject constructor(
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var isPumpLogUploadFailed: Boolean = false
|
var isPumpLogUploadFailed: Boolean = false
|
||||||
|
|
||||||
//var bleResultInfo: Pair<Int?, Boolean> = Pair(null, false)
|
//var bleResultInfo: Pair<Int?, Boolean> = Pair(null, false)
|
||||||
var bolusConfirmMessage: Byte = 0
|
var bolusConfirmMessage: Byte = 0
|
||||||
|
|
||||||
var isReadyToBolus: Boolean = false
|
var isReadyToBolus: Boolean = false
|
||||||
var maxBolusePerDay: Double = 0.0
|
var maxBolusePerDay: Double = 0.0
|
||||||
var pumpIncarnationNum: Int = 65536
|
var pumpIncarnationNum: Int = 65536
|
||||||
var isPumpVersionGe2_63: Boolean = false // is pumpVersion higher then 2.63
|
var isPumpVersionGe2_63: Boolean = false // is pumpVersion higher then 2.63
|
||||||
|
var isPumpVersionGe3_53: Boolean = false // is pumpVersion higher then 3.42
|
||||||
var insulinWarningGrade: Int =0
|
var insulinWarningGrade: Int =0
|
||||||
var insulinWarningProcess: Int =0
|
var insulinWarningProcess: Int =0
|
||||||
var insulinWarningRemain: Int =0
|
var insulinWarningRemain: Int =0
|
||||||
|
@ -363,6 +364,11 @@ class DiaconnG8Pump @Inject constructor(
|
||||||
|
|
||||||
var otpNumber = 0
|
var otpNumber = 0
|
||||||
|
|
||||||
|
var bolusingSetAmount = 0.0
|
||||||
|
var bolusingInjAmount = 0.0
|
||||||
|
var bolusingSpeed = 0
|
||||||
|
var bolusingInjProgress = 0
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
// User settings
|
// User settings
|
||||||
const val ALARM = 0
|
const val ALARM = 0
|
||||||
|
|
|
@ -215,6 +215,7 @@ class BigAPSMainInfoInquireResponsePacket(
|
||||||
|
|
||||||
//incarnation no 처리
|
//incarnation no 처리
|
||||||
diaconnG8Pump.isPumpVersionGe2_63 = PumpLogUtil.isPumpVersionGe(sp.getString(rh.gs(R.string.pumpversion), ""), 2, 63)
|
diaconnG8Pump.isPumpVersionGe2_63 = PumpLogUtil.isPumpVersionGe(sp.getString(rh.gs(R.string.pumpversion), ""), 2, 63)
|
||||||
|
diaconnG8Pump.isPumpVersionGe3_53 = PumpLogUtil.isPumpVersionGe(sp.getString(rh.gs(R.string.pumpversion), ""), 3, 53)
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "result > " + diaconnG8Pump.result)
|
aapsLogger.debug(LTag.PUMPCOMM, "result > " + diaconnG8Pump.result)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "systemRemainInsulin > " + diaconnG8Pump.systemRemainInsulin)
|
aapsLogger.debug(LTag.PUMPCOMM, "systemRemainInsulin > " + diaconnG8Pump.systemRemainInsulin)
|
||||||
|
|
|
@ -214,6 +214,7 @@ class BigMainInfoInquireResponsePacket(
|
||||||
|
|
||||||
//incarnation no 처리
|
//incarnation no 처리
|
||||||
diaconnG8Pump.isPumpVersionGe2_63 = PumpLogUtil.isPumpVersionGe(sp.getString(rh.gs(R.string.pumpversion), ""), 2, 63)
|
diaconnG8Pump.isPumpVersionGe2_63 = PumpLogUtil.isPumpVersionGe(sp.getString(rh.gs(R.string.pumpversion), ""), 2, 63)
|
||||||
|
diaconnG8Pump.isPumpVersionGe3_53 = PumpLogUtil.isPumpVersionGe(sp.getString(rh.gs(R.string.pumpversion), ""), 3, 53)
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "result > " + diaconnG8Pump.result)
|
aapsLogger.debug(LTag.PUMPCOMM, "result > " + diaconnG8Pump.result)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "systemRemainInsulin > " + diaconnG8Pump.systemRemainInsulin)
|
aapsLogger.debug(LTag.PUMPCOMM, "systemRemainInsulin > " + diaconnG8Pump.systemRemainInsulin)
|
||||||
|
|
|
@ -549,29 +549,39 @@ class DiaconnG8Service : DaggerService() {
|
||||||
|
|
||||||
// temp state check
|
// temp state check
|
||||||
sendMessage(TempBasalInquirePacket(injector))
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
|
val result : DiaconnG8Packet
|
||||||
|
if(diaconnG8Pump.isPumpVersionGe3_53) {
|
||||||
|
val tbrPacket = TempBasalSettingPacket(injector, 3, ((durationInHours * 60) / 15).toInt(), ((absoluteRate * 100) + 1000).toInt())
|
||||||
|
sendMessage(tbrPacket, 100)
|
||||||
|
result = tbrPacket
|
||||||
|
if (!processConfirm(tbrPacket.msgType)) return false
|
||||||
|
} else {
|
||||||
|
|
||||||
if (diaconnG8Pump.tbStatus == 1) {
|
if (diaconnG8Pump.tbStatus == 1) {
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.stoppingtempbasal)))
|
||||||
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
val tbrPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
||||||
// tempbasal stop
|
// tempbasal stop
|
||||||
sendMessage(msgPacket, 100)
|
sendMessage(tbrPacket, 100)
|
||||||
|
// otp process
|
||||||
|
if (!processConfirm(tbrPacket.msgType)) return false
|
||||||
|
diaconnG8Pump.tempBasalStart = dateUtil.now()
|
||||||
|
}
|
||||||
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingtempbasal)))
|
||||||
|
val tbInjectRate = ((absoluteRate * 100) + 1000).toInt()
|
||||||
|
val tbrPacket = TempBasalSettingPacket(injector, 1, ((durationInHours * 60) / 15).toInt(), tbInjectRate)
|
||||||
|
sendMessage(tbrPacket, 100)
|
||||||
|
result = tbrPacket
|
||||||
// otp process
|
// otp process
|
||||||
if (!processConfirm(msgPacket.msgType)) return false
|
if (!processConfirm(tbrPacket.msgType)) return false
|
||||||
diaconnG8Pump.tempBasalStart = dateUtil.now()
|
// pump tempbasal status inquire
|
||||||
}
|
}
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingtempbasal)))
|
|
||||||
val tbInjectRate = ((absoluteRate * 100) + 1000).toInt()
|
|
||||||
val msgTBR = TempBasalSettingPacket(injector, 1, ((durationInHours * 60) / 15).toInt(), tbInjectRate)
|
|
||||||
sendMessage(msgTBR, 100)
|
|
||||||
// otp process
|
|
||||||
if (!processConfirm(msgTBR.msgType)) return false
|
|
||||||
// pump tempbasal status inquire
|
|
||||||
sendMessage(TempBasalInquirePacket(injector))
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
loadHistory()
|
loadHistory()
|
||||||
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
||||||
diaconnG8Pump.fromTemporaryBasal(tbr)
|
diaconnG8Pump.fromTemporaryBasal(tbr)
|
||||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
|
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
|
||||||
return msgTBR.success()
|
return result.success()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun tempBasalShortDuration(absoluteRate: Double, durationInMinutes: Int): Boolean {
|
fun tempBasalShortDuration(absoluteRate: Double, durationInMinutes: Int): Boolean {
|
||||||
|
@ -581,28 +591,40 @@ class DiaconnG8Service : DaggerService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// temp state check
|
// temp state check
|
||||||
|
val result:DiaconnG8Packet
|
||||||
sendMessage(TempBasalInquirePacket(injector))
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
if (diaconnG8Pump.tbStatus == 1) {
|
if(diaconnG8Pump.isPumpVersionGe3_53) {
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingtempbasal)))
|
||||||
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
val tbrSettingPacket = TempBasalSettingPacket(injector, 3, 2, ((absoluteRate * 100) + 1000).toInt())
|
||||||
// tempbasal stop
|
sendMessage(tbrSettingPacket, 100)
|
||||||
sendMessage(msgPacket, 100)
|
result=tbrSettingPacket
|
||||||
// otp process
|
// otp process
|
||||||
if (!processConfirm(msgPacket.msgType)) return false
|
if (!processConfirm(tbrSettingPacket.msgType)) return false
|
||||||
SystemClock.sleep(500)
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
|
} else {
|
||||||
|
if (diaconnG8Pump.tbStatus == 1) {
|
||||||
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.stoppingtempbasal)))
|
||||||
|
val tbrPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
||||||
|
// tempbasal stop
|
||||||
|
sendMessage(tbrPacket, 100)
|
||||||
|
// otp process
|
||||||
|
if (!processConfirm(tbrPacket.msgType)) return false
|
||||||
|
SystemClock.sleep(500)
|
||||||
|
}
|
||||||
|
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingtempbasal)))
|
||||||
|
val tbInjectRate = absoluteRate * 100 + 1000
|
||||||
|
val msgTBR = TempBasalSettingPacket(injector, 1, 2, tbInjectRate.toInt())
|
||||||
|
sendMessage(msgTBR, 100)
|
||||||
|
result=msgTBR
|
||||||
|
// otp process
|
||||||
|
if (!processConfirm(msgTBR.msgType)) return false
|
||||||
}
|
}
|
||||||
rxBus.send(EventPumpStatusChanged(rh.gs(R.string.settingtempbasal)))
|
|
||||||
val tbInjectRate = absoluteRate * 100 + 1000
|
|
||||||
val msgTBR = TempBasalSettingPacket(injector, 1, 2, tbInjectRate.toInt())
|
|
||||||
sendMessage(msgTBR, 100)
|
|
||||||
// otp process
|
|
||||||
if (!processConfirm(msgTBR.msgType)) return false
|
|
||||||
sendMessage(TempBasalInquirePacket(injector))
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
loadHistory()
|
loadHistory()
|
||||||
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
||||||
diaconnG8Pump.fromTemporaryBasal(tbr)
|
diaconnG8Pump.fromTemporaryBasal(tbr)
|
||||||
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
|
rxBus.send(EventPumpStatusChanged(EventPumpStatusChanged.Status.DISCONNECTING))
|
||||||
return msgTBR.success()
|
return result.success()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun tempBasalStop(): Boolean {
|
fun tempBasalStop(): Boolean {
|
||||||
|
|
Loading…
Reference in a new issue