DanaR: fix loading TDD
This commit is contained in:
parent
772b89d2e3
commit
918a245ed0
1 changed files with 14 additions and 12 deletions
|
@ -32,7 +32,7 @@ open class MsgHistoryAll(
|
||||||
)
|
)
|
||||||
var messageType = ""
|
var messageType = ""
|
||||||
when (recordCode) {
|
when (recordCode) {
|
||||||
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_BOLUS -> {
|
RecordTypes.RECORD_TYPE_BOLUS -> {
|
||||||
val datetime = dateTimeFromBuff(bytes, 1) // 5 bytes
|
val datetime = dateTimeFromBuff(bytes, 1) // 5 bytes
|
||||||
danaHistoryRecord.timestamp = datetime
|
danaHistoryRecord.timestamp = datetime
|
||||||
when (0xF0 and paramByte8.toInt()) {
|
when (0xF0 and paramByte8.toInt()) {
|
||||||
|
@ -62,63 +62,63 @@ open class MsgHistoryAll(
|
||||||
danaHistoryRecord.value = value * 0.01
|
danaHistoryRecord.value = value * 0.01
|
||||||
}
|
}
|
||||||
|
|
||||||
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_DAILY -> {
|
RecordTypes.RECORD_TYPE_DAILY -> {
|
||||||
messageType += "dailyinsulin"
|
messageType += "dailyinsulin"
|
||||||
danaHistoryRecord.timestamp = date
|
danaHistoryRecord.timestamp = date
|
||||||
danaHistoryRecord.dailyBasal = dailyBasal
|
danaHistoryRecord.dailyBasal = dailyBasal
|
||||||
danaHistoryRecord.dailyBolus = dailyBolus
|
danaHistoryRecord.dailyBolus = dailyBolus
|
||||||
}
|
}
|
||||||
|
|
||||||
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_PRIME -> {
|
RecordTypes.RECORD_TYPE_PRIME -> {
|
||||||
messageType += "prime"
|
messageType += "prime"
|
||||||
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
||||||
danaHistoryRecord.timestamp = datetimewihtsec
|
danaHistoryRecord.timestamp = datetimewihtsec
|
||||||
danaHistoryRecord.value = value * 0.01
|
danaHistoryRecord.value = value * 0.01
|
||||||
}
|
}
|
||||||
|
|
||||||
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_ERROR -> {
|
RecordTypes.RECORD_TYPE_ERROR -> {
|
||||||
messageType += "error"
|
messageType += "error"
|
||||||
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
||||||
danaHistoryRecord.timestamp = datetimewihtsec
|
danaHistoryRecord.timestamp = datetimewihtsec
|
||||||
danaHistoryRecord.value = value * 0.01
|
danaHistoryRecord.value = value * 0.01
|
||||||
}
|
}
|
||||||
|
|
||||||
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_REFILL -> {
|
RecordTypes.RECORD_TYPE_REFILL -> {
|
||||||
messageType += "refill"
|
messageType += "refill"
|
||||||
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
||||||
danaHistoryRecord.timestamp = datetimewihtsec
|
danaHistoryRecord.timestamp = datetimewihtsec
|
||||||
danaHistoryRecord.value = value * 0.01
|
danaHistoryRecord.value = value * 0.01
|
||||||
}
|
}
|
||||||
|
|
||||||
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_BASALHOUR -> {
|
RecordTypes.RECORD_TYPE_BASALHOUR -> {
|
||||||
messageType += "basal hour"
|
messageType += "basal hour"
|
||||||
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
||||||
danaHistoryRecord.timestamp = datetimewihtsec
|
danaHistoryRecord.timestamp = datetimewihtsec
|
||||||
danaHistoryRecord.value = value * 0.01
|
danaHistoryRecord.value = value * 0.01
|
||||||
}
|
}
|
||||||
|
|
||||||
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_TB -> {
|
RecordTypes.RECORD_TYPE_TB -> {
|
||||||
messageType += "tb"
|
messageType += "tb"
|
||||||
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
||||||
danaHistoryRecord.timestamp = datetimewihtsec
|
danaHistoryRecord.timestamp = datetimewihtsec
|
||||||
danaHistoryRecord.value = value * 0.01
|
danaHistoryRecord.value = value * 0.01
|
||||||
}
|
}
|
||||||
|
|
||||||
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_GLUCOSE -> {
|
RecordTypes.RECORD_TYPE_GLUCOSE -> {
|
||||||
messageType += "glucose"
|
messageType += "glucose"
|
||||||
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
||||||
danaHistoryRecord.timestamp = datetimewihtsec
|
danaHistoryRecord.timestamp = datetimewihtsec
|
||||||
danaHistoryRecord.value = value
|
danaHistoryRecord.value = value
|
||||||
}
|
}
|
||||||
|
|
||||||
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_CARBO -> {
|
RecordTypes.RECORD_TYPE_CARBO -> {
|
||||||
messageType += "carbo"
|
messageType += "carbo"
|
||||||
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
||||||
danaHistoryRecord.timestamp = datetimewihtsec
|
danaHistoryRecord.timestamp = datetimewihtsec
|
||||||
danaHistoryRecord.value = value
|
danaHistoryRecord.value = value
|
||||||
}
|
}
|
||||||
|
|
||||||
info.nightscout.androidaps.dana.comm.RecordTypes.RECORD_TYPE_ALARM -> {
|
RecordTypes.RECORD_TYPE_ALARM -> {
|
||||||
messageType += "alarm"
|
messageType += "alarm"
|
||||||
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
val datetimewihtsec = dateTimeSecFromBuff(bytes, 1) // 6 bytes
|
||||||
danaHistoryRecord.timestamp = datetimewihtsec
|
danaHistoryRecord.timestamp = datetimewihtsec
|
||||||
|
@ -145,6 +145,8 @@ open class MsgHistoryAll(
|
||||||
17.toByte() -> failed = true
|
17.toByte() -> failed = true
|
||||||
}
|
}
|
||||||
danaHistoryRecordDao.createOrUpdate(danaHistoryRecord)
|
danaHistoryRecordDao.createOrUpdate(danaHistoryRecord)
|
||||||
|
if (recordCode == RecordTypes.RECORD_TYPE_DAILY)
|
||||||
|
pumpSync.createOrUpdateTotalDailyDose(date, dailyBolus, dailyBasal, dailyBolus + dailyBasal, date, activePlugin.activePump.model(), danaPump.serialNumber)
|
||||||
rxBus.send(EventDanaRSyncStatus(dateUtil.dateAndTimeString(danaHistoryRecord.timestamp) + " " + messageType))
|
rxBus.send(EventDanaRSyncStatus(dateUtil.dateAndTimeString(danaHistoryRecord.timestamp) + " " + messageType))
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue