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