format. switch historyId to Long
This commit is contained in:
parent
b437307157
commit
58a40778d9
|
@ -5,11 +5,11 @@ import androidx.room.Room
|
|||
import androidx.test.core.app.ApplicationProvider
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.github.guepardoapps.kulid.ULID
|
||||
import info.nightscout.shared.logging.AAPSLoggerTest
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.HistoryRecordDao
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.mapper.HistoryMapper
|
||||
import info.nightscout.shared.logging.AAPSLoggerTest
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
|
|
|
@ -16,6 +16,7 @@ import info.nightscout.androidaps.extensions.convertedToAbsolute
|
|||
import info.nightscout.androidaps.extensions.plannedRemainingMinutes
|
||||
import info.nightscout.androidaps.extensions.toStringFull
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.common.ManufacturerType
|
||||
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
|
||||
|
@ -48,7 +49,6 @@ import info.nightscout.androidaps.utils.DecimalFormatter.to2Decimal
|
|||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.TimeChangeType
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
|
@ -1324,8 +1324,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
|||
|
||||
private fun executeProgrammingCommand(
|
||||
pre: Completable = Completable.complete(),
|
||||
historyEntry: Single<String>,
|
||||
activeCommandEntry: (historyId: String) -> Single<OmnipodDashPodStateManager.ActiveCommand> =
|
||||
historyEntry: Single<Long>,
|
||||
activeCommandEntry: (historyId: Long) -> Single<OmnipodDashPodStateManager.ActiveCommand> =
|
||||
{ historyId -> podStateManager.createActiveCommand(historyId) },
|
||||
command: Completable,
|
||||
post: Completable = Completable.complete(),
|
||||
|
|
|
@ -4,11 +4,11 @@ import android.content.Context
|
|||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Reusable
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.DashHistory
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.DashHistoryDatabase
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.HistoryRecordDao
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.mapper.HistoryMapper
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Module
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver
|
||||
|
||||
import android.os.SystemClock
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.OmnipodDashBleManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.event.PodEvent
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.*
|
||||
|
@ -17,6 +15,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
|
||||
import info.nightscout.androidaps.utils.Round
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import io.reactivex.rxjava3.core.Observable
|
||||
import io.reactivex.rxjava3.functions.Action
|
||||
import io.reactivex.rxjava3.functions.Consumer
|
||||
|
|
|
@ -4,8 +4,6 @@ import android.bluetooth.BluetoothAdapter
|
|||
import android.bluetooth.BluetoothManager
|
||||
import android.content.Context
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.BuildConfig
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.*
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.pair.LTKExchanger
|
||||
|
@ -15,6 +13,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.event.PodEven
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.Command
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.Response
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import io.reactivex.rxjava3.core.Observable
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
|
|
@ -2,8 +2,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm
|
|||
|
||||
import android.bluetooth.BluetoothGatt
|
||||
import android.bluetooth.BluetoothGattCharacteristic
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.callbacks.BleCommCallbacks
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.ConnectException
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.io.CharacteristicType
|
||||
|
@ -11,6 +9,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session.
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session.Connection
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session.Connection.Companion.STOP_CONNECTING_CHECK_INTERVAL_MS
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session.ConnectionWaitCondition
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import java.math.BigInteger
|
||||
import java.util.*
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@ import android.bluetooth.BluetoothGattCharacteristic
|
|||
import android.bluetooth.BluetoothGattDescriptor
|
||||
import android.bluetooth.BluetoothProfile
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.io.CharacteristicType.Companion.byValue
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.io.IncomingPackets
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session.DisconnectHandler
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import java.util.*
|
||||
import java.util.concurrent.BlockingQueue
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.endecrypt
|
||||
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessagePacket
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessagePacket
|
||||
import org.spongycastle.crypto.engines.AESEngine
|
||||
import org.spongycastle.crypto.modes.CCMBlockCipher
|
||||
import org.spongycastle.crypto.params.AEADParameters
|
||||
|
|
|
@ -6,13 +6,13 @@ import android.bluetooth.BluetoothGatt
|
|||
import android.bluetooth.BluetoothGattCharacteristic
|
||||
import android.bluetooth.BluetoothGattDescriptor
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.callbacks.BleCommCallbacks
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.callbacks.WriteConfirmationError
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.callbacks.WriteConfirmationSuccess
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.command.BleCommandRTS
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.*
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import java.util.concurrent.BlockingQueue
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.io
|
|||
|
||||
import android.bluetooth.BluetoothGatt
|
||||
import android.bluetooth.BluetoothGattCharacteristic
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.OmnipodDashBleManagerImpl
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.callbacks.BleCommCallbacks
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.command.BleCommand
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.command.BleCommandHello
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import java.util.concurrent.BlockingQueue
|
||||
|
||||
sealed class BleConfirmResult
|
||||
|
|
|
@ -2,8 +2,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.io
|
|||
|
||||
import android.bluetooth.BluetoothGatt
|
||||
import android.bluetooth.BluetoothGattCharacteristic
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.callbacks.BleCommCallbacks
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import java.util.concurrent.BlockingQueue
|
||||
|
||||
class DataBleIO(
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message
|
||||
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.command.*
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.io.*
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.BlePacket
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.PayloadJoiner
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.packet.PayloadSplitter
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
|
||||
sealed class MessageSendResult
|
||||
object MessageSendSuccess : MessageSendResult()
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.pair
|
||||
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.BuildConfig
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.MessageIOException
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util.RandomByteGenerator
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util.X25519KeyGenerator
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import org.spongycastle.crypto.engines.AESEngine
|
||||
import org.spongycastle.crypto.macs.CMac
|
||||
import org.spongycastle.crypto.params.KeyParameter
|
||||
|
|
|
@ -2,8 +2,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.pair
|
|||
|
||||
import info.nightscout.androidaps.extensions.hexStringToByteArray
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Ids
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.MessageIOException
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.PairingException
|
||||
|
@ -13,6 +11,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.StringLengthPrefixEncoding.Companion.parseKeys
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util.RandomByteGenerator
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util.X25519KeyGenerator
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
|
||||
internal class LTKExchanger(
|
||||
private val aapsLogger: AAPSLogger,
|
||||
|
|
|
@ -4,10 +4,10 @@ import android.bluetooth.BluetoothAdapter
|
|||
import android.bluetooth.le.ScanFilter
|
||||
import android.bluetooth.le.ScanSettings
|
||||
import android.os.ParcelUuid
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.ScanException
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.ScanFailFoundTooManyException
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import java.util.*
|
||||
|
||||
class PodScanner(private val logger: AAPSLogger, private val bluetoothAdapter: BluetoothAdapter) {
|
||||
|
|
|
@ -2,9 +2,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.scan
|
|||
|
||||
import android.bluetooth.le.ScanCallback
|
||||
import android.bluetooth.le.ScanResult
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.ScanException
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.ScanException
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@ import android.bluetooth.BluetoothProfile
|
|||
import android.content.Context
|
||||
import android.os.SystemClock
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.BuildConfig
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Ids
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.ServiceDiscoverer
|
||||
|
@ -22,6 +20,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.io.DataB
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.io.IncomingPackets
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessageIO
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import java.lang.IllegalArgumentException
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session
|
||||
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.MessageIOException
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.MessageIOException
|
||||
import java.nio.ByteBuffer
|
||||
|
||||
enum class EapCode(val code: Byte) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session
|
||||
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.BuildConfig
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.BuildConfig
|
||||
import org.spongycastle.util.encoders.Hex
|
||||
import java.security.SecureRandom
|
||||
import javax.crypto.Cipher
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session
|
||||
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Ids
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.endecrypt.EnDecrypt
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.CouldNotParseResponseException
|
||||
|
@ -11,6 +9,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.StringLengthPrefixEncoding.Companion.parseKeys
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.base.Command
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.Response
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
|
||||
sealed class CommandSendResult
|
||||
object CommandSendSuccess : CommandSendResult()
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.session
|
||||
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Ids
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.endecrypt.Nonce
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.SessionEstablishmentException
|
||||
|
@ -10,6 +8,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessagePacket
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessageSendSuccess
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessageType
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import java.security.SecureRandom
|
||||
import java.util.*
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ interface OmnipodDashPodStateManager {
|
|||
fun updateTimeZone()
|
||||
|
||||
fun createActiveCommand(
|
||||
historyId: String,
|
||||
historyId: Long,
|
||||
basalProgram: BasalProgram? = null,
|
||||
tempBasal: TempBasal? = null,
|
||||
requestedBolus: Double? = null
|
||||
|
@ -103,7 +103,7 @@ interface OmnipodDashPodStateManager {
|
|||
fun observeNoActiveCommand(): Completable
|
||||
fun getCommandConfirmationFromState(): CommandConfirmationFromState
|
||||
|
||||
fun createLastBolus(requestedUnits: Double, historyId: String, bolusType: DetailedBolusInfo.BolusType)
|
||||
fun createLastBolus(requestedUnits: Double, historyId: Long, bolusType: DetailedBolusInfo.BolusType)
|
||||
fun markLastBolusComplete(): LastBolus?
|
||||
fun onStart()
|
||||
/*
|
||||
|
@ -120,7 +120,7 @@ interface OmnipodDashPodStateManager {
|
|||
val sequence: Short,
|
||||
val createdRealtime: Long,
|
||||
var sentRealtime: Long = 0,
|
||||
val historyId: String,
|
||||
val historyId: Long,
|
||||
var sendError: Throwable?,
|
||||
var basalProgram: BasalProgram?,
|
||||
val tempBasal: TempBasal?,
|
||||
|
@ -135,7 +135,7 @@ interface OmnipodDashPodStateManager {
|
|||
val requestedUnits: Double,
|
||||
var bolusUnitsRemaining: Double,
|
||||
var deliveryComplete: Boolean,
|
||||
val historyId: String,
|
||||
val historyId: Long,
|
||||
val bolusType: DetailedBolusInfo.BolusType
|
||||
) {
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state
|
|||
import android.os.SystemClock
|
||||
import com.google.gson.Gson
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.EventOmnipodDashPumpValuesChanged
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
|
||||
|
@ -17,6 +15,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.SetUniqueIdResponse
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.VersionResponse
|
||||
import info.nightscout.androidaps.utils.Round
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import io.reactivex.rxjava3.core.Completable
|
||||
import io.reactivex.rxjava3.core.Maybe
|
||||
|
@ -323,7 +323,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
|||
get() = podState.activeCommand
|
||||
|
||||
@Synchronized
|
||||
override fun createLastBolus(requestedUnits: Double, historyId: String, bolusType: DetailedBolusInfo.BolusType) {
|
||||
override fun createLastBolus(requestedUnits: Double, historyId: Long, bolusType: DetailedBolusInfo.BolusType) {
|
||||
podState.lastBolus = OmnipodDashPodStateManager.LastBolus(
|
||||
startTime = System.currentTimeMillis(),
|
||||
requestedUnits = requestedUnits,
|
||||
|
@ -358,7 +358,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor(
|
|||
|
||||
@Synchronized
|
||||
override fun createActiveCommand(
|
||||
historyId: String,
|
||||
historyId: Long,
|
||||
basalProgram: BasalProgram?,
|
||||
tempBasal: OmnipodDashPodStateManager.TempBasal?,
|
||||
requestedBolus: Double?
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.history
|
||||
|
||||
import com.github.guepardoapps.kulid.ULID
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType.SET_BOLUS
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType.SET_TEMPORARY_BASAL
|
||||
|
@ -11,6 +8,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.*
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.HistoryRecordDao
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.HistoryRecordEntity
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.mapper.HistoryMapper
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import io.reactivex.rxjava3.core.Completable
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import java.lang.System.currentTimeMillis
|
||||
|
@ -22,19 +21,19 @@ class DashHistory @Inject constructor(
|
|||
private val logger: AAPSLogger
|
||||
) {
|
||||
|
||||
private fun markSuccess(id: String): Completable = dao.markResolved(
|
||||
private fun markSuccess(id: Long): Completable = dao.markResolved(
|
||||
id,
|
||||
ResolvedResult.SUCCESS,
|
||||
currentTimeMillis()
|
||||
)
|
||||
|
||||
private fun markFailure(id: String): Completable = dao.markResolved(
|
||||
private fun markFailure(id: Long): Completable = dao.markResolved(
|
||||
id,
|
||||
ResolvedResult.FAILURE,
|
||||
currentTimeMillis()
|
||||
)
|
||||
|
||||
fun getById(id: String): HistoryRecord {
|
||||
fun getById(id: Long): HistoryRecord {
|
||||
val entry = dao.byIdBlocking(id)
|
||||
?: throw java.lang.IllegalArgumentException("history entry [$id] not found")
|
||||
return historyMapper.entityToDomain(entry)
|
||||
|
@ -50,9 +49,11 @@ class DashHistory @Inject constructor(
|
|||
basalProfileRecord: BasalValuesRecord? = null,
|
||||
resolveResult: ResolvedResult? = null,
|
||||
resolvedAt: Long? = null
|
||||
): Single<String> = Single.defer {
|
||||
val id = ULID.random()
|
||||
|
||||
): Single<Long> = Single.defer {
|
||||
var id: Long = 0
|
||||
if (dao.first() != null) {
|
||||
id = currentTimeMillis()
|
||||
}
|
||||
when {
|
||||
commandType == SET_BOLUS && bolusRecord == null ->
|
||||
Single.error(IllegalArgumentException("bolusRecord missing on SET_BOLUS"))
|
||||
|
@ -72,7 +73,7 @@ class DashHistory @Inject constructor(
|
|||
resolvedResult = resolveResult,
|
||||
resolvedAt = resolvedAt
|
||||
)
|
||||
).toSingle { id }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +83,7 @@ class DashHistory @Inject constructor(
|
|||
fun getRecordsAfter(time: Long): Single<List<HistoryRecord>> =
|
||||
dao.allSince(time).map { list -> list.map(historyMapper::entityToDomain) }
|
||||
|
||||
fun updateFromState(podState: OmnipodDashPodStateManager) = Completable.defer {
|
||||
fun updateFromState(podState: OmnipodDashPodStateManager): Completable = Completable.defer {
|
||||
val historyId = podState.activeCommand?.historyId
|
||||
if (historyId == null) {
|
||||
logger.error(LTag.PUMP, "HistoryId not found to for updating from state")
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data
|
||||
|
||||
import com.github.guepardoapps.kulid.ULID
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType
|
||||
import java.nio.ByteBuffer
|
||||
|
||||
data class HistoryRecord(
|
||||
val id: String, // ULID
|
||||
val id: Long,
|
||||
val createdAt: Long, // creation date of the record
|
||||
val date: Long, // when event actually happened
|
||||
val commandType: OmnipodCommandType,
|
||||
|
@ -15,8 +13,7 @@ data class HistoryRecord(
|
|||
val resolvedAt: Long?
|
||||
) {
|
||||
fun pumpId(): Long {
|
||||
val entropy = ULID.getEntropy(id)
|
||||
return ByteBuffer.wrap(entropy).long
|
||||
return id
|
||||
}
|
||||
|
||||
fun displayTimestamp(): Long {
|
||||
|
|
|
@ -18,7 +18,7 @@ abstract class DashHistoryDatabase : RoomDatabase() {
|
|||
|
||||
companion object {
|
||||
|
||||
const val VERSION = 2
|
||||
const val VERSION = 3
|
||||
|
||||
fun build(context: Context) =
|
||||
Room.databaseBuilder(
|
||||
|
|
|
@ -15,28 +15,25 @@ abstract class HistoryRecordDao {
|
|||
|
||||
@Query("SELECT * from historyrecords")
|
||||
abstract fun all(): Single<List<HistoryRecordEntity>>
|
||||
|
||||
@Query("SELECT * from historyrecords")
|
||||
abstract fun allBlocking(): List<HistoryRecordEntity>
|
||||
|
||||
@Query("SELECT * from historyrecords ORDER BY id LIMIT 1")
|
||||
abstract fun first(): HistoryRecordEntity?
|
||||
|
||||
@Query("SELECT * from historyrecords WHERE createdAt >= :since ORDER BY createdAt DESC")
|
||||
abstract fun allSince(since: Long): Single<List<HistoryRecordEntity>>
|
||||
|
||||
@Query("SELECT * FROM historyrecords WHERE id = :id LIMIT 1")
|
||||
abstract fun byIdBlocking(id: String): HistoryRecordEntity?
|
||||
abstract fun byIdBlocking(id: Long): HistoryRecordEntity?
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
abstract fun saveBlocking(historyRecordEntity: HistoryRecordEntity)
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
abstract fun save(historyRecordEntity: HistoryRecordEntity): Completable
|
||||
abstract fun save(historyRecordEntity: HistoryRecordEntity): Single<Long>
|
||||
|
||||
@Delete
|
||||
abstract fun delete(historyRecordEntity: HistoryRecordEntity): Completable
|
||||
|
||||
@Query("UPDATE historyrecords SET resolvedResult = :resolvedResult, resolvedAt = :resolvedAt WHERE id = :id ")
|
||||
abstract fun markResolved(id: String, resolvedResult: ResolvedResult, resolvedAt: Long): Completable
|
||||
abstract fun markResolved(id: Long, resolvedResult: ResolvedResult, resolvedAt: Long): Completable
|
||||
|
||||
@Query("UPDATE historyrecords SET initialResult = :initialResult WHERE id = :id ")
|
||||
abstract fun setInitialResult(id: String, initialResult: InitialResult): Completable
|
||||
abstract fun setInitialResult(id: Long, initialResult: InitialResult): Completable
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database
|
|||
|
||||
import androidx.room.Embedded
|
||||
import androidx.room.Entity
|
||||
import androidx.room.Index
|
||||
import androidx.room.PrimaryKey
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.BasalValuesRecord
|
||||
|
@ -10,9 +11,15 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.Initial
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.ResolvedResult
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.TempBasalRecord
|
||||
|
||||
@Entity(tableName = "historyrecords")
|
||||
@Entity(
|
||||
tableName = "historyrecords",
|
||||
indices = [
|
||||
Index("createdAt"),
|
||||
]
|
||||
)
|
||||
data class HistoryRecordEntity(
|
||||
@PrimaryKey val id: String, // ULID
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
val id: Long = 0,
|
||||
val createdAt: Long, // creation date of the record
|
||||
val date: Long, // when event actually happened
|
||||
val commandType: OmnipodCommandType,
|
||||
|
|
|
@ -1,27 +1,10 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.history.mapper
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.BasalValuesRecord
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.BolusRecord
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.HistoryRecord
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.TempBasalRecord
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.database.HistoryRecordEntity
|
||||
|
||||
class HistoryMapper {
|
||||
|
||||
fun domainToEntity(historyRecord: HistoryRecord): HistoryRecordEntity =
|
||||
HistoryRecordEntity(
|
||||
id = historyRecord.id,
|
||||
createdAt = historyRecord.createdAt,
|
||||
date = historyRecord.date,
|
||||
commandType = historyRecord.commandType,
|
||||
initialResult = historyRecord.initialResult,
|
||||
tempBasalRecord = historyRecord.record as? TempBasalRecord,
|
||||
bolusRecord = historyRecord.record as? BolusRecord,
|
||||
resolvedResult = historyRecord.resolvedResult,
|
||||
resolvedAt = historyRecord.resolvedAt,
|
||||
basalProfileRecord = historyRecord.record as? BasalValuesRecord
|
||||
)
|
||||
|
||||
fun entityToDomain(entity: HistoryRecordEntity): HistoryRecord =
|
||||
HistoryRecord(
|
||||
id = entity.id,
|
||||
|
|
|
@ -53,44 +53,44 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
private fun groupForCommandType(type: OmnipodCommandType): PumpHistoryEntryGroup {
|
||||
return when (type) {
|
||||
OmnipodCommandType.INITIALIZE_POD ->
|
||||
OmnipodCommandType.INITIALIZE_POD ->
|
||||
PumpHistoryEntryGroup.Prime
|
||||
OmnipodCommandType.INSERT_CANNULA ->
|
||||
OmnipodCommandType.INSERT_CANNULA ->
|
||||
PumpHistoryEntryGroup.Prime
|
||||
OmnipodCommandType.DEACTIVATE_POD ->
|
||||
OmnipodCommandType.DEACTIVATE_POD ->
|
||||
PumpHistoryEntryGroup.Prime
|
||||
OmnipodCommandType.DISCARD_POD ->
|
||||
OmnipodCommandType.DISCARD_POD ->
|
||||
PumpHistoryEntryGroup.Prime
|
||||
|
||||
OmnipodCommandType.CANCEL_TEMPORARY_BASAL ->
|
||||
PumpHistoryEntryGroup.Basal
|
||||
OmnipodCommandType.SET_BASAL_PROFILE ->
|
||||
OmnipodCommandType.SET_BASAL_PROFILE ->
|
||||
PumpHistoryEntryGroup.Basal
|
||||
OmnipodCommandType.SET_TEMPORARY_BASAL ->
|
||||
OmnipodCommandType.SET_TEMPORARY_BASAL ->
|
||||
PumpHistoryEntryGroup.Basal
|
||||
OmnipodCommandType.RESUME_DELIVERY ->
|
||||
OmnipodCommandType.RESUME_DELIVERY ->
|
||||
PumpHistoryEntryGroup.Basal
|
||||
OmnipodCommandType.SUSPEND_DELIVERY ->
|
||||
OmnipodCommandType.SUSPEND_DELIVERY ->
|
||||
PumpHistoryEntryGroup.Basal
|
||||
|
||||
OmnipodCommandType.SET_BOLUS ->
|
||||
OmnipodCommandType.SET_BOLUS ->
|
||||
PumpHistoryEntryGroup.Bolus
|
||||
OmnipodCommandType.CANCEL_BOLUS ->
|
||||
OmnipodCommandType.CANCEL_BOLUS ->
|
||||
PumpHistoryEntryGroup.Bolus
|
||||
|
||||
OmnipodCommandType.ACKNOWLEDGE_ALERTS ->
|
||||
OmnipodCommandType.ACKNOWLEDGE_ALERTS ->
|
||||
PumpHistoryEntryGroup.Alarm
|
||||
OmnipodCommandType.CONFIGURE_ALERTS ->
|
||||
OmnipodCommandType.CONFIGURE_ALERTS ->
|
||||
PumpHistoryEntryGroup.Alarm
|
||||
OmnipodCommandType.PLAY_TEST_BEEP ->
|
||||
OmnipodCommandType.PLAY_TEST_BEEP ->
|
||||
PumpHistoryEntryGroup.Alarm
|
||||
|
||||
OmnipodCommandType.GET_POD_STATUS ->
|
||||
OmnipodCommandType.GET_POD_STATUS ->
|
||||
PumpHistoryEntryGroup.Configuration
|
||||
OmnipodCommandType.SET_TIME ->
|
||||
OmnipodCommandType.SET_TIME ->
|
||||
PumpHistoryEntryGroup.Configuration
|
||||
|
||||
OmnipodCommandType.READ_POD_PULSE_LOG ->
|
||||
OmnipodCommandType.READ_POD_PULSE_LOG ->
|
||||
PumpHistoryEntryGroup.Unknown
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
|||
private fun setTextViewColor(check_result: Boolean, textview: TextView, record: HistoryRecord) {
|
||||
if (check_result && !record.isSuccess()) {
|
||||
// Record says not success
|
||||
textview.setTextColor(rh.gac( textview.context, R.attr.omniYellowColor))
|
||||
textview.setTextColor(rh.gac(textview.context, R.attr.omniYellowColor))
|
||||
return
|
||||
}
|
||||
// On success set color
|
||||
|
@ -222,13 +222,13 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
|||
OmnipodCommandType.DISCARD_POD,
|
||||
OmnipodCommandType.SUSPEND_DELIVERY,
|
||||
OmnipodCommandType.RESUME_DELIVERY,
|
||||
OmnipodCommandType.SET_BASAL_PROFILE -> {
|
||||
OmnipodCommandType.SET_BASAL_PROFILE -> {
|
||||
R.attr.omniCyanColor
|
||||
}
|
||||
// User action
|
||||
OmnipodCommandType.PLAY_TEST_BEEP,
|
||||
OmnipodCommandType.ACKNOWLEDGE_ALERTS,
|
||||
OmnipodCommandType.CANCEL_BOLUS -> {
|
||||
OmnipodCommandType.CANCEL_BOLUS -> {
|
||||
R.attr.omniCyanColor
|
||||
}
|
||||
// Insulin treatment
|
||||
|
@ -237,11 +237,11 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
|||
R.attr.defaultTextColor
|
||||
}
|
||||
|
||||
else ->
|
||||
else ->
|
||||
// Other
|
||||
R.attr.omniGrayColor
|
||||
R.attr.omniGrayColor
|
||||
}
|
||||
textview.setTextColor(rh.gac( textview.context, textColorAttr))
|
||||
textview.setTextColor(rh.gac(textview.context, textColorAttr))
|
||||
}
|
||||
|
||||
private fun setType(record: HistoryRecord, typeView: TextView) {
|
||||
|
@ -265,7 +265,7 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
OmnipodCommandType.SET_BOLUS -> {
|
||||
OmnipodCommandType.SET_BOLUS -> {
|
||||
val bolus = historyEntry.record as BolusRecord
|
||||
bolus.let {
|
||||
rh.gs(R.string.omnipod_common_history_bolus_value, it.amout)
|
||||
|
@ -275,12 +275,12 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
|||
OmnipodCommandType.SET_BASAL_PROFILE,
|
||||
OmnipodCommandType.SET_TIME,
|
||||
OmnipodCommandType.INSERT_CANNULA,
|
||||
OmnipodCommandType.RESUME_DELIVERY -> {
|
||||
OmnipodCommandType.RESUME_DELIVERY -> {
|
||||
val basal = historyEntry.record as BasalValuesRecord
|
||||
ProfileUtil.getBasalProfilesDisplayable(basal.segments.toTypedArray(), PumpType.OMNIPOD_DASH)
|
||||
}
|
||||
|
||||
else ->
|
||||
else ->
|
||||
""
|
||||
}
|
||||
// Set some color
|
||||
|
@ -303,12 +303,12 @@ class DashPodHistoryActivity : NoSplashAppCompatActivity() {
|
|||
return when {
|
||||
historyEntry.initialResult == InitialResult.FAILURE_SENDING ->
|
||||
R.string.omnipod_dash_failed_to_send
|
||||
historyEntry.initialResult == InitialResult.NOT_SENT ->
|
||||
historyEntry.initialResult == InitialResult.NOT_SENT ->
|
||||
R.string.omnipod_dash_command_not_sent
|
||||
historyEntry.initialResult == InitialResult.SENT &&
|
||||
historyEntry.resolvedResult == ResolvedResult.FAILURE ->
|
||||
historyEntry.resolvedResult == ResolvedResult.FAILURE ->
|
||||
R.string.omnipod_dash_command_not_received_by_the_pod
|
||||
else ->
|
||||
else ->
|
||||
R.string.omnipod_dash_unknown
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import info.nightscout.androidaps.activities.ErrorHelperActivity
|
|||
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||
import info.nightscout.androidaps.extensions.toVisibility
|
||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandPlayTestBeep
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.PodActivationWizardActivity
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.ui
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.HandlerThread
|
||||
|
@ -16,6 +15,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange
|
|||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||
import info.nightscout.androidaps.interfaces.PumpSync
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||
|
@ -41,10 +41,9 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
|||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.androidaps.utils.ui.UIRunnable
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
|
@ -117,7 +116,8 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
protectionCheck.queryProtection(
|
||||
activity,
|
||||
ProtectionCheck.Protection.PREFERENCES,
|
||||
UIRunnable { startActivity(Intent(context, DashPodManagementActivity::class.java)) })
|
||||
UIRunnable { startActivity(Intent(context, DashPodManagementActivity::class.java)) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,14 +267,17 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
val quality =
|
||||
"${podStateManager.successfulConnectionAttemptsAfterRetries}/$connectionAttempts :: $successPercentageString"
|
||||
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality
|
||||
val connectionStatsColor = rh.gac( context, when {
|
||||
connectionSuccessPercentage < 70 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
|
||||
R.attr.warningColor
|
||||
connectionSuccessPercentage < 90 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
|
||||
R.attr.omniYellowColor
|
||||
else ->
|
||||
R.attr.defaultTextColor
|
||||
})
|
||||
val connectionStatsColor = rh.gac(
|
||||
context,
|
||||
when {
|
||||
connectionSuccessPercentage < 70 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
|
||||
R.attr.warningColor
|
||||
connectionSuccessPercentage < 90 && podStateManager.successfulConnectionAttemptsAfterRetries > 50 ->
|
||||
R.attr.omniYellowColor
|
||||
else ->
|
||||
R.attr.defaultTextColor
|
||||
}
|
||||
)
|
||||
bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.setTextColor(connectionStatsColor)
|
||||
bluetoothStatusBinding.omnipodDashDeliveryStatus.text = podStateManager.deliveryStatus?.let {
|
||||
podStateManager.deliveryStatus.toString()
|
||||
|
@ -296,11 +299,11 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
podInfoBinding.firmwareVersion.text = PLACEHOLDER
|
||||
podInfoBinding.timeOnPod.text = PLACEHOLDER
|
||||
podInfoBinding.podExpiryDate.text = PLACEHOLDER
|
||||
podInfoBinding.podExpiryDate.setTextColor(rh.gac(context,R.attr.defaultTextColor))
|
||||
podInfoBinding.podExpiryDate.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||
podInfoBinding.baseBasalRate.text = PLACEHOLDER
|
||||
podInfoBinding.totalDelivered.text = PLACEHOLDER
|
||||
podInfoBinding.reservoir.text = PLACEHOLDER
|
||||
podInfoBinding.reservoir.setTextColor(rh.gac(context,R.attr.defaultTextColor))
|
||||
podInfoBinding.reservoir.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||
podInfoBinding.podActiveAlerts.text = PLACEHOLDER
|
||||
} else {
|
||||
podInfoBinding.uniqueId.text = podStateManager.uniqueId.toString()
|
||||
|
@ -335,15 +338,17 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
).isNegative
|
||||
} ?: false
|
||||
podInfoBinding.timeOnPod.setTextColor(
|
||||
rh.gac( context,
|
||||
when {
|
||||
!podStateManager.sameTimeZone ->
|
||||
R.attr.omniMagentaColor
|
||||
timeDeviationTooBig ->
|
||||
R.attr.omniYellowColor
|
||||
else ->
|
||||
R.attr.defaultTextColor
|
||||
})
|
||||
rh.gac(
|
||||
context,
|
||||
when {
|
||||
!podStateManager.sameTimeZone ->
|
||||
R.attr.omniMagentaColor
|
||||
timeDeviationTooBig ->
|
||||
R.attr.omniYellowColor
|
||||
else ->
|
||||
R.attr.defaultTextColor
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
// Update Pod expiry time
|
||||
|
@ -353,15 +358,17 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
}
|
||||
?: PLACEHOLDER
|
||||
podInfoBinding.podExpiryDate.setTextColor(
|
||||
rh.gac( context,
|
||||
when {
|
||||
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt) ->
|
||||
R.attr.warningColor
|
||||
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt.minusHours(4)) ->
|
||||
R.attr.omniYellowColor
|
||||
else ->
|
||||
R.attr.defaultTextColor
|
||||
})
|
||||
rh.gac(
|
||||
context,
|
||||
when {
|
||||
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt) ->
|
||||
R.attr.warningColor
|
||||
expiresAt != null && ZonedDateTime.now().isAfter(expiresAt.minusHours(4)) ->
|
||||
R.attr.omniYellowColor
|
||||
else ->
|
||||
R.attr.defaultTextColor
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
podStateManager.alarmType?.let {
|
||||
|
@ -401,7 +408,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
if (podStateManager.pulsesRemaining == null) {
|
||||
podInfoBinding.reservoir.text =
|
||||
rh.gs(R.string.omnipod_common_overview_reservoir_value_over50)
|
||||
podInfoBinding.reservoir.setTextColor(rh.gac(context,R.attr.defaultTextColor))
|
||||
podInfoBinding.reservoir.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||
} else {
|
||||
// TODO
|
||||
// val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
|
||||
|
@ -413,12 +420,14 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
(podStateManager.pulsesRemaining!! * PodConstants.POD_PULSE_BOLUS_UNITS)
|
||||
)
|
||||
podInfoBinding.reservoir.setTextColor(
|
||||
rh.gac(context,
|
||||
if (podStateManager.pulsesRemaining!! < lowReservoirThreshold) {
|
||||
R.attr.warningColor
|
||||
} else {
|
||||
R.attr.defaultTextColor
|
||||
})
|
||||
rh.gac(
|
||||
context,
|
||||
if (podStateManager.pulsesRemaining!! < lowReservoirThreshold) {
|
||||
R.attr.warningColor
|
||||
} else {
|
||||
R.attr.defaultTextColor
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -429,10 +438,10 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
|
||||
if (errors.size == 0) {
|
||||
podInfoBinding.errors.text = PLACEHOLDER
|
||||
podInfoBinding.errors.setTextColor(rh.gac(context,R.attr.defaultTextColor))
|
||||
podInfoBinding.errors.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||
} else {
|
||||
podInfoBinding.errors.text = StringUtils.join(errors, System.lineSeparator())
|
||||
podInfoBinding.errors.setTextColor(rh.gac(context,R.attr.warningColor))
|
||||
podInfoBinding.errors.setTextColor(rh.gac(context, R.attr.warningColor))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -468,15 +477,17 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
)
|
||||
)
|
||||
val lastConnectionColor =
|
||||
rh.gac(context,
|
||||
if (omnipodDashPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().toMillis())) {
|
||||
R.attr.warningColor
|
||||
} else {
|
||||
R.attr.defaultTextColor
|
||||
})
|
||||
rh.gac(
|
||||
context,
|
||||
if (omnipodDashPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().toMillis())) {
|
||||
R.attr.warningColor
|
||||
} else {
|
||||
R.attr.defaultTextColor
|
||||
}
|
||||
)
|
||||
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
|
||||
} else {
|
||||
podInfoBinding.lastConnection.setTextColor(rh.gac(context,R.attr.defaultTextColor ))
|
||||
podInfoBinding.lastConnection.setTextColor(rh.gac(context, R.attr.defaultTextColor))
|
||||
podInfoBinding.lastConnection.text = PLACEHOLDER
|
||||
}
|
||||
}
|
||||
|
@ -512,14 +523,17 @@ class OmnipodDashOverviewFragment : DaggerFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
val podStatusColor = rh.gac( context, when {
|
||||
!podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended ->
|
||||
R.attr.warningColor
|
||||
podStateManager.activeCommand != null ->
|
||||
R.attr.omniYellowColor
|
||||
else ->
|
||||
R.attr.defaultTextColor
|
||||
})
|
||||
val podStatusColor = rh.gac(
|
||||
context,
|
||||
when {
|
||||
!podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended ->
|
||||
R.attr.warningColor
|
||||
podStateManager.activeCommand != null ->
|
||||
R.attr.omniYellowColor
|
||||
else ->
|
||||
R.attr.defaultTextColor
|
||||
}
|
||||
)
|
||||
podInfoBinding.podStatus.setTextColor(podStatusColor)
|
||||
}
|
||||
|
||||
|
|
|
@ -13,5 +13,5 @@ class DashPodActivationWizardActivity : PodActivationWizardActivity() {
|
|||
super.onCreate(savedInstanceState)
|
||||
|
||||
blePreCheck.prerequisitesCheck(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.ui.wizard.activatio
|
|||
import androidx.annotation.StringRes
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.definition.OmnipodCommandType
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
|
||||
|
@ -15,8 +14,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.DashHistory
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.InitialResult
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.history.data.ResolvedResult
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.I8n
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
|
|
|
@ -6,8 +6,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo
|
|||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||
import info.nightscout.androidaps.interfaces.PumpSync
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||
|
@ -25,8 +24,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.Constants
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.I8n
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.util.mapProfileToBasalProgram
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.shared.logging.LTag
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import io.reactivex.rxjava3.kotlin.plusAssign
|
||||
|
|
|
@ -4,7 +4,6 @@ import androidx.annotation.StringRes
|
|||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.androidaps.data.PumpEnactResult
|
||||
import info.nightscout.androidaps.interfaces.CommandQueue
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
|
||||
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification
|
||||
|
@ -14,6 +13,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactiva
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import info.nightscout.shared.logging.AAPSLogger
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.util
|
||||
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.R
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.FailedToConnectException
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.NotConnectedException
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.ScanException
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.exceptions.ScanFailFoundTooManyException
|
||||
import info.nightscout.androidaps.interfaces.ResourceHelper
|
||||
|
||||
class I8n {
|
||||
companion object {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.endecrypt
|
||||
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLoggerTest
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message.MessagePacket
|
||||
import info.nightscout.shared.logging.AAPSLoggerTest
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
import org.spongycastle.util.encoders.Hex
|
||||
|
|
|
@ -2,8 +2,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.message
|
|||
|
||||
import com.google.crypto.tink.subtle.Hex
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLoggerTest
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.Id
|
||||
import info.nightscout.shared.logging.AAPSLoggerTest
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.comm.pair
|
||||
|
||||
import info.nightscout.androidaps.extensions.toHex
|
||||
import info.nightscout.shared.logging.AAPSLoggerTest
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util.RandomByteGenerator
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.util.X25519KeyGenerator
|
||||
import info.nightscout.shared.logging.AAPSLoggerTest
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import org.mockito.ArgumentMatchers.anyInt
|
||||
|
|
Loading…
Reference in a new issue