Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ enum class DoseStepSize(private val entries: Array<DoseStepSizeEntry>) {
DoseStepSizeEntry(10.0, Double.MAX_VALUE, 0.1)
)
),
TandemMobiBasal(
arrayOf(
DoseStepSizeEntry(0.0, 0.1, 0.1),
DoseStepSizeEntry(0.1, 15.0, 0.001)
)
),
TandemMobiBolus(
arrayOf(
DoseStepSizeEntry(0.05, 25.0, 0.01),
)
),
YpsopumpBasal(
arrayOf(
DoseStepSizeEntry(0.0, 1.0, 0.01),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,14 @@ enum class PumpType(
manufacturer = ManufacturerType.Tandem,
model = "Mobi",
bolusSize = 0.01,
specialBolusSize = null,
specialBolusSize = DoseStepSize.TandemMobiBolus,
extendedBolusSettings = DoseSettings(0.01, 15, 8 * 60, 0.4),
pumpTempBasalType = PumpTempBasalType.Percent,
tbrSettings = DoseSettings(5.0, 15, 72 * 60, 0.0, 250.0),
specialBasalDurations = arrayOf(Capability.BasalRate_Duration15minAllowed, Capability.BasalRate_Duration30minAllowed),
baseBasalMinValue = 0.1,
baseBasalStep = 0.001,
baseBasalSpecialSteps = null,
baseBasalSpecialSteps = DoseStepSize.TandemMobiBasal,
// reservoirSize = 200,
pumpCapability = PumpCapability.TandemMobiCapabilities,
source = Source.Tandem
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,5 @@ androidx-compose-runtime-livedata = { group = "androidx.compose.runtime", name =
com-jakewharton-timber = { group = "com.jakewharton.timber", name = "timber", version="5.0.1" }
com-github-weliem-blessed-android = { group = "com.github.weliem", name = "blessed-android", version="2.4.0" }
io-github-vanpra-compose-dialogs-datetime = { group = "io.github.vanpra.compose-material-dialogs", name = "datetime", version="0.9.0" }
com-github-jwoglom-pumpx2-android = { group = "com.github.jwoglom.pumpX2", name = "pumpx2-android", version="v1.8.0" }
com-github-jwoglom-pumpx2-android = { group = "com.github.jwoglom.pumpX2", name = "pumpx2-android", version="v1.8.2" }

Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ interface PumpBLESelector {

enum class PumpBLESelectorText {
SCAN_TITLE,
INSTRUCTIONS_TEXT,
SELECTED_PUMP_TITLE,
REMOVE_TITLE,
REMOVE_TEXT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ open class PumpBLEConfigActivity : TranslatedDaggerAppCompatActivity() {

binding.pumpBleConfigCurrentlySelectedText.text = bleSelector.getText(PumpBLESelectorText.SELECTED_PUMP_TITLE)
binding.pumpBleConfigScanTitle.text = bleSelector.getText(PumpBLESelectorText.SCAN_TITLE)
binding.pumpBleConfigInstructionsText.text = bleSelector.getText(PumpBLESelectorText.INSTRUCTIONS_TEXT)

title = bleSelector.getText(PumpBLESelectorText.PUMP_CONFIGURATION)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
Expand Down
9 changes: 8 additions & 1 deletion pump/common/src/main/res/layout/pump_ble_config_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
android:orientation="vertical"
android:padding="5dp">

<TextView
android:id="@+id/pump_ble_config_instructions_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp" />

<!-- Currently selected Pump -->
<TextView
style="@style/TextAppearance.AppCompat.Title"
Expand Down Expand Up @@ -49,7 +55,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:paddingTop="24dp">

<TextView
style="@style/TextAppearance.AppCompat.Title"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable
import java.util.*
import app.aaps.pump.tandem.common.events.EventTandemPairingStatus
import app.aaps.pump.tandem.common.events.PairingError
import com.jwoglom.pumpx2.pump.messages.builders.JpakeAuthBuilder

/**
* This is low-level driver that does pairing with pump
Expand Down Expand Up @@ -212,7 +213,8 @@ class TandemPairingManager constructor(
val pumpName = preferences.get(TandemStringPreferenceKey.PumpName)
rxBus.send(EventTandemPairingStatus.PairingSuccess(
pumpSerial = pumpVersionResponse.serialNum.toString(),
pumpName = pumpName
pumpName = pumpName,
pumpApiVersion = pumpStatus.tandemPumpFirmware
))

showToast("Pairing with Tandem was SUCCESS.") // TODO TandemPairingManager N-5
Expand Down Expand Up @@ -244,7 +246,7 @@ class TandemPairingManager constructor(

pair(peripheral, centralChallenge, code)
preferences.put(TandemIntPreferenceKey.PumpPairStatus, 50)
rxBus.send(EventTandemPairingStatus.Connecting)
rxBus.send(EventTandemPairingStatus.PairingInProgress(0, "Starting"))
}

// private fun hasPairingCode(peripheral: BluetoothPeripheral?, btAddress: String, challenge: AbstractCentralChallengeResponse?, pairingCode: String) {
Expand Down Expand Up @@ -290,6 +292,10 @@ class TandemPairingManager constructor(
// // rxBus.send()
// }

override fun onJpakeProgress(jpakeStep: JpakeAuthBuilder.JpakeStep) {
rxBus.send(EventTandemPairingStatus.PairingInProgress(jpakeStep.progressPercent, jpakeStep.name))
}

private fun triggerPairDialog(peripheral: BluetoothPeripheral, btAddress: String, challenge: CentralChallengeResponse) {

aapsLogger.info(LTag.PUMPCOMM, "TANDEM-PAIR-DBG: triggerPairDialog")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ class TandemUICommunication @Inject constructor (
dataStore.notificationBundle.value = NotificationBundle()
}

if (pumpUtil.isNotificationNotFiltered(message)) {
dataStore.notificationBundle.value = dataStore.notificationBundle.value?.add(message)
}
dataStore.notificationBundle.value = dataStore.notificationBundle.value?.add(message)

return
}
Expand Down Expand Up @@ -280,19 +278,6 @@ class TandemUICommunication @Inject constructor (

}

// TODO(jwoglom): if uncommented, sync with MalfunctionStatusResponse#hasMalfunction()
// val malfunctionFilterSet: HashSet<String> = hashSetOf(
// "17-0x2032" // LOW INSULIN ALERT2
// )
//
// private fun isNotFiltered(message: Message): Boolean {
// if (message is MalfunctionStatusResponse) {
// val malfunction : MalfunctionStatusResponse = message as MalfunctionStatusResponse
// return !(malfunctionFilterSet.contains(malfunction.errorString))
// } else
// return true;
// }

private fun unsuccessfulAlert(req: String) {

aapsLogger.error(TAG,"$req was not successful. The pump returned an error fulfilling the request." )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ class TandemBLESelector @Inject constructor(

aapsLogger.debug(TAG, "TANDEMDBG: onDeviceSelected: ${bleAddress} ")

val selectionOnly = activity.intent?.getBooleanExtra(TandemPumpBLEConfigActivity.EXTRA_SELECTION_ONLY, false) ?: false
val selectionOnly = activity.intent?.getBooleanExtra(
TandemPumpBLEConfigActivity.EXTRA_SELECTION_ONLY, false
) ?: false

//var addressChanged = false

Expand Down Expand Up @@ -193,11 +195,13 @@ class TandemBLESelector @Inject constructor(

when (key) {
PumpBLESelectorText.SCAN_TITLE -> stringId = R.string.tandem_ble_config_scan_title
PumpBLESelectorText.INSTRUCTIONS_TEXT -> stringId = R.string.tandem_wizard_waiting_device_selection
PumpBLESelectorText.SELECTED_PUMP_TITLE -> stringId = R.string.tandem_ble_config_selected_pump_title
PumpBLESelectorText.REMOVE_TITLE -> stringId = R.string.tandem_ble_config_remove_pump_title
PumpBLESelectorText.REMOVE_TEXT -> stringId = R.string.tandem_ble_config_remove_pump_confirmation
PumpBLESelectorText.NO_SELECTED_PUMP -> stringId = R.string.tandem_ble_config_no_pump_selected
PumpBLESelectorText.PUMP_CONFIGURATION -> stringId = R.string.tandem_configuration
else -> return ""
}

return resourceHelper.gs(stringId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class TandemPumpConnectionManager @Inject constructor(
GET_MALFUNCTIONS -> {
val malfunctionStatus = responseData.value as MalfunctionStatusDto

if (malfunctionStatus.hasMalfunction()) {
if (malfunctionStatus.hasMalfunction() && !malfunctionStatus.malfunctionMatchesActiveAlertOrAlarm) {
setNotificationSemaphore()
}
}
Expand Down
Loading