DanaRHistory activity fix

This commit is contained in:
Milos Kozak 2023-08-31 15:33:30 +02:00
parent 79af63ee8f
commit a652f51651
4 changed files with 6 additions and 5 deletions

View file

@ -18,7 +18,8 @@
android:hint="@string/event_type"
app:layout_constraintBottom_toTopOf="@+id/status"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/typeList"

View file

@ -48,7 +48,7 @@ class MsgHistoryEventsV2 constructor(
aapsLogger.debug(LTag.PUMPCOMM, "Last record received")
val array: Array<ByteArray> = messageBuffer.toTypedArray()
val sorted = array.sortedArrayWith { s1: ByteArray, s2: ByteArray -> (dateTime(s1) - dateTime(s2)).toInt() }
val sorted = array.sortedArrayWith { s1: ByteArray, s2: ByteArray -> dateTime(s1).compareTo(dateTime(s2)) }
for (message in sorted) processMessage(message)
danaPump.historyDoneReceived = true
} else messageBuffer.add(bytes)

View file

@ -76,7 +76,7 @@ open class DanaRSPacketAPSHistoryEvents(
aapsLogger.debug(LTag.PUMPCOMM, "Last record received")
val array: Array<ByteArray> = messageBuffer.toTypedArray()
val sorted = array.sortedArrayWith { s1: ByteArray, s2: ByteArray -> (dateTime(s1) - dateTime(s2)).toInt() }
val sorted = array.sortedArrayWith { s1: ByteArray, s2: ByteArray -> dateTime(s1).compareTo(dateTime(s2)) }
for (index in sorted.indices) {
val message = sorted[index]
// workaround for RS history bug
@ -102,7 +102,7 @@ open class DanaRSPacketAPSHistoryEvents(
} else messageBuffer.add(data)
}
fun dateTime(data: ByteArray): Long =
private fun dateTime(data: ByteArray): Long =
if (!danaPump.usingUTC) dateTimeSecFromBuff(data, 1) // 6 bytes
else intFromBuffMsbLsb(data, 3, 4) * 1000L

View file

@ -4,7 +4,7 @@ import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.danars.encryption.BleEncryption
import info.nightscout.rx.logging.LTag
class DanaRSPacketHistoryBolus constructor(
class DanaRSPacketHistoryBolus(
injector: HasAndroidInjector,
from: Long = 0
) : DanaRSPacketHistory(injector, from) {