- final changes on Bolus (checking if bolus entry was changed in last 35 minutes)

- added class for Dropbox support (not yet implemented)
This commit is contained in:
Andy Rozman 2021-05-13 13:33:25 +01:00
parent 2b43ee186f
commit 14b7895f20
4 changed files with 25 additions and 6 deletions

View file

@ -0,0 +1,8 @@
package info.nightscout.androidaps.plugins.general.maintenance
class DropboxUploader {
}

View file

@ -5,6 +5,7 @@ import com.google.gson.annotations.Expose
import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil import info.nightscout.androidaps.plugins.pump.common.utils.ByteUtil
import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil import info.nightscout.androidaps.plugins.pump.common.utils.StringUtil
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.MedtronicHistoryEntry import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.MedtronicHistoryEntry
import info.nightscout.androidaps.plugins.pump.medtronic.data.dto.BolusDTO
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
import java.util.* import java.util.*
@ -113,8 +114,18 @@ class PumpHistoryEntry : MedtronicHistoryEntry() {
super.pumpId = pumpId super.pumpId = pumpId
} }
fun hasBolusOrTBRDataChanged(entry: PumpHistoryEntry) : Boolean { fun hasBolusChanged(entry: PumpHistoryEntry) : Boolean {
if (entryType!=null && (entryType!! == PumpHistoryEntryType.Bolus || entryType!! == PumpHistoryEntryType.TempBasalCombined)) { if (entryType!=null && entryType == PumpHistoryEntryType.Bolus) {
val thisOne: BolusDTO? = this.decodedData!!["Object"]!! as BolusDTO?
val otherOne: BolusDTO? = entry.decodedData!!["Object"]!! as BolusDTO?
if (thisOne==null || otherOne==null) {
return false;
}
return false // TODO needs to be implemented return false // TODO needs to be implemented
} }

View file

@ -88,10 +88,10 @@ class MedtronicHistoryData @Inject constructor(
} else { } else {
val entryByPumpId = getEntryByPumpId(validEntry.pumpId!!) val entryByPumpId = getEntryByPumpId(validEntry.pumpId!!)
// TODO not implemented if (entryByPumpId!=null && entryByPumpId.hasBolusChanged(validEntry)) {
if (entryByPumpId!=null && entryByPumpId.hasBolusOrTBRDataChanged(validEntry)) {
newEntries.add(validEntry) newEntries.add(validEntry)
allHistory.remove(entryByPumpId) allHistory.remove(entryByPumpId)
allPumpIds.remove(validEntry.pumpId!!);
} }
} }
} }

View file

@ -57,7 +57,7 @@ class BolusDTO : PumpTimeStampedRecord() {
return StringUtil.getLeadingZero(h, 2) + ":" + StringUtil.getLeadingZero(minutes, 2) return StringUtil.getLeadingZero(h, 2) + ":" + StringUtil.getLeadingZero(minutes, 2)
} }
val value: String? val value: String
get() = if (bolusType === PumpBolusType.Normal || bolusType === PumpBolusType.Audio) { get() = if (bolusType === PumpBolusType.Normal || bolusType === PumpBolusType.Audio) {
getFormattedDecimal(deliveredAmount!!) getFormattedDecimal(deliveredAmount!!)
} else if (bolusType === PumpBolusType.Extended) { } else if (bolusType === PumpBolusType.Extended) {
@ -77,7 +77,7 @@ class BolusDTO : PumpTimeStampedRecord() {
return value return value
} }
override fun getFormattedDecimal(value: Double): String? { override fun getFormattedDecimal(value: Double): String {
return StringUtil.getFormatedValueUS(value, 2) return StringUtil.getFormatedValueUS(value, 2)
} }