1. 임시기저 설정/취소 진행 시 펌프의 임시기저 상태를 먼저 확인 후 동작되도록 처리
2. 확장볼러스 설정/취소 진행 시 펌프의 임시기저 상태를 먼저 확인 후 동작되도록 처리 3. 펌프에서 듀얼볼러스 진행 후 aps에서 실행 탭에서 취소시 듀얼 명령이 취소되도록 처리(기존은 square취소명령) 4. 패킷 sendMessage 이후 2초 버퍼 제거 (test)
This commit is contained in:
parent
6f1ca8e4b3
commit
57ceb9993d
|
@ -6,6 +6,7 @@
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="6" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="6" />
|
||||||
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="6" />
|
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="6" />
|
||||||
<option name="BLANK_LINES_AROUND_BLOCK_WHEN_BRANCHES" value="1" />
|
<option name="BLANK_LINES_AROUND_BLOCK_WHEN_BRANCHES" value="1" />
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
<codeStyleSettings language="JAVA">
|
<codeStyleSettings language="JAVA">
|
||||||
<option name="METHOD_ANNOTATION_WRAP" value="0" />
|
<option name="METHOD_ANNOTATION_WRAP" value="0" />
|
||||||
|
@ -124,6 +125,7 @@
|
||||||
</arrangement>
|
</arrangement>
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
<codeStyleSettings language="kotlin">
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
|
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
|
||||||
<option name="LINE_COMMENT_ADD_SPACE" value="true" />
|
<option name="LINE_COMMENT_ADD_SPACE" value="true" />
|
||||||
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
|
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
|
||||||
|
|
|
@ -169,8 +169,10 @@ class DiaconnG8Fragment : DaggerFragment() {
|
||||||
binding.lastbolus.text = ""
|
binding.lastbolus.text = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.dailyunits.text = resourceHelper.gs(R.string.reservoirvalue, (pump.todayBaseAmount + pump.todaySnackAmount + pump.todayMealAmount), ((pump.maxBasal.toInt() * 24) + pump.maxBolusePerDay.toInt()))
|
val todayInsulinAmount = (pump.todayBaseAmount + pump.todaySnackAmount + pump.todayMealAmount)
|
||||||
warnColors.setColor(binding.dailyunits, pump.baseInjAmount, pump.baseAmount * 0.75, pump.baseAmount * 0.9)
|
val todayInsulinLimitAmount = (pump.maxBasal.toInt() * 24) + pump.maxBolusePerDay.toInt()
|
||||||
|
binding.dailyunits.text = resourceHelper.gs(R.string.reservoirvalue, todayInsulinAmount, todayInsulinLimitAmount)
|
||||||
|
warnColors.setColor(binding.dailyunits, todayInsulinAmount, todayInsulinLimitAmount * 0.75, todayInsulinLimitAmount * 0.9)
|
||||||
binding.basabasalrate.text = pump.baseInjAmount.toString() +" / "+ resourceHelper.gs(R.string.pump_basebasalrate, plugin.baseBasalRate)
|
binding.basabasalrate.text = pump.baseInjAmount.toString() +" / "+ resourceHelper.gs(R.string.pump_basebasalrate, plugin.baseBasalRate)
|
||||||
|
|
||||||
binding.tempbasal.text = diaconnG8Pump.temporaryBasalToString()
|
binding.tempbasal.text = diaconnG8Pump.temporaryBasalToString()
|
||||||
|
@ -179,7 +181,6 @@ class DiaconnG8Fragment : DaggerFragment() {
|
||||||
warnColors.setColorInverse(binding.reservoir, pump.systemRemainInsulin , 50.0, 20.0)
|
warnColors.setColorInverse(binding.reservoir, pump.systemRemainInsulin , 50.0, 20.0)
|
||||||
binding.battery.text = "{fa-battery-" + pump.systemRemainBattery / 25 + "}" + " ("+ pump.systemRemainBattery + " %)"
|
binding.battery.text = "{fa-battery-" + pump.systemRemainBattery / 25 + "}" + " ("+ pump.systemRemainBattery + " %)"
|
||||||
warnColors.setColorInverse(binding.battery, pump.systemRemainBattery.toDouble(), 51.0, 26.0)
|
warnColors.setColorInverse(binding.battery, pump.systemRemainBattery.toDouble(), 51.0, 26.0)
|
||||||
//binding.tdd.text = "basal: " +pump.todayBaseAmount + "/ bolus: "+ (pump.todaySnackAmount + pump.todayMealAmount)
|
|
||||||
binding.firmware.text = resourceHelper.gs(R.string.diaconn_g8_pump) + "\nVersion: " + pump.majorVersion.toString() + "." + pump.minorVersion.toString() + "\nCountry: "+pump.country.toString() + "\nProductType: "+ pump.productType.toString() + "\nManufacture: " + pump.makeYear + "." + pump.makeMonth + "." + pump.makeDay
|
binding.firmware.text = resourceHelper.gs(R.string.diaconn_g8_pump) + "\nVersion: " + pump.majorVersion.toString() + "." + pump.minorVersion.toString() + "\nCountry: "+pump.country.toString() + "\nProductType: "+ pump.productType.toString() + "\nManufacture: " + pump.makeYear + "." + pump.makeMonth + "." + pump.makeDay
|
||||||
binding.basalstep.text = pump.basalStep.toString()
|
binding.basalstep.text = pump.basalStep.toString()
|
||||||
binding.bolusstep.text = pump.bolusStep.toString()
|
binding.bolusstep.text = pump.bolusStep.toString()
|
||||||
|
|
|
@ -58,27 +58,41 @@ class DiaconnG8Pump @Inject constructor(
|
||||||
var bolusBlocked = false
|
var bolusBlocked = false
|
||||||
var lastBolusTime: Long = 0
|
var lastBolusTime: Long = 0
|
||||||
var lastBolusAmount = 0.0
|
var lastBolusAmount = 0.0
|
||||||
var extendedBolusMinutes = 0
|
|
||||||
var extendedBolusSoFarInMinutes = 0
|
|
||||||
var extendedBolusDeliveredSoFar = 0.0
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TEMP BASALS
|
* TEMP BASALS
|
||||||
*/
|
*/
|
||||||
var isTempBasalInProgress = false
|
|
||||||
var tempBasalPercent = 0
|
|
||||||
var tempBasalStart: Long = 0
|
var tempBasalStart: Long = 0
|
||||||
|
var tempBasalDuration: Long = 0 // in milliseconds
|
||||||
var tempBasalAbsoluteRate: Double = 0.0
|
var tempBasalAbsoluteRate: Double = 0.0
|
||||||
var tempBasalDuration: Long = 0
|
var tempBasalPercent: Int = 0
|
||||||
|
|
||||||
|
var tempBasalTotalSec: Long
|
||||||
|
set(durationInSec) {
|
||||||
|
tempBasalDuration = T.secs(durationInSec).msecs()
|
||||||
|
}
|
||||||
|
get() = T.msecs(tempBasalDuration).mins()
|
||||||
|
var isTempBasalInProgress: Boolean
|
||||||
|
get() = tempBasalStart != 0L && dateUtil.now() in tempBasalStart..tempBasalStart + tempBasalDuration
|
||||||
|
set(isRunning) {
|
||||||
|
if (isRunning) throw IllegalArgumentException("Use to cancel TBR only")
|
||||||
|
else {
|
||||||
|
tempBasalStart = 0L
|
||||||
|
tempBasalDuration = 0L
|
||||||
|
tempBasalAbsoluteRate = 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
val tempBasalRemainingMin: Int
|
val tempBasalRemainingMin: Int
|
||||||
get() = max(tbElapsedTime, 0)
|
get() = max(T.msecs(tempBasalStart + tempBasalDuration - dateUtil.now()).mins().toInt(), 0)
|
||||||
|
|
||||||
fun temporaryBasalToString(): String {
|
fun temporaryBasalToString(): String {
|
||||||
if (!isTempBasalInProgress) return ""
|
if (!isTempBasalInProgress) return ""
|
||||||
return tempBasalAbsoluteRate.toString() + "U @" +
|
|
||||||
|
val passedMin = ((min(dateUtil.now(), tempBasalStart + tempBasalDuration) - tempBasalStart) / 60.0 / 1000).roundToInt()
|
||||||
|
return tempBasalAbsoluteRate.toString() + "U/h @" +
|
||||||
dateUtil.timeString(tempBasalStart) +
|
dateUtil.timeString(tempBasalStart) +
|
||||||
" " + tbElapsedTime + "/" + T.msecs(tempBasalDuration).mins() + "'"
|
" " + passedMin + "/" + T.msecs(tempBasalDuration).mins() + "'"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fromTemporaryBasal(tbr: PumpSync.PumpState.TemporaryBasal?) {
|
fun fromTemporaryBasal(tbr: PumpSync.PumpState.TemporaryBasal?) {
|
||||||
|
@ -99,6 +113,7 @@ class DiaconnG8Pump @Inject constructor(
|
||||||
var extendedBolusStart: Long = 0
|
var extendedBolusStart: Long = 0
|
||||||
var extendedBolusDuration: Long = 0
|
var extendedBolusDuration: Long = 0
|
||||||
var extendedBolusAmount = 0.0
|
var extendedBolusAmount = 0.0
|
||||||
|
|
||||||
var isExtendedInProgress: Boolean
|
var isExtendedInProgress: Boolean
|
||||||
get() = extendedBolusStart != 0L && dateUtil.now() in extendedBolusStart..extendedBolusStart + extendedBolusDuration
|
get() = extendedBolusStart != 0L && dateUtil.now() in extendedBolusStart..extendedBolusStart + extendedBolusDuration
|
||||||
set(isRunning) {
|
set(isRunning) {
|
||||||
|
@ -109,15 +124,26 @@ class DiaconnG8Pump @Inject constructor(
|
||||||
extendedBolusAmount = 0.0
|
extendedBolusAmount = 0.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var extendedBolusPassedMinutes = 0
|
val extendedBolusPassedMinutes:Int
|
||||||
var extendedBolusRemainingMinutes = 0
|
get() = T.msecs(max(0, dateUtil.now() - extendedBolusStart)).mins().toInt()
|
||||||
var extendedBolusAbsoluteRate = 0.0
|
val extendedBolusRemainingMinutes: Int
|
||||||
|
get() = max(T.msecs(extendedBolusStart + extendedBolusDuration - dateUtil.now()).mins().toInt(), 0)
|
||||||
|
private val extendedBolusDurationInMinutes: Int
|
||||||
|
get() = T.msecs(extendedBolusDuration).mins().toInt()
|
||||||
|
|
||||||
|
var extendedBolusAbsoluteRate: Double
|
||||||
|
get() = extendedBolusAmount * T.hours(1).msecs() / extendedBolusDuration
|
||||||
|
set(rate) {
|
||||||
|
extendedBolusAmount = rate * extendedBolusDuration / T.hours(1).msecs()
|
||||||
|
}
|
||||||
|
|
||||||
fun extendedBolusToString(): String {
|
fun extendedBolusToString(): String {
|
||||||
if (!isExtendedInProgress) return ""
|
if (!isExtendedInProgress) return ""
|
||||||
return "E "+ DecimalFormatter.to2Decimal(extendedBolusDeliveredSoFar) +"/" + DecimalFormatter.to2Decimal(extendedBolusAbsoluteRate) + "U/h @" +
|
//return "E "+ DecimalFormatter.to2Decimal(extendedBolusDeliveredSoFar) +"/" + DecimalFormatter.to2Decimal(extendedBolusAbsoluteRate) + "U/h @" +
|
||||||
|
// " " + extendedBolusPassedMinutes + "/" + extendedBolusMinutes + "'"
|
||||||
|
return "E "+ DecimalFormatter.to2Decimal(extendedBolusAbsoluteRate) + "U/h @" +
|
||||||
dateUtil.timeString(extendedBolusStart) +
|
dateUtil.timeString(extendedBolusStart) +
|
||||||
" " + extendedBolusPassedMinutes + "/" + extendedBolusMinutes + "'"
|
" " + extendedBolusPassedMinutes + "/" + extendedBolusDurationInMinutes + "'"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fromExtendedBolus(eb: PumpSync.PumpState.ExtendedBolus?) {
|
fun fromExtendedBolus(eb: PumpSync.PumpState.ExtendedBolus?) {
|
||||||
|
@ -231,7 +257,7 @@ class DiaconnG8Pump @Inject constructor(
|
||||||
var maxBasalPerHours = 0.0
|
var maxBasalPerHours = 0.0
|
||||||
|
|
||||||
// 7. Tempbasal status
|
// 7. Tempbasal status
|
||||||
var tbStatus = 0 // 임시기저 상태
|
var tbStatus = 0 // 임시기저 상태 (1 : running, 2:not running )
|
||||||
var tbTime = 0 // 임시기저 시간
|
var tbTime = 0 // 임시기저 시간
|
||||||
var tbInjectRateRatio = 0 // 임시기저 주입량/률 1000(0.00U)~1600(6.00U), 50000(0%)~50200(200%), 50000이상이면 주입률로 판정
|
var tbInjectRateRatio = 0 // 임시기저 주입량/률 1000(0.00U)~1600(6.00U), 50000(0%)~50200(200%), 50000이상이면 주입률로 판정
|
||||||
var tbElapsedTime = 0 // 임시기저 경과 시간(0~1425분)
|
var tbElapsedTime = 0 // 임시기저 경과 시간(0~1425분)
|
||||||
|
|
|
@ -183,40 +183,6 @@ class BigAPSMainInfoInquireResponsePacket(
|
||||||
// 20. language
|
// 20. language
|
||||||
diaconnG8Pump.selectedLanguage = getByteToInt(bufferData) // language (1=Chiness, 2=Korean, 3=English)
|
diaconnG8Pump.selectedLanguage = getByteToInt(bufferData) // language (1=Chiness, 2=Korean, 3=English)
|
||||||
|
|
||||||
// tempbasal setting status
|
|
||||||
diaconnG8Pump.isTempBasalInProgress = diaconnG8Pump.tbStatus == 1
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "isTempBasalInProgress > " + diaconnG8Pump.isTempBasalInProgress)
|
|
||||||
|
|
||||||
// if rate type is percent
|
|
||||||
if (diaconnG8Pump.tbInjectRateRatio >= 50000) {
|
|
||||||
diaconnG8Pump.tempBasalPercent = diaconnG8Pump.tbInjectRateRatio - 50000
|
|
||||||
|
|
||||||
var absoluteValue = diaconnG8Pump.baseAmount * (diaconnG8Pump.tempBasalPercent / 100.0)
|
|
||||||
absoluteValue = pumpDesc.pumpType.determineCorrectBasalSize(absoluteValue)
|
|
||||||
diaconnG8Pump.tempBasalAbsoluteRate = absoluteValue
|
|
||||||
}
|
|
||||||
|
|
||||||
// if rate type is absolute
|
|
||||||
if(diaconnG8Pump.tbInjectRateRatio in 1000..1600) {
|
|
||||||
diaconnG8Pump.tbInjectAbsoluteValue = (diaconnG8Pump.tbInjectRateRatio -1000) / 100.0
|
|
||||||
diaconnG8Pump.tempBasalAbsoluteRate = diaconnG8Pump.tbInjectAbsoluteValue
|
|
||||||
}
|
|
||||||
|
|
||||||
// extended bolus status
|
|
||||||
if(diaconnG8Pump.squareStatus == 1) { //square
|
|
||||||
diaconnG8Pump.extendedBolusMinutes = diaconnG8Pump.squareTime
|
|
||||||
diaconnG8Pump.extendedBolusAbsoluteRate = diaconnG8Pump.squareAmount
|
|
||||||
diaconnG8Pump.extendedBolusPassedMinutes = diaconnG8Pump.squareInjTime
|
|
||||||
diaconnG8Pump.extendedBolusRemainingMinutes = diaconnG8Pump.squareTime - diaconnG8Pump.squareInjTime
|
|
||||||
diaconnG8Pump.extendedBolusDeliveredSoFar = diaconnG8Pump.squareInjAmount
|
|
||||||
} else if (diaconnG8Pump.dualStatus == 1) { //dual
|
|
||||||
diaconnG8Pump.extendedBolusMinutes = diaconnG8Pump.dualSquareTime
|
|
||||||
diaconnG8Pump.extendedBolusAbsoluteRate = diaconnG8Pump.dualSquareAmount
|
|
||||||
diaconnG8Pump.extendedBolusPassedMinutes = diaconnG8Pump.dualInjSquareTime
|
|
||||||
diaconnG8Pump.extendedBolusRemainingMinutes = diaconnG8Pump.dualSquareTime - diaconnG8Pump.dualInjSquareTime
|
|
||||||
diaconnG8Pump.extendedBolusDeliveredSoFar = diaconnG8Pump.dualInjSquareAmount
|
|
||||||
}
|
|
||||||
|
|
||||||
// pump time setting 'yyyy-MM-dd'T'HH:mm:ssZ' “2019-07-04T12:30:30+0530”
|
// pump time setting 'yyyy-MM-dd'T'HH:mm:ssZ' “2019-07-04T12:30:30+0530”
|
||||||
val time = DateTime(diaconnG8Pump.year, diaconnG8Pump.month, diaconnG8Pump.day, diaconnG8Pump.hour, diaconnG8Pump.minute, diaconnG8Pump.second)
|
val time = DateTime(diaconnG8Pump.year, diaconnG8Pump.month, diaconnG8Pump.day, diaconnG8Pump.hour, diaconnG8Pump.minute, diaconnG8Pump.second)
|
||||||
diaconnG8Pump.setPumpTime(time.millis)
|
diaconnG8Pump.setPumpTime(time.millis)
|
||||||
|
|
|
@ -98,14 +98,12 @@ class BigLogInquireResponsePacket(
|
||||||
val diaconnG8HistoryRecord = DiaconnHistoryRecord(0)
|
val diaconnG8HistoryRecord = DiaconnHistoryRecord(0)
|
||||||
when(pumplogKind) {
|
when(pumplogKind) {
|
||||||
|
|
||||||
LOG_INJECT_MEAL_SUCCESS.LOG_KIND -> { // 8(식사주입성공)
|
LOG_INJECT_MEAL_SUCCESS.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECT_MEAL_SUCCESS.parse(logDataToHexString)
|
val logItem = LOG_INJECT_MEAL_SUCCESS.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
|
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
val detailedBolusInfo = detailedBolusInfoStorage.findDetailedBolusInfo(logDateTime, logItem.injectAmount / 100.0)
|
val detailedBolusInfo = detailedBolusInfoStorage.findDetailedBolusInfo(logDateTime, logItem.injectAmount / 100.0)
|
||||||
|
|
||||||
val newRecord = pumpSync.syncBolusWithPumpId(
|
val newRecord = pumpSync.syncBolusWithPumpId(
|
||||||
timestamp = logDateTime,
|
timestamp = logDateTime,
|
||||||
amount = logItem.injectAmount / 100.0,
|
amount = logItem.injectAmount / 100.0,
|
||||||
|
@ -114,7 +112,6 @@ class BigLogInquireResponsePacket(
|
||||||
pumpType = PumpType.DIACONN_G8,
|
pumpType = PumpType.DIACONN_G8,
|
||||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT MEALBOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT MEALBOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
||||||
|
|
||||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||||
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
|
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
|
||||||
|
@ -139,7 +136,6 @@ class BigLogInquireResponsePacket(
|
||||||
pumpType = PumpType.DIACONN_G8,
|
pumpType = PumpType.DIACONN_G8,
|
||||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT MEALBOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT MEALBOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
||||||
|
|
||||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||||
diaconnG8HistoryRecord.value = if ((logItem.injectAmount / 100.0) < 0) 0.0 else (logItem.injectAmount / 100.0)
|
diaconnG8HistoryRecord.value = if ((logItem.injectAmount / 100.0) < 0) 0.0 else (logItem.injectAmount / 100.0)
|
||||||
|
@ -165,8 +161,6 @@ class BigLogInquireResponsePacket(
|
||||||
pumpType = PumpType.DIACONN_G8,
|
pumpType = PumpType.DIACONN_G8,
|
||||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
||||||
|
|
||||||
|
|
||||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||||
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
|
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
|
||||||
|
@ -193,8 +187,6 @@ class BigLogInquireResponsePacket(
|
||||||
pumpType = PumpType.DIACONN_G8,
|
pumpType = PumpType.DIACONN_G8,
|
||||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT BOLUS (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Bolus: " + logItem.injectAmount / 100.0 + "U ")
|
||||||
|
|
||||||
|
|
||||||
// Diaconn History Process
|
// Diaconn History Process
|
||||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||||
|
@ -220,7 +212,6 @@ class BigLogInquireResponsePacket(
|
||||||
pumpType = PumpType.DIACONN_G8,
|
pumpType = PumpType.DIACONN_G8,
|
||||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTART (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.setAmount / 100.0 + "U Duration: " + logItem.getInjectTime() * 10 + "min")
|
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTART (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.setAmount / 100.0 + "U Duration: " + logItem.getInjectTime() * 10 + "min")
|
||||||
|
|
||||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||||
diaconnG8HistoryRecord.value = logItem.setAmount / 100.0
|
diaconnG8HistoryRecord.value = logItem.setAmount / 100.0
|
||||||
|
@ -234,10 +225,8 @@ class BigLogInquireResponsePacket(
|
||||||
LOG_INJECT_SQUARE_SUCCESS.LOG_KIND -> {
|
LOG_INJECT_SQUARE_SUCCESS.LOG_KIND -> {
|
||||||
val logItem = LOG_INJECT_SQUARE_SUCCESS.parse(logDataToHexString)
|
val logItem = LOG_INJECT_SQUARE_SUCCESS.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
|
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
|
||||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||||
diaconnG8HistoryRecord.duration = logItem.getInjectTime()
|
diaconnG8HistoryRecord.duration = logItem.getInjectTime()
|
||||||
|
@ -258,7 +247,6 @@ class BigLogInquireResponsePacket(
|
||||||
pumpType = PumpType.DIACONN_G8,
|
pumpType = PumpType.DIACONN_G8,
|
||||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTOP (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Delivered: " + logItem.injectAmount / 100.0 + "U RealDuration: " + logItem.getInjectTime() + "min")
|
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTOP (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Delivered: " + logItem.injectAmount / 100.0 + "U RealDuration: " + logItem.getInjectTime() + "min")
|
||||||
|
|
||||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||||
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
|
diaconnG8HistoryRecord.value = logItem.injectAmount / 100.0
|
||||||
|
@ -272,9 +260,9 @@ class BigLogInquireResponsePacket(
|
||||||
LOG_SET_DUAL_INJECTION.LOG_KIND -> {
|
LOG_SET_DUAL_INJECTION.LOG_KIND -> {
|
||||||
val logItem = LOG_SET_DUAL_INJECTION.parse(logDataToHexString)
|
val logItem = LOG_SET_DUAL_INJECTION.parse(logDataToHexString)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
|
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
|
||||||
// dual square 처리.
|
// dual square 처리.
|
||||||
val newRecord = pumpSync.syncExtendedBolusWithPumpId(
|
val newRecord = pumpSync.syncExtendedBolusWithPumpId(
|
||||||
timestamp = logDateTime,
|
timestamp = logDateTime,
|
||||||
|
@ -285,8 +273,6 @@ class BigLogInquireResponsePacket(
|
||||||
pumpType = PumpType.DIACONN_G8,
|
pumpType = PumpType.DIACONN_G8,
|
||||||
pumpSerial = diaconnG8Pump.serialNo.toString())
|
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTART (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.setSquareAmount / 100.0 + "U Duration: " + logItem.getInjectTime() * 10 + "min")
|
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTART (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.setSquareAmount / 100.0 + "U Duration: " + logItem.getInjectTime() * 10 + "min")
|
||||||
|
|
||||||
|
|
||||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||||
diaconnG8HistoryRecord.value = logItem.setSquareAmount / 100.0
|
diaconnG8HistoryRecord.value = logItem.setSquareAmount / 100.0
|
||||||
|
@ -345,6 +331,13 @@ class BigLogInquireResponsePacket(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
val newRecord = pumpSync.syncStopExtendedBolusWithPumpId(
|
||||||
|
timestamp = logDateTime,
|
||||||
|
endPumpId = logDateTime,
|
||||||
|
pumpType = PumpType.DIACONN_G8,
|
||||||
|
pumpSerial = diaconnG8Pump.serialNo.toString())
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT EXTENDEDSTOP (" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Delivered: " + logItem.injectSquareAmount / 100.0 + "U RealDuration: " + logItem.getInjectTime() + "min")
|
||||||
|
|
||||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_BOLUS
|
||||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||||
diaconnG8HistoryRecord.value = logItem.injectNormAmount / 100.0 + logItem.injectSquareAmount / 100.0
|
diaconnG8HistoryRecord.value = logItem.injectNormAmount / 100.0 + logItem.injectSquareAmount / 100.0
|
||||||
|
@ -385,7 +378,6 @@ class BigLogInquireResponsePacket(
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
aapsLogger.debug(LTag.PUMPCOMM, "$logItem ")
|
||||||
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
val logStartDate = DateUtils.parseDate(logItem.dttm, "yyyy-MM-dd HH:mm:ss")
|
||||||
val logDateTime = logStartDate.time
|
val logDateTime = logStartDate.time
|
||||||
|
|
||||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_SUSPEND
|
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_SUSPEND
|
||||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||||
diaconnG8HistoryRecord.stringValue = resourceHelper.gs(R.string.diaconn_g8_lgorelease, logItem.getBasalPattern())
|
diaconnG8HistoryRecord.stringValue = resourceHelper.gs(R.string.diaconn_g8_lgorelease, logItem.getBasalPattern())
|
||||||
|
@ -408,8 +400,6 @@ class BigLogInquireResponsePacket(
|
||||||
)
|
)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT INSULINCHANGE(" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.remainAmount / 100.0 + "U")
|
aapsLogger.debug(LTag.PUMPCOMM, (if (newRecord) "**NEW** " else "") + "EVENT INSULINCHANGE(" + pumplogKind + ") " + dateUtil.dateAndTimeString(logDateTime) + " (" + logDateTime + ")" + " Amount: " + logItem.remainAmount / 100.0 + "U")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_REFILL
|
diaconnG8HistoryRecord.code = RecordTypes.RECORD_TYPE_REFILL
|
||||||
diaconnG8HistoryRecord.timestamp = logDateTime
|
diaconnG8HistoryRecord.timestamp = logDateTime
|
||||||
diaconnG8HistoryRecord.value = logItem.remainAmount / 100.0
|
diaconnG8HistoryRecord.value = logItem.remainAmount / 100.0
|
||||||
|
|
|
@ -180,40 +180,6 @@ class BigMainInfoInquireResponsePacket(
|
||||||
diaconnG8Pump.baseAmount23 = getShortToInt(bufferData) / 100.0 // 주입량 23(량*100, 23.25->2325, 15.2->1520)
|
diaconnG8Pump.baseAmount23 = getShortToInt(bufferData) / 100.0 // 주입량 23(량*100, 23.25->2325, 15.2->1520)
|
||||||
diaconnG8Pump.baseAmount24 = getShortToInt(bufferData) / 100.0 // 주입량 24(량*100, 23.25->2325, 15.2->1520)
|
diaconnG8Pump.baseAmount24 = getShortToInt(bufferData) / 100.0 // 주입량 24(량*100, 23.25->2325, 15.2->1520)
|
||||||
|
|
||||||
// tempbasal setting status
|
|
||||||
diaconnG8Pump.isTempBasalInProgress = diaconnG8Pump.tbStatus == 1
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "isTempBasalInProgress > " + diaconnG8Pump.isTempBasalInProgress)
|
|
||||||
|
|
||||||
// if rate type is percent
|
|
||||||
if (diaconnG8Pump.tbInjectRateRatio >= 50000) {
|
|
||||||
diaconnG8Pump.tempBasalPercent = diaconnG8Pump.tbInjectRateRatio - 50000
|
|
||||||
|
|
||||||
var absoluteValue = diaconnG8Pump.baseAmount * (diaconnG8Pump.tempBasalPercent / 100.0)
|
|
||||||
absoluteValue = pumpDesc.pumpType.determineCorrectBasalSize(absoluteValue)
|
|
||||||
diaconnG8Pump.tempBasalAbsoluteRate = absoluteValue
|
|
||||||
}
|
|
||||||
|
|
||||||
// if rate type is absolute
|
|
||||||
if(diaconnG8Pump.tbInjectRateRatio in 1000..1600) {
|
|
||||||
diaconnG8Pump.tbInjectAbsoluteValue = (diaconnG8Pump.tbInjectRateRatio -1000) / 100.0
|
|
||||||
diaconnG8Pump.tempBasalAbsoluteRate = diaconnG8Pump.tbInjectAbsoluteValue
|
|
||||||
}
|
|
||||||
|
|
||||||
// extended bolus status
|
|
||||||
if(diaconnG8Pump.squareStatus == 1) { //square
|
|
||||||
diaconnG8Pump.extendedBolusMinutes = diaconnG8Pump.squareTime
|
|
||||||
diaconnG8Pump.extendedBolusAbsoluteRate = diaconnG8Pump.squareAmount
|
|
||||||
diaconnG8Pump.extendedBolusPassedMinutes = diaconnG8Pump.squareInjTime
|
|
||||||
diaconnG8Pump.extendedBolusRemainingMinutes = diaconnG8Pump.squareTime - diaconnG8Pump.squareInjTime
|
|
||||||
diaconnG8Pump.extendedBolusDeliveredSoFar = diaconnG8Pump.squareInjAmount
|
|
||||||
} else if (diaconnG8Pump.dualStatus == 1) { //dual
|
|
||||||
diaconnG8Pump.extendedBolusMinutes = diaconnG8Pump.dualSquareTime
|
|
||||||
diaconnG8Pump.extendedBolusAbsoluteRate = diaconnG8Pump.dualSquareAmount
|
|
||||||
diaconnG8Pump.extendedBolusPassedMinutes = diaconnG8Pump.dualInjSquareTime
|
|
||||||
diaconnG8Pump.extendedBolusRemainingMinutes = diaconnG8Pump.dualSquareTime - diaconnG8Pump.dualInjSquareTime
|
|
||||||
diaconnG8Pump.extendedBolusDeliveredSoFar = diaconnG8Pump.dualInjSquareAmount
|
|
||||||
}
|
|
||||||
|
|
||||||
// pump time setting 'yyyy-MM-dd'T'HH:mm:ssZ' “2019-07-04T12:30:30+0530”
|
// pump time setting 'yyyy-MM-dd'T'HH:mm:ssZ' “2019-07-04T12:30:30+0530”
|
||||||
val time = DateTime(diaconnG8Pump.year, diaconnG8Pump.month, diaconnG8Pump.day, diaconnG8Pump.hour, diaconnG8Pump.minute, diaconnG8Pump.second)
|
val time = DateTime(diaconnG8Pump.year, diaconnG8Pump.month, diaconnG8Pump.day, diaconnG8Pump.hour, diaconnG8Pump.minute, diaconnG8Pump.second)
|
||||||
diaconnG8Pump.setPumpTime(time.millis)
|
diaconnG8Pump.setPumpTime(time.millis)
|
||||||
|
|
|
@ -267,7 +267,7 @@ public class DiaconnG8Packet {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
aapsLogger.error(LTag.PUMPCOMM, "Pump canceled due to non-response.");
|
aapsLogger.error(LTag.PUMPCOMM, "Canceled due to the opt number did not match.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
|
@ -290,6 +290,26 @@ public class DiaconnG8Packet {
|
||||||
aapsLogger.error(LTag.PUMPCOMM, "After base setting is completed, base injection can be made.");
|
aapsLogger.error(LTag.PUMPCOMM, "After base setting is completed, base injection can be made.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
aapsLogger.error(LTag.PUMPCOMM, "During LGS running, injection is restricted");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 33:
|
||||||
|
aapsLogger.error(LTag.PUMPCOMM, "LGS status is ON, ON Command is declined.");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 34:
|
||||||
|
aapsLogger.error(LTag.PUMPCOMM, "LGS status is OFF, OFF Command is declined.");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 35:
|
||||||
|
aapsLogger.error(LTag.PUMPCOMM, "Tempbasal start is rejected when tempbasal is running");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 36:
|
||||||
|
aapsLogger.error(LTag.PUMPCOMM, "Tempbasal stop is rejected when tempbasal is not running");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
aapsLogger.error(LTag.PUMPCOMM, "It cannot be set to a system error.");
|
aapsLogger.error(LTag.PUMPCOMM, "It cannot be set to a system error.");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -21,7 +21,7 @@ class InjectionCancelSettingPacket(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun encode(msgSeq:Int): ByteArray {
|
override fun encode(msgSeq:Int): ByteArray {
|
||||||
var buffer = prefixEncode(msgType, msgSeq, MSG_CON_END)
|
val buffer = prefixEncode(msgType, msgSeq, MSG_CON_END)
|
||||||
buffer.put(reqMsgType)
|
buffer.put(reqMsgType)
|
||||||
return suffixEncode(buffer)
|
return suffixEncode(buffer)
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,19 +37,17 @@ class InjectionExtendedBolusResultReportPacket(injector: HasAndroidInjector) : D
|
||||||
val bolusAmountToBeDelivered = getShortToInt(bufferData) / 100.0
|
val bolusAmountToBeDelivered = getShortToInt(bufferData) / 100.0
|
||||||
val deliveredBolusAmount = getShortToInt(bufferData) / 100.0
|
val deliveredBolusAmount = getShortToInt(bufferData) / 100.0
|
||||||
|
|
||||||
//diaconnG8Pump.isExtendedInProgress = result == 0
|
diaconnG8Pump.isExtendedInProgress = result == 0
|
||||||
diaconnG8Pump.extendedBolusMinutes = settingMinutes
|
diaconnG8Pump.squareTime = settingMinutes
|
||||||
diaconnG8Pump.extendedBolusAbsoluteRate = bolusAmountToBeDelivered
|
diaconnG8Pump.squareInjTime = elapsedTime
|
||||||
diaconnG8Pump.extendedBolusPassedMinutes = elapsedTime
|
diaconnG8Pump.squareAmount = bolusAmountToBeDelivered
|
||||||
diaconnG8Pump.extendedBolusRemainingMinutes = settingMinutes - elapsedTime
|
diaconnG8Pump.squareInjAmount = deliveredBolusAmount
|
||||||
diaconnG8Pump.extendedBolusDeliveredSoFar = deliveredBolusAmount
|
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result: $result")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result: $result")
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus running: " + diaconnG8Pump.extendedBolusAbsoluteRate + " U/h")
|
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus running: " + diaconnG8Pump.squareAmount + " U/h")
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus duration: " + diaconnG8Pump.extendedBolusMinutes + " min")
|
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus duration: " + diaconnG8Pump.squareTime + " min")
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus so far: " + diaconnG8Pump.extendedBolusSoFarInMinutes + " min")
|
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus so far: " + diaconnG8Pump.squareInjTime + " min")
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus remaining minutes: " + diaconnG8Pump.extendedBolusRemainingMinutes + " min")
|
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus delivered so far: " + diaconnG8Pump.squareInjAmount + " U")
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Extended bolus delivered so far: " + diaconnG8Pump.extendedBolusDeliveredSoFar + " U")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override fun getFriendlyName(): String {
|
||||||
|
|
|
@ -23,6 +23,6 @@ class LogStatusInquirePacket(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFriendlyName(): String {
|
override fun getFriendlyName(): String {
|
||||||
return "PUMP_OG_STATUS_INQUIRE"
|
return "PUMP_LOG_STATUS_INQUIRE"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -42,11 +42,6 @@ open class TempBasalInquireResponsePacket(
|
||||||
diaconnG8Pump.tbInjectRateRatio = getShortToInt(bufferData) //임시기저 주입량/률
|
diaconnG8Pump.tbInjectRateRatio = getShortToInt(bufferData) //임시기저 주입량/률
|
||||||
diaconnG8Pump.tbElapsedTime = getShortToInt(bufferData) // 임시기저 경과시간
|
diaconnG8Pump.tbElapsedTime = getShortToInt(bufferData) // 임시기저 경과시간
|
||||||
|
|
||||||
diaconnG8Pump.isTempBasalInProgress = diaconnG8Pump.tbStatus == 1
|
|
||||||
if (diaconnG8Pump.tbInjectRateRatio >= 50000) {
|
|
||||||
diaconnG8Pump.tempBasalPercent = diaconnG8Pump.tbInjectRateRatio - 50000
|
|
||||||
}
|
|
||||||
|
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Result --> $result")
|
aapsLogger.debug(LTag.PUMPCOMM, "Result --> $result")
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "tbStatus > " + diaconnG8Pump.tbStatus)
|
aapsLogger.debug(LTag.PUMPCOMM, "tbStatus > " + diaconnG8Pump.tbStatus)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "tbTime> " + diaconnG8Pump.tbTime)
|
aapsLogger.debug(LTag.PUMPCOMM, "tbTime> " + diaconnG8Pump.tbTime)
|
||||||
|
|
|
@ -31,21 +31,21 @@ class TempBasalReportPacket(
|
||||||
|
|
||||||
val bufferData = prefixDecode(data)
|
val bufferData = prefixDecode(data)
|
||||||
diaconnG8Pump.tbStatus = getByteToInt(bufferData)
|
diaconnG8Pump.tbStatus = getByteToInt(bufferData)
|
||||||
diaconnG8Pump.isTempBasalInProgress = diaconnG8Pump.tbStatus == 1
|
//diaconnG8Pump.isTempBasalInProgress = diaconnG8Pump.tbStatus == 1
|
||||||
|
|
||||||
// 응답받은 임시기저 상태가 주입중이면, pump객체에 정보를 갱신.
|
// 응답받은 임시기저 상태가 주입중이면, pump객체에 정보를 갱신.
|
||||||
if(diaconnG8Pump.isTempBasalInProgress) {
|
// if(diaconnG8Pump.isTempBasalInProgress) {
|
||||||
diaconnG8Pump.tbTime = getByteToInt(bufferData)
|
// diaconnG8Pump.tbTime = getByteToInt(bufferData)
|
||||||
diaconnG8Pump.tbInjectRateRatio = getShortToInt(bufferData)
|
// diaconnG8Pump.tbInjectRateRatio = getShortToInt(bufferData)
|
||||||
if (diaconnG8Pump.tbInjectRateRatio >= 50000) {
|
// if (diaconnG8Pump.tbInjectRateRatio >= 50000) {
|
||||||
diaconnG8Pump.tempBasalPercent = diaconnG8Pump.tbInjectRateRatio - 50000
|
// diaconnG8Pump.tempBasalPercent = diaconnG8Pump.tbInjectRateRatio - 50000
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(diaconnG8Pump.tbInjectRateRatio in 1000..1600) {
|
// if(diaconnG8Pump.tbInjectRateRatio in 1000..1600) {
|
||||||
diaconnG8Pump.tbInjectAbsoluteValue = (diaconnG8Pump.tbInjectRateRatio -1000) / 100.0
|
// diaconnG8Pump.tbInjectAbsoluteValue = (diaconnG8Pump.tbInjectRateRatio -1000) / 100.0
|
||||||
diaconnG8Pump.tempBasalAbsoluteRate = diaconnG8Pump.tbInjectAbsoluteValue
|
// diaconnG8Pump.tempBasalAbsoluteRate = diaconnG8Pump.tbInjectAbsoluteValue
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "tbStatus > " + diaconnG8Pump.tbStatus)
|
aapsLogger.debug(LTag.PUMPCOMM, "tbStatus > " + diaconnG8Pump.tbStatus)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "tbTime> " + diaconnG8Pump.tbTime)
|
aapsLogger.debug(LTag.PUMPCOMM, "tbTime> " + diaconnG8Pump.tbTime)
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "tbInjectRateRatio > " + diaconnG8Pump.tbInjectRateRatio)
|
aapsLogger.debug(LTag.PUMPCOMM, "tbInjectRateRatio > " + diaconnG8Pump.tbInjectRateRatio)
|
||||||
|
|
|
@ -138,14 +138,14 @@ class DiaconnG8Service : DaggerService() {
|
||||||
val pumpFirmwareVersion = sp.getString(resourceHelper.gs(R.string.pumpversion),"")
|
val pumpFirmwareVersion = sp.getString(resourceHelper.gs(R.string.pumpversion),"")
|
||||||
|
|
||||||
if(!StringUtils.emptyString(pumpFirmwareVersion) && PumplogUtil.isPumpVersionGe(pumpFirmwareVersion, 2, 83)) {
|
if(!StringUtils.emptyString(pumpFirmwareVersion) && PumplogUtil.isPumpVersionGe(pumpFirmwareVersion, 2, 83)) {
|
||||||
sendMessage(BigAPSMainInfoInquirePacket(injector), 2000) // APS Pump Main Info
|
sendMessage(BigAPSMainInfoInquirePacket(injector)) // APS Pump Main Info
|
||||||
} else {
|
} else {
|
||||||
sendMessage(BasalLimitInquirePacket(injector), 2000) // basal Limit
|
sendMessage(BasalLimitInquirePacket(injector)) // basal Limit
|
||||||
sendMessage(SneckLimitInquirePacket(injector), 2000) // bolus Limit
|
sendMessage(SneckLimitInquirePacket(injector)) // bolus Limit
|
||||||
sendMessage(BigMainInfoInquirePacket(injector), 2000) // Pump Main Info
|
sendMessage(BigMainInfoInquirePacket(injector)) // Pump Main Info
|
||||||
sendMessage(SoundInquirePacket(injector), 2000) // sounds
|
sendMessage(SoundInquirePacket(injector)) // sounds
|
||||||
sendMessage(DisplayTimeInquirePacket(injector), 2000) // display
|
sendMessage(DisplayTimeInquirePacket(injector)) // display
|
||||||
sendMessage(LanguageInquirePacket(injector), 2000) // language
|
sendMessage(LanguageInquirePacket(injector)) // language
|
||||||
}
|
}
|
||||||
|
|
||||||
diaconnG8Pump.lastConnection = System.currentTimeMillis()
|
diaconnG8Pump.lastConnection = System.currentTimeMillis()
|
||||||
|
@ -322,10 +322,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
else -> null
|
else -> null
|
||||||
} ?: return result.success(false)
|
} ?: return result.success(false)
|
||||||
|
|
||||||
sendMessage(msg, 2000)
|
sendMessage(msg )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// pump confirm
|
// pump confirm
|
||||||
if(diaconnG8Pump.otpNumber == 0) {
|
if(diaconnG8Pump.otpNumber == 0) {
|
||||||
aapsLogger.error(LTag.PUMPCOMM, "otp is not received yet")
|
aapsLogger.error(LTag.PUMPCOMM, "otp is not received yet")
|
||||||
|
@ -333,9 +330,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
result.comment("펌프와 연결 상태를 확인해주세요.")
|
result.comment("펌프와 연결 상태를 확인해주세요.")
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage(AppConfirmSettingPacket(injector, msg.msgType, diaconnG8Pump.otpNumber))
|
sendMessage(AppConfirmSettingPacket(injector, msg.msgType, diaconnG8Pump.otpNumber))
|
||||||
|
|
||||||
diaconnG8Pump.otpNumber = 0
|
diaconnG8Pump.otpNumber = 0
|
||||||
SystemClock.sleep(100)
|
SystemClock.sleep(100)
|
||||||
return result.success(true)
|
return result.success(true)
|
||||||
|
@ -353,13 +348,13 @@ class DiaconnG8Service : DaggerService() {
|
||||||
// aps speed check
|
// aps speed check
|
||||||
if(!isSpeedSyncToPump) {
|
if(!isSpeedSyncToPump) {
|
||||||
val msg = BolusSpeedSettingPacket(injector, apsPrefBolusSpeed)
|
val msg = BolusSpeedSettingPacket(injector, apsPrefBolusSpeed)
|
||||||
sendMessage(msg, 2000)
|
sendMessage(msg)
|
||||||
sendMessage(AppConfirmSettingPacket(injector, msg.msgType, diaconnG8Pump.otpNumber))
|
sendMessage(AppConfirmSettingPacket(injector, msg.msgType, diaconnG8Pump.otpNumber))
|
||||||
diaconnG8Pump.otpNumber = 0
|
diaconnG8Pump.otpNumber = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// pump bolus speed inquire
|
// pump bolus speed inquire
|
||||||
sendMessage(BolusSpeedInquirePacket(injector), 1000)
|
sendMessage(BolusSpeedInquirePacket(injector))
|
||||||
diaconnG8Pump.bolusDone = false
|
diaconnG8Pump.bolusDone = false
|
||||||
diaconnG8Pump.bolusingTreatment = t
|
diaconnG8Pump.bolusingTreatment = t
|
||||||
diaconnG8Pump.bolusAmountToBeDelivered = insulin
|
diaconnG8Pump.bolusAmountToBeDelivered = insulin
|
||||||
|
@ -373,7 +368,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
val bolusStart = System.currentTimeMillis()
|
val bolusStart = System.currentTimeMillis()
|
||||||
if (insulin > 0) {
|
if (insulin > 0) {
|
||||||
if (!diaconnG8Pump.bolusStopped) {
|
if (!diaconnG8Pump.bolusStopped) {
|
||||||
sendMessage(start, 1000)
|
sendMessage(start)
|
||||||
// otp process
|
// otp process
|
||||||
if(!processConfirm(start.msgType)) return false
|
if(!processConfirm(start.msgType)) return false
|
||||||
} else {
|
} else {
|
||||||
|
@ -431,7 +426,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
|
|
||||||
diaconnG8Pump.bolusStopForced = true
|
diaconnG8Pump.bolusStopForced = true
|
||||||
if (isConnected) {
|
if (isConnected) {
|
||||||
sendMessage(stop,2000)
|
sendMessage(stop)
|
||||||
// otp process
|
// otp process
|
||||||
if(!processConfirm(stop.msgType)) return
|
if(!processConfirm(stop.msgType)) return
|
||||||
while (!diaconnG8Pump.bolusStopped) {
|
while (!diaconnG8Pump.bolusStopped) {
|
||||||
|
@ -444,11 +439,15 @@ class DiaconnG8Service : DaggerService() {
|
||||||
|
|
||||||
fun tempBasal(absoluteRate: Double, durationInHours: Double): Boolean {
|
fun tempBasal(absoluteRate: Double, durationInHours: Double): Boolean {
|
||||||
if (!isConnected) return false
|
if (!isConnected) return false
|
||||||
if (diaconnG8Pump.isTempBasalInProgress) {
|
|
||||||
|
// temp state check
|
||||||
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
|
|
||||||
|
if (diaconnG8Pump.tbStatus ==1 || diaconnG8Pump.isTempBasalInProgress) {
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
||||||
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
||||||
// tempbasal stop
|
// tempbasal stop
|
||||||
sendMessage(msgPacket, 2000)
|
sendMessage(msgPacket)
|
||||||
// otp process
|
// otp process
|
||||||
if(!processConfirm(msgPacket.msgType)) return false
|
if(!processConfirm(msgPacket.msgType)) return false
|
||||||
diaconnG8Pump.tempBasalStart= dateUtil.now()
|
diaconnG8Pump.tempBasalStart= dateUtil.now()
|
||||||
|
@ -456,7 +455,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
||||||
val tbInjectRate = ((absoluteRate*100) + 1000).toInt()
|
val tbInjectRate = ((absoluteRate*100) + 1000).toInt()
|
||||||
val msgTBR = TempBasalSettingPacket(injector, 1, ((durationInHours * 60) / 15).toInt(), tbInjectRate)
|
val msgTBR = TempBasalSettingPacket(injector, 1, ((durationInHours * 60) / 15).toInt(), tbInjectRate)
|
||||||
sendMessage(msgTBR, 2000)
|
sendMessage(msgTBR)
|
||||||
// otp process
|
// otp process
|
||||||
if(!processConfirm(msgTBR.msgType)) return false
|
if(!processConfirm(msgTBR.msgType)) return false
|
||||||
// pump tempbasal status inquire
|
// pump tempbasal status inquire
|
||||||
|
@ -469,11 +468,14 @@ class DiaconnG8Service : DaggerService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun highTempBasal(absoluteRate: Double): Boolean {
|
fun highTempBasal(absoluteRate: Double): Boolean {
|
||||||
if (diaconnG8Pump.isTempBasalInProgress) {
|
// temp state check
|
||||||
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
|
|
||||||
|
if (diaconnG8Pump.tbStatus ==1 || diaconnG8Pump.isTempBasalInProgress) {
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
||||||
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
||||||
// tempbasal stop
|
// tempbasal stop
|
||||||
sendMessage(msgPacket, 2000)
|
sendMessage(msgPacket)
|
||||||
// otp process
|
// otp process
|
||||||
if(!processConfirm(msgPacket.msgType)) return false
|
if(!processConfirm(msgPacket.msgType)) return false
|
||||||
diaconnG8Pump.tempBasalStart= dateUtil.now()
|
diaconnG8Pump.tempBasalStart= dateUtil.now()
|
||||||
|
@ -490,7 +492,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "APS Temp basal start absoluteRate: $newAbsoluteRate duration 30 min")
|
aapsLogger.debug(LTag.PUMPCOMM, "APS Temp basal start absoluteRate: $newAbsoluteRate duration 30 min")
|
||||||
val tbInjectRate = absoluteRate * 100 + 1000
|
val tbInjectRate = absoluteRate * 100 + 1000
|
||||||
val msgTBR = TempBasalSettingPacket(injector, 1, tbTime, tbInjectRate.toInt())
|
val msgTBR = TempBasalSettingPacket(injector, 1, tbTime, tbInjectRate.toInt())
|
||||||
sendMessage(msgTBR, 2000)
|
sendMessage(msgTBR)
|
||||||
// otp process
|
// otp process
|
||||||
if(!processConfirm(msgTBR.msgType)) return false
|
if(!processConfirm(msgTBR.msgType)) return false
|
||||||
sendMessage(TempBasalInquirePacket(injector))
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
|
@ -507,11 +509,14 @@ class DiaconnG8Service : DaggerService() {
|
||||||
aapsLogger.error(LTag.PUMPCOMM, "Wrong duration param")
|
aapsLogger.error(LTag.PUMPCOMM, "Wrong duration param")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (diaconnG8Pump.isTempBasalInProgress) {
|
|
||||||
|
// temp state check
|
||||||
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
|
if (diaconnG8Pump.tbStatus ==1 || diaconnG8Pump.isTempBasalInProgress) {
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
||||||
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
||||||
// tempbasal stop
|
// tempbasal stop
|
||||||
sendMessage(msgPacket, 2000)
|
sendMessage(msgPacket)
|
||||||
// otp process
|
// otp process
|
||||||
if(!processConfirm(msgPacket.msgType)) return false
|
if(!processConfirm(msgPacket.msgType)) return false
|
||||||
SystemClock.sleep(500)
|
SystemClock.sleep(500)
|
||||||
|
@ -519,7 +524,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.settingtempbasal)))
|
||||||
val tbInjectRate = absoluteRate * 100 + 1000
|
val tbInjectRate = absoluteRate * 100 + 1000
|
||||||
val msgTBR = TempBasalSettingPacket(injector, 1, 2, tbInjectRate.toInt())
|
val msgTBR = TempBasalSettingPacket(injector, 1, 2, tbInjectRate.toInt())
|
||||||
sendMessage(msgTBR, 2000)
|
sendMessage(msgTBR)
|
||||||
// otp process
|
// otp process
|
||||||
if(!processConfirm(msgTBR.msgType)) return false
|
if(!processConfirm(msgTBR.msgType)) return false
|
||||||
sendMessage(TempBasalInquirePacket(injector))
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
|
@ -533,20 +538,27 @@ class DiaconnG8Service : DaggerService() {
|
||||||
fun tempBasalStop(): Boolean {
|
fun tempBasalStop(): Boolean {
|
||||||
if (!isConnected) return false
|
if (!isConnected) return false
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingtempbasal)))
|
||||||
val msgPacket = TempBasalSettingPacket(injector, 2, diaconnG8Pump.tbTime, diaconnG8Pump.tbInjectRateRatio)
|
// temp state check
|
||||||
// tempbasal stop
|
sendMessage(TempBasalInquirePacket(injector))
|
||||||
sendMessage(msgPacket, 2000)
|
if(diaconnG8Pump.tbStatus == 1) {
|
||||||
// otp process
|
val msgPacket = TempBasalSettingPacket(
|
||||||
if(!processConfirm(msgPacket.msgType)) return false
|
injector,
|
||||||
SystemClock.sleep(500)
|
2,
|
||||||
if(diaconnG8Pump.isTempBasalInProgress) {
|
diaconnG8Pump.tbTime,
|
||||||
sendMessage(TempBasalInquirePacket(injector), 2000)
|
diaconnG8Pump.tbInjectRateRatio
|
||||||
|
)
|
||||||
|
// tempbasal stop
|
||||||
|
sendMessage(msgPacket)
|
||||||
|
// otp process
|
||||||
|
if (!processConfirm(msgPacket.msgType)) return false
|
||||||
|
SystemClock.sleep(500)
|
||||||
}
|
}
|
||||||
|
|
||||||
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 msgPacket.success()
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun extendedBolus(insulin: Double, durationInMinutes: Int): Boolean {
|
fun extendedBolus(insulin: Double, durationInMinutes: Int): Boolean {
|
||||||
|
@ -555,7 +567,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
aapsLogger.error(LTag.PUMPCOMM, "insulin: $insulin durationInMinutes: $durationInMinutes")
|
aapsLogger.error(LTag.PUMPCOMM, "insulin: $insulin durationInMinutes: $durationInMinutes")
|
||||||
|
|
||||||
val msgExtended = InjectionExtendedBolusSettingPacket(injector, (insulin * 100).toInt(), durationInMinutes, dateUtil.now())
|
val msgExtended = InjectionExtendedBolusSettingPacket(injector, (insulin * 100).toInt(), durationInMinutes, dateUtil.now())
|
||||||
sendMessage(msgExtended, 2000)
|
sendMessage(msgExtended)
|
||||||
// otp process
|
// otp process
|
||||||
if(!processConfirm(msgExtended.msgType)) return false
|
if(!processConfirm(msgExtended.msgType)) return false
|
||||||
//diaconnG8Pump.isExtendedInProgress = true
|
//diaconnG8Pump.isExtendedInProgress = true
|
||||||
|
@ -569,8 +581,9 @@ class DiaconnG8Service : DaggerService() {
|
||||||
fun extendedBolusStop(): Boolean {
|
fun extendedBolusStop(): Boolean {
|
||||||
if (!isConnected) return false
|
if (!isConnected) return false
|
||||||
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus)))
|
rxBus.send(EventPumpStatusChanged(resourceHelper.gs(R.string.stoppingextendedbolus)))
|
||||||
val msgStop = InjectionCancelSettingPacket(injector, 0x08.toByte())
|
val msgType = if(diaconnG8Pump.dualStatus == 1) 0x09.toByte() else 0x08.toByte()
|
||||||
sendMessage(msgStop, 2000)
|
val msgStop = InjectionCancelSettingPacket(injector, msgType)
|
||||||
|
sendMessage(msgStop)
|
||||||
// otp process
|
// otp process
|
||||||
if(!processConfirm(msgStop.msgType)) return false
|
if(!processConfirm(msgStop.msgType)) return false
|
||||||
loadHistory()
|
loadHistory()
|
||||||
|
@ -610,7 +623,7 @@ class DiaconnG8Service : DaggerService() {
|
||||||
SystemClock.sleep(30000)
|
SystemClock.sleep(30000)
|
||||||
|
|
||||||
val msgPacket = InjectionBasalSettingPacket(injector, 1)
|
val msgPacket = InjectionBasalSettingPacket(injector, 1)
|
||||||
sendMessage(msgPacket, 2000)
|
sendMessage(msgPacket)
|
||||||
// otp process
|
// otp process
|
||||||
if(!processConfirm(msgPacket.msgType)) return false
|
if(!processConfirm(msgPacket.msgType)) return false
|
||||||
readPumpStatus()
|
readPumpStatus()
|
||||||
|
|
Loading…
Reference in a new issue