Merge pull request #3177 from jbr7rr/medtrum-fixes
Medtrum improvements
This commit is contained in:
commit
927676d5ee
|
@ -53,6 +53,7 @@ import app.aaps.core.ui.toast.ToastUtils
|
||||||
import app.aaps.core.validators.ValidatingEditTextPreference
|
import app.aaps.core.validators.ValidatingEditTextPreference
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState
|
import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState
|
||||||
|
import info.nightscout.pump.medtrum.comm.enums.ModelType
|
||||||
import info.nightscout.pump.medtrum.services.MedtrumService
|
import info.nightscout.pump.medtrum.services.MedtrumService
|
||||||
import info.nightscout.pump.medtrum.ui.MedtrumOverviewFragment
|
import info.nightscout.pump.medtrum.ui.MedtrumOverviewFragment
|
||||||
import info.nightscout.pump.medtrum.util.MedtrumSnUtil
|
import info.nightscout.pump.medtrum.util.MedtrumSnUtil
|
||||||
|
@ -153,7 +154,7 @@ import kotlin.math.abs
|
||||||
override fun afterTextChanged(newValue: Editable?) {
|
override fun afterTextChanged(newValue: Editable?) {
|
||||||
val newSN = newValue?.toString()?.toLongOrNull(radix = 16) ?: 0
|
val newSN = newValue?.toString()?.toLongOrNull(radix = 16) ?: 0
|
||||||
val newDeviceType = MedtrumSnUtil().getDeviceTypeFromSerial(newSN)
|
val newDeviceType = MedtrumSnUtil().getDeviceTypeFromSerial(newSN)
|
||||||
editText.error = if (newDeviceType == MedtrumSnUtil.INVALID) {
|
editText.error = if (newDeviceType == ModelType.INVALID) {
|
||||||
rh.gs(R.string.sn_input_invalid)
|
rh.gs(R.string.sn_input_invalid)
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
@ -174,7 +175,7 @@ import kotlin.math.abs
|
||||||
val newDeviceType = MedtrumSnUtil().getDeviceTypeFromSerial(newSN)
|
val newDeviceType = MedtrumSnUtil().getDeviceTypeFromSerial(newSN)
|
||||||
|
|
||||||
when {
|
when {
|
||||||
newDeviceType == MedtrumSnUtil.INVALID -> {
|
newDeviceType == ModelType.INVALID -> {
|
||||||
preferenceFragment.activity?.let { activity ->
|
preferenceFragment.activity?.let { activity ->
|
||||||
OKDialog.show(activity, rh.gs(R.string.sn_input_title), rh.gs(R.string.sn_input_invalid))
|
OKDialog.show(activity, rh.gs(R.string.sn_input_title), rh.gs(R.string.sn_input_invalid))
|
||||||
}
|
}
|
||||||
|
@ -183,7 +184,7 @@ import kotlin.math.abs
|
||||||
|
|
||||||
medtrumPump.pumpType(newDeviceType) == PumpType.MEDTRUM_UNTESTED -> {
|
medtrumPump.pumpType(newDeviceType) == PumpType.MEDTRUM_UNTESTED -> {
|
||||||
preferenceFragment.activity?.let { activity ->
|
preferenceFragment.activity?.let { activity ->
|
||||||
OKDialog.show(activity, rh.gs(R.string.sn_input_title), rh.gs(R.string.pump_unsupported, newDeviceType))
|
OKDialog.show(activity, rh.gs(R.string.sn_input_title), rh.gs(R.string.pump_unsupported, newDeviceType.toString()))
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import info.nightscout.pump.medtrum.comm.enums.AlarmSetting
|
||||||
import info.nightscout.pump.medtrum.comm.enums.AlarmState
|
import info.nightscout.pump.medtrum.comm.enums.AlarmState
|
||||||
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
||||||
import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState
|
import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState
|
||||||
|
import info.nightscout.pump.medtrum.comm.enums.ModelType
|
||||||
import info.nightscout.pump.medtrum.extension.toByteArray
|
import info.nightscout.pump.medtrum.extension.toByteArray
|
||||||
import info.nightscout.pump.medtrum.extension.toInt
|
import info.nightscout.pump.medtrum.extension.toInt
|
||||||
import info.nightscout.pump.medtrum.util.MedtrumSnUtil
|
import info.nightscout.pump.medtrum.util.MedtrumSnUtil
|
||||||
|
@ -291,12 +292,12 @@ class MedtrumPump @Inject constructor(
|
||||||
var desiredPumpWarning = true
|
var desiredPumpWarning = true
|
||||||
var desiredPumpWarningExpiryThresholdHours = 72L
|
var desiredPumpWarningExpiryThresholdHours = 72L
|
||||||
|
|
||||||
fun pumpType(): PumpType = pumpType(deviceType)
|
fun pumpType(): PumpType = pumpType(ModelType.fromValue(deviceType))
|
||||||
|
|
||||||
fun pumpType(type: Int): PumpType =
|
fun pumpType(type: ModelType): PumpType =
|
||||||
when (type) {
|
when (type) {
|
||||||
MedtrumSnUtil.MD_0201, MedtrumSnUtil.MD_8201 -> PumpType.MEDTRUM_NANO
|
ModelType.MD0201, ModelType.MD8201 -> PumpType.MEDTRUM_NANO
|
||||||
MedtrumSnUtil.MD_8301 -> PumpType.MEDTRUM_300U
|
ModelType.MD8301 -> PumpType.MEDTRUM_300U
|
||||||
else -> PumpType.MEDTRUM_UNTESTED
|
else -> PumpType.MEDTRUM_UNTESTED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +570,7 @@ class MedtrumPump @Inject constructor(
|
||||||
AlarmState.EXPIRED -> R.string.alarm_expired
|
AlarmState.EXPIRED -> R.string.alarm_expired
|
||||||
AlarmState.RESERVOIR_EMPTY -> R.string.alarm_reservoir_empty
|
AlarmState.RESERVOIR_EMPTY -> R.string.alarm_reservoir_empty
|
||||||
AlarmState.PATCH_FAULT -> R.string.alarm_patch_fault
|
AlarmState.PATCH_FAULT -> R.string.alarm_patch_fault
|
||||||
AlarmState.PATCH_FAULT2 -> R.string.alarm_patch_fault2
|
AlarmState.PATCH_FAULT2 -> R.string.alarm_patch_fault // To avoid confusion, medtrum app also doesn't show patch fault 2
|
||||||
AlarmState.BASE_FAULT -> R.string.alarm_base_fault
|
AlarmState.BASE_FAULT -> R.string.alarm_base_fault
|
||||||
AlarmState.BATTERY_OUT -> R.string.alarm_battery_out
|
AlarmState.BATTERY_OUT -> R.string.alarm_battery_out
|
||||||
AlarmState.NO_CALIBRATION -> R.string.alarm_no_calibration
|
AlarmState.NO_CALIBRATION -> R.string.alarm_no_calibration
|
||||||
|
|
|
@ -15,7 +15,6 @@ enum class PatchStep {
|
||||||
ACTIVATE_COMPLETE,
|
ACTIVATE_COMPLETE,
|
||||||
RETRY_ACTIVATION,
|
RETRY_ACTIVATION,
|
||||||
RETRY_ACTIVATION_CONNECT,
|
RETRY_ACTIVATION_CONNECT,
|
||||||
ERROR,
|
|
||||||
CANCEL,
|
CANCEL,
|
||||||
COMPLETE;
|
COMPLETE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package info.nightscout.pump.medtrum.comm.enums
|
||||||
|
|
||||||
|
enum class ModelType(val value: Int) {
|
||||||
|
INVALID(-1),
|
||||||
|
MD0201(80),
|
||||||
|
MD5201(81),
|
||||||
|
MD0202(82),
|
||||||
|
MD5202(83),
|
||||||
|
MD8201(88),
|
||||||
|
MD8301(98);
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun fromValue(value: Int): ModelType {
|
||||||
|
return values().find { it.value == value } ?: INVALID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -132,7 +132,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
||||||
if (event.isChanged(rh.gs(R.string.key_sn_input))) {
|
if (event.isChanged(rh.gs(R.string.key_sn_input))) {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "Serial number changed, reporting new pump!")
|
aapsLogger.debug(LTag.PUMPCOMM, "Serial number changed, reporting new pump!")
|
||||||
medtrumPump.loadUserSettingsFromSP()
|
medtrumPump.loadUserSettingsFromSP()
|
||||||
medtrumPump.deviceType = MedtrumSnUtil().getDeviceTypeFromSerial(medtrumPump.pumpSN)
|
medtrumPump.deviceType = MedtrumSnUtil().getDeviceTypeFromSerial(medtrumPump.pumpSN).value
|
||||||
medtrumPump.resetPatchParameters()
|
medtrumPump.resetPatchParameters()
|
||||||
pumpSync.connectNewPump()
|
pumpSync.connectNewPump()
|
||||||
medtrumPump.setFakeTBRIfNotSet()
|
medtrumPump.setFakeTBRIfNotSet()
|
||||||
|
|
|
@ -38,7 +38,6 @@ class MedtrumActivateFragment : MedtrumBaseFragment<FragmentMedtrumActivateBindi
|
||||||
MedtrumViewModel.SetupStep.ACTIVATED -> moveStep(PatchStep.ACTIVATE_COMPLETE)
|
MedtrumViewModel.SetupStep.ACTIVATED -> moveStep(PatchStep.ACTIVATE_COMPLETE)
|
||||||
|
|
||||||
MedtrumViewModel.SetupStep.ERROR -> {
|
MedtrumViewModel.SetupStep.ERROR -> {
|
||||||
moveStep(PatchStep.ERROR)
|
|
||||||
updateSetupStep(MedtrumViewModel.SetupStep.PRIMED) // Reset setup step
|
updateSetupStep(MedtrumViewModel.SetupStep.PRIMED) // Reset setup step
|
||||||
binding.textActivatingPump.text = rh.gs(R.string.activating_error)
|
binding.textActivatingPump.text = rh.gs(R.string.activating_error)
|
||||||
binding.btnPositive.visibility = View.VISIBLE
|
binding.btnPositive.visibility = View.VISIBLE
|
||||||
|
|
|
@ -43,7 +43,6 @@ class MedtrumActivity : MedtrumBaseActivity<ActivityMedtrumBinding>() {
|
||||||
PatchStep.ATTACH_PATCH -> setupViewFragment(MedtrumAttachPatchFragment.newInstance())
|
PatchStep.ATTACH_PATCH -> setupViewFragment(MedtrumAttachPatchFragment.newInstance())
|
||||||
PatchStep.ACTIVATE -> setupViewFragment(MedtrumActivateFragment.newInstance())
|
PatchStep.ACTIVATE -> setupViewFragment(MedtrumActivateFragment.newInstance())
|
||||||
PatchStep.ACTIVATE_COMPLETE -> setupViewFragment(MedtrumActivateCompleteFragment.newInstance())
|
PatchStep.ACTIVATE_COMPLETE -> setupViewFragment(MedtrumActivateCompleteFragment.newInstance())
|
||||||
PatchStep.ERROR -> Unit // Do nothing, let activity handle this
|
|
||||||
PatchStep.RETRY_ACTIVATION -> setupViewFragment(MedtrumRetryActivationFragment.newInstance())
|
PatchStep.RETRY_ACTIVATION -> setupViewFragment(MedtrumRetryActivationFragment.newInstance())
|
||||||
PatchStep.RETRY_ACTIVATION_CONNECT -> setupViewFragment(MedtrumRetryActivationConnectFragment.newInstance())
|
PatchStep.RETRY_ACTIVATION_CONNECT -> setupViewFragment(MedtrumRetryActivationConnectFragment.newInstance())
|
||||||
PatchStep.START_DEACTIVATION -> setupViewFragment(MedtrumStartDeactivationFragment.newInstance())
|
PatchStep.START_DEACTIVATION -> setupViewFragment(MedtrumStartDeactivationFragment.newInstance())
|
||||||
|
|
|
@ -38,7 +38,6 @@ class MedtrumDeactivatePatchFragment : MedtrumBaseFragment<FragmentMedtrumDeacti
|
||||||
}
|
}
|
||||||
|
|
||||||
MedtrumViewModel.SetupStep.ERROR -> {
|
MedtrumViewModel.SetupStep.ERROR -> {
|
||||||
moveStep(PatchStep.ERROR)
|
|
||||||
updateSetupStep(MedtrumViewModel.SetupStep.START_DEACTIVATION) // Reset setup step
|
updateSetupStep(MedtrumViewModel.SetupStep.START_DEACTIVATION) // Reset setup step
|
||||||
binding.textDeactivatingPump.text = rh.gs(R.string.deactivating_error)
|
binding.textDeactivatingPump.text = rh.gs(R.string.deactivating_error)
|
||||||
binding.btnNegative.visibility = View.VISIBLE
|
binding.btnNegative.visibility = View.VISIBLE
|
||||||
|
|
|
@ -39,7 +39,6 @@ class MedtrumPrimingFragment : MedtrumBaseFragment<FragmentMedtrumPrimingBinding
|
||||||
MedtrumViewModel.SetupStep.PRIMED -> moveStep(PatchStep.PRIME_COMPLETE)
|
MedtrumViewModel.SetupStep.PRIMED -> moveStep(PatchStep.PRIME_COMPLETE)
|
||||||
|
|
||||||
MedtrumViewModel.SetupStep.ERROR -> {
|
MedtrumViewModel.SetupStep.ERROR -> {
|
||||||
moveStep(PatchStep.ERROR)
|
|
||||||
updateSetupStep(MedtrumViewModel.SetupStep.FILLED) // Reset setup step
|
updateSetupStep(MedtrumViewModel.SetupStep.FILLED) // Reset setup step
|
||||||
binding.textWaitForPriming.text = rh.gs(R.string.priming_error)
|
binding.textWaitForPriming.text = rh.gs(R.string.priming_error)
|
||||||
binding.btnNegative.visibility = View.VISIBLE
|
binding.btnNegative.visibility = View.VISIBLE
|
||||||
|
|
|
@ -14,6 +14,7 @@ import info.nightscout.pump.medtrum.R
|
||||||
import info.nightscout.pump.medtrum.code.ConnectionState
|
import info.nightscout.pump.medtrum.code.ConnectionState
|
||||||
import info.nightscout.pump.medtrum.code.EventType
|
import info.nightscout.pump.medtrum.code.EventType
|
||||||
import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState
|
import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState
|
||||||
|
import info.nightscout.pump.medtrum.comm.enums.ModelType
|
||||||
import info.nightscout.pump.medtrum.ui.MedtrumBaseNavigator
|
import info.nightscout.pump.medtrum.ui.MedtrumBaseNavigator
|
||||||
import info.nightscout.pump.medtrum.ui.event.SingleLiveEvent
|
import info.nightscout.pump.medtrum.ui.event.SingleLiveEvent
|
||||||
import info.nightscout.pump.medtrum.ui.event.UIEvent
|
import info.nightscout.pump.medtrum.ui.event.UIEvent
|
||||||
|
@ -199,7 +200,7 @@ class MedtrumOverviewViewModel @Inject constructor(
|
||||||
|
|
||||||
val activeAlarmStrings = medtrumPump.activeAlarms.map { medtrumPump.alarmStateToString(it) }
|
val activeAlarmStrings = medtrumPump.activeAlarms.map { medtrumPump.alarmStateToString(it) }
|
||||||
_activeAlarms.postValue(activeAlarmStrings.joinToString("\n"))
|
_activeAlarms.postValue(activeAlarmStrings.joinToString("\n"))
|
||||||
_pumpType.postValue(medtrumPump.deviceType.toString())
|
_pumpType.postValue(ModelType.fromValue(medtrumPump.deviceType).toString())
|
||||||
_fwVersion.postValue(medtrumPump.swVersion)
|
_fwVersion.postValue(medtrumPump.swVersion)
|
||||||
_patchNo.postValue(medtrumPump.patchId.toString())
|
_patchNo.postValue(medtrumPump.patchId.toString())
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,6 @@ class MedtrumViewModel @Inject constructor(
|
||||||
PatchStep.CANCEL,
|
PatchStep.CANCEL,
|
||||||
PatchStep.COMPLETE,
|
PatchStep.COMPLETE,
|
||||||
PatchStep.ACTIVATE_COMPLETE,
|
PatchStep.ACTIVATE_COMPLETE,
|
||||||
PatchStep.ERROR,
|
|
||||||
PatchStep.START_DEACTIVATION,
|
PatchStep.START_DEACTIVATION,
|
||||||
PatchStep.DEACTIVATE,
|
PatchStep.DEACTIVATE,
|
||||||
PatchStep.FORCE_DEACTIVATION,
|
PatchStep.FORCE_DEACTIVATION,
|
||||||
|
@ -307,7 +306,6 @@ class MedtrumViewModel @Inject constructor(
|
||||||
|
|
||||||
PatchStep.COMPLETE,
|
PatchStep.COMPLETE,
|
||||||
PatchStep.FORCE_DEACTIVATION,
|
PatchStep.FORCE_DEACTIVATION,
|
||||||
PatchStep.ERROR,
|
|
||||||
PatchStep.CANCEL -> _title.value
|
PatchStep.CANCEL -> _title.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,23 @@
|
||||||
package info.nightscout.pump.medtrum.util
|
package info.nightscout.pump.medtrum.util
|
||||||
|
|
||||||
|
import info.nightscout.pump.medtrum.comm.enums.ModelType
|
||||||
import info.nightscout.pump.medtrum.encryption.Crypt
|
import info.nightscout.pump.medtrum.encryption.Crypt
|
||||||
|
|
||||||
class MedtrumSnUtil {
|
class MedtrumSnUtil {
|
||||||
|
|
||||||
companion object {
|
fun getDeviceTypeFromSerial(serial: Long): ModelType {
|
||||||
|
|
||||||
const val INVALID = -1
|
|
||||||
const val MD_0201 = 80
|
|
||||||
const val MD_5201 = 81
|
|
||||||
const val MD_0202 = 82
|
|
||||||
const val MD_5202 = 83
|
|
||||||
const val MD_8201 = 88
|
|
||||||
const val MD_8301 = 98
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getDeviceTypeFromSerial(serial: Long): Int {
|
|
||||||
if (serial in 106000000..106999999) {
|
if (serial in 106000000..106999999) {
|
||||||
return INVALID
|
return ModelType.INVALID
|
||||||
}
|
}
|
||||||
|
|
||||||
return when (Crypt().simpleDecrypt(serial)) {
|
return when (Crypt().simpleDecrypt(serial)) {
|
||||||
in 126000000..126999999 -> MD_0201
|
in 126000000..126999999 -> ModelType.MD0201
|
||||||
in 127000000..127999999 -> MD_5201
|
in 127000000..127999999 -> ModelType.MD5201
|
||||||
in 128000000..128999999 -> MD_8201
|
in 128000000..128999999 -> ModelType.MD8201
|
||||||
in 130000000..130999999 -> MD_0202
|
in 130000000..130999999 -> ModelType.MD0202
|
||||||
in 131000000..131999999 -> MD_5202
|
in 131000000..131999999 -> ModelType.MD5202
|
||||||
in 148000000..148999999 -> MD_8301
|
in 148000000..148999999 -> ModelType.MD8301
|
||||||
else -> INVALID
|
else -> ModelType.INVALID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,6 @@
|
||||||
<string name="alarm_expired">Expired</string>
|
<string name="alarm_expired">Expired</string>
|
||||||
<string name="alarm_reservoir_empty">Reservoir empty</string>
|
<string name="alarm_reservoir_empty">Reservoir empty</string>
|
||||||
<string name="alarm_patch_fault">Patch fault</string>
|
<string name="alarm_patch_fault">Patch fault</string>
|
||||||
<string name="alarm_patch_fault2">Patch fault 2</string>
|
|
||||||
<string name="alarm_base_fault">Base fault</string>
|
<string name="alarm_base_fault">Base fault</string>
|
||||||
<string name="alarm_battery_out">Battery out</string>
|
<string name="alarm_battery_out">Battery out</string>
|
||||||
<string name="alarm_no_calibration">No calibration</string>
|
<string name="alarm_no_calibration">No calibration</string>
|
||||||
|
@ -142,7 +141,7 @@
|
||||||
<string name="sn_input_title">Serial Number</string>
|
<string name="sn_input_title">Serial Number</string>
|
||||||
<string name="sn_input_summary">Enter the serial number of your pump base.</string>
|
<string name="sn_input_summary">Enter the serial number of your pump base.</string>
|
||||||
<string name="sn_input_invalid">Invalid serial number!</string>
|
<string name="sn_input_invalid">Invalid serial number!</string>
|
||||||
<string name="pump_unsupported">Pump untested: %1$d! Please contact us at discord or github for support</string>
|
<string name="pump_unsupported">Pump untested: %1$s! Please contact us at discord or github for support</string>
|
||||||
<string name="alarm_setting_title">Alarm Settings</string>
|
<string name="alarm_setting_title">Alarm Settings</string>
|
||||||
<string name="alarm_setting_summary">Select your preferred pump alarm settings.</string>
|
<string name="alarm_setting_summary">Select your preferred pump alarm settings.</string>
|
||||||
<string name="pump_warning_notification_title">Notification on pump warning</string>
|
<string name="pump_warning_notification_title">Notification on pump warning</string>
|
||||||
|
|
|
@ -9,6 +9,7 @@ import app.aaps.core.interfaces.rx.events.EventOverviewBolusProgress
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
||||||
|
import info.nightscout.pump.medtrum.comm.enums.ModelType
|
||||||
import info.nightscout.pump.medtrum.util.MedtrumSnUtil
|
import info.nightscout.pump.medtrum.util.MedtrumSnUtil
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
@ -139,7 +140,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
val receivedTime = 1500L
|
val receivedTime = 1500L
|
||||||
val duration = T.mins(5).msecs()
|
val duration = T.mins(5).msecs()
|
||||||
|
|
||||||
medtrumPump.deviceType = MedtrumSnUtil.MD_8301
|
medtrumPump.deviceType = ModelType.MD8301.value
|
||||||
|
|
||||||
// Mocks
|
// Mocks
|
||||||
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
||||||
|
@ -191,7 +192,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
val basalStartTime = 1000L
|
val basalStartTime = 1000L
|
||||||
val receivedTime = 1500L
|
val receivedTime = 1500L
|
||||||
|
|
||||||
medtrumPump.deviceType = MedtrumSnUtil.MD_8301
|
medtrumPump.deviceType = ModelType.MD8301.value
|
||||||
|
|
||||||
// Mocks
|
// Mocks
|
||||||
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
||||||
|
@ -240,7 +241,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
val basalStartTime = 1000L
|
val basalStartTime = 1000L
|
||||||
val receivedTime = 1500L
|
val receivedTime = 1500L
|
||||||
|
|
||||||
medtrumPump.deviceType = MedtrumSnUtil.MD_8301
|
medtrumPump.deviceType = ModelType.MD8301.value
|
||||||
|
|
||||||
// Mocks
|
// Mocks
|
||||||
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
||||||
|
@ -293,7 +294,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
val duration = T.mins(5).msecs()
|
val duration = T.mins(5).msecs()
|
||||||
|
|
||||||
medtrumPump.actualBasalProfile = medtrumPump.buildMedtrumProfileArray(validProfile)!!
|
medtrumPump.actualBasalProfile = medtrumPump.buildMedtrumProfileArray(validProfile)!!
|
||||||
medtrumPump.deviceType = MedtrumSnUtil.MD_8301
|
medtrumPump.deviceType = ModelType.MD8301.value
|
||||||
|
|
||||||
// Mocks
|
// Mocks
|
||||||
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
||||||
|
@ -346,7 +347,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
val basalStartTime = 1000L
|
val basalStartTime = 1000L
|
||||||
val receivedTime = 1500L
|
val receivedTime = 1500L
|
||||||
|
|
||||||
medtrumPump.deviceType = MedtrumSnUtil.MD_8301
|
medtrumPump.deviceType = ModelType.MD8301.value
|
||||||
|
|
||||||
// Mocks
|
// Mocks
|
||||||
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
||||||
|
@ -441,7 +442,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
val basalStartTime = 1000L
|
val basalStartTime = 1000L
|
||||||
val receivedTime = 1500L
|
val receivedTime = 1500L
|
||||||
|
|
||||||
medtrumPump.deviceType = MedtrumSnUtil.MD_8301
|
medtrumPump.deviceType = ModelType.MD8301.value
|
||||||
|
|
||||||
// Mocks
|
// Mocks
|
||||||
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
||||||
|
@ -492,7 +493,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
val basalStartTime = 1000L
|
val basalStartTime = 1000L
|
||||||
val receivedTime = 1500L
|
val receivedTime = 1500L
|
||||||
|
|
||||||
medtrumPump.deviceType = MedtrumSnUtil.MD_8301
|
medtrumPump.deviceType = ModelType.MD8301.value
|
||||||
|
|
||||||
// Mocks
|
// Mocks
|
||||||
Mockito.`when`(pumpSync.expectedPumpState()).thenReturn(
|
Mockito.`when`(pumpSync.expectedPumpState()).thenReturn(
|
||||||
|
@ -537,7 +538,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
val basalStartTime = 1000L
|
val basalStartTime = 1000L
|
||||||
val receivedTime = 1500L
|
val receivedTime = 1500L
|
||||||
|
|
||||||
medtrumPump.deviceType = MedtrumSnUtil.MD_8301
|
medtrumPump.deviceType = ModelType.MD8301.value
|
||||||
|
|
||||||
// Mocks
|
// Mocks
|
||||||
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
||||||
|
@ -581,7 +582,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
val basalStartTime = 1000L
|
val basalStartTime = 1000L
|
||||||
val receivedTime = 1500L
|
val receivedTime = 1500L
|
||||||
|
|
||||||
medtrumPump.deviceType = MedtrumSnUtil.MD_8301
|
medtrumPump.deviceType = ModelType.MD8301.value
|
||||||
|
|
||||||
// Mocks
|
// Mocks
|
||||||
Mockito.`when`(pumpSync.expectedPumpState()).thenReturn(
|
Mockito.`when`(pumpSync.expectedPumpState()).thenReturn(
|
||||||
|
@ -650,7 +651,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
|
|
||||||
@Test fun setFakeTBRIfNotSetWhenNoFakeTBRAlreadyRunningExpectPumpSync() {
|
@Test fun setFakeTBRIfNotSetWhenNoFakeTBRAlreadyRunningExpectPumpSync() {
|
||||||
// Inputs
|
// Inputs
|
||||||
medtrumPump.deviceType = MedtrumSnUtil.MD_8301
|
medtrumPump.deviceType = ModelType.MD8301.value
|
||||||
|
|
||||||
// Mocks
|
// Mocks
|
||||||
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
||||||
|
@ -684,7 +685,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
|
|
||||||
@Test fun setFakeTBRIfNotSetWhenFakeTBRAlreadyRunningExpectNoPumpSync() {
|
@Test fun setFakeTBRIfNotSetWhenFakeTBRAlreadyRunningExpectNoPumpSync() {
|
||||||
// Inputs
|
// Inputs
|
||||||
medtrumPump.deviceType = MedtrumSnUtil.MD_8301
|
medtrumPump.deviceType = ModelType.MD8301.value
|
||||||
|
|
||||||
// Mocks
|
// Mocks
|
||||||
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
val expectedTemporaryBasal: PumpSync.PumpState.TemporaryBasal = mock(PumpSync.PumpState.TemporaryBasal::class.java)
|
||||||
|
|
Loading…
Reference in a new issue