Skip to content

Commit a2b0c9a

Browse files
Merge branch 'andy_tandem_dev' into andy_tandem
2 parents 7e2b2a1 + 50d6e1f commit a2b0c9a

37 files changed

Lines changed: 1084 additions & 489 deletions

core/interfaces/src/main/kotlin/app/aaps/core/interfaces/notifications/Notification.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,10 @@ open class Notification {
143143
const val AAPS_DIR_NOT_SELECTED = 92
144144
const val EQUIL_ALARM = 93
145145
const val EQUIL_ALARM_INSULIN = 94
146+
146147
const val TANDEM_BASAL_PROFILE_ERROR = 95
148+
const val TANDEM_SITE_REMINDER = 96
149+
const val TANDEM_PUMP_SETTINGS_UPDATED = 97
147150

148151

149152
const val USER_MESSAGE = 1000

gradle/libs.versions.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,6 @@ androidx-compose-runtime-livedata = { group = "androidx.compose.runtime", name =
184184
# Tandem
185185
com-jakewharton-timber = { group = "com.jakewharton.timber", name = "timber", version="5.0.1" }
186186
com-github-weliem-blessed-android = { group = "com.github.weliem", name = "blessed-android", version="2.4.0" }
187-
187+
io-github-vanpra-compose-dialogs-datetime = { group = "io.github.vanpra.compose-material-dialogs", name = "datetime", version="0.9.0" }
188+
com-github-jwoglom-pumpx2-android = { group = "com.github.jwoglom.pumpX2", name = "pumpx2-android", version="v1.6.9" }
188189

pump/common/src/main/kotlin/app/aaps/pump/common/PumpPluginAbstract.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ abstract class PumpPluginAbstract protected constructor(
450450
commandQueue.readStatus("Scheduled Status Refresh", null)
451451
}
452452
}
453+
doCustomScheduledActions()
453454
}
454455
} while (serviceRunning)
455456
}.start()
@@ -488,7 +489,14 @@ abstract class PumpPluginAbstract protected constructor(
488489
}
489490
}
490491

492+
493+
protected open fun doCustomScheduledActions() {
494+
495+
}
496+
497+
491498
protected fun doWeHaveAnyStatusNeededRefereshing(statusRefresh: Map<PumpDataRefreshType?, Long?>?): Boolean {
499+
// aapsLogger.error(LTag.PUMP, "Do we have status needed to refresh: $statusRefresh, currentTime=${System.currentTimeMillis()}")
492500
for ((_, value) in statusRefresh!!) {
493501
if (value!! > 0 && System.currentTimeMillis() > value) {
494502
return true
@@ -540,8 +548,6 @@ abstract class PumpPluginAbstract protected constructor(
540548
}
541549

542550

543-
544-
545551
// this method needs to be overwriten in your driver and implement PumpDataRefreshCapable
546552
open fun getRefreshTime(pumpDataRefreshType: PumpDataRefreshType): Int {
547553
return -1

pump/common/src/main/kotlin/app/aaps/pump/common/defs/BolusData.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import app.aaps.pump.common.driver.connector.commands.data.AdditionalResponseDat
44
import com.google.gson.annotations.Expose
55

66
class BolusData constructor(
7-
@Expose var timestamp: Long,
8-
@Expose var amountImmediate : Double,
7+
@Expose var timestamp: Long = System.currentTimeMillis(),
8+
@Expose var amountImmediateRequested : Double? = null,
9+
@Expose var amountImmediateDelivered : Double? = null,
10+
@Expose var fullyDelivered: Boolean = false,
911
@Expose var carbs : Double = 0.0,
1012
@Expose var durationMinutes : Int? = null,
1113
@Expose var amountExtended : Double? = null,

pump/common/src/main/kotlin/app/aaps/pump/common/driver/connector/PumpDummyConnector.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ open class PumpDummyConnector(var pumpStatus: PumpStatus,
6868
//return successfulResponseForSet.cloneWithNewCommandType(PumpCommandType.SetBolus)
6969

7070
return DataCommandResponse(
71-
PumpCommandType.SetBolus, true, null, BolusData(amountImmediate = 1.0,
71+
PumpCommandType.SetBolus, true, null, BolusData(amountImmediateDelivered = 1.0,
7272
timestamp = System.currentTimeMillis())
7373
)
7474
}
@@ -77,7 +77,7 @@ open class PumpDummyConnector(var pumpStatus: PumpStatus,
7777
pumpUtil.sleepSeconds(10)
7878

7979
return DataCommandResponse(
80-
PumpCommandType.GetBolus, true, null, BolusData(amountImmediate = 1.0,
80+
PumpCommandType.GetBolus, true, null, BolusData(amountImmediateDelivered = 1.0,
8181
timestamp = System.currentTimeMillis())
8282
)
8383
}

pump/common/src/main/kotlin/app/aaps/pump/common/driver/connector/commands/parameters/CommandParameters.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ open class CommandParameters // public CommandParameters(YpsoPumpCommandType
7272
// }
7373
//
7474
// }
75-
override fun equals(o: Any?): Boolean {
76-
if (this === o) return true
77-
if (o !is CommandParameters) return false
78-
val that = o
75+
override fun equals(other: Any?): Boolean {
76+
if (this === other) return true
77+
if (other !is CommandParameters) return false
78+
val that = other
7979
return isSingleCommand == that.isSingleCommand && commandType == that.commandType && commandTypeList == that.commandTypeList
8080
}
8181

pump/common/src/main/kotlin/app/aaps/pump/common/driver/connector/mgr/PumpConnectionManager.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,6 @@ abstract class PumpConnectionManager constructor(
488488

489489
if (responseData.isSuccess) {
490490
pumpStatus.batteryRemaining = responseData.value!!
491-
aapsLogger.error(TAG, "New Battery remaining: ${pumpStatus.batteryRemaining}")
492491
}
493492

494493
return responseData

pump/common/src/main/res/values/strings.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
<string name="common_resultok">OK</string>
88

99
<string name="pump_serial_number">Pump Serial Number</string>
10+
<string name="bolus_preparing">Preparing for %1$.2f U bolus</string>
1011
<string name="bolus_delivered_so_far">%1$.2f U / %2$.2f U delivered</string>
12+
<string name="bolus_finished_post_bolus">Bolus finished, performing post-bolus checks</string>
13+
1114

1215
<!-- PumpCommon - Overview fragment -->
1316
<string name="pump_base_basal_rate_with_profile">(%1s) %2$.2f U/h</string>

pump/tandem/build.gradle.kts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,9 @@ dependencies {
5555
testImplementation(project(":shared:impl"))
5656

5757

58-
//api(libs.androidx.fragment)
5958
api(libs.androidx.room)
6059
api(libs.androidx.room.runtime)
6160
api(libs.androidx.room.rxjava3)
62-
//api(libs.commons.codec)
6361

6462
ksp(libs.androidx.room.compiler)
6563
ksp(libs.com.google.dagger.compiler)
@@ -80,13 +78,13 @@ dependencies {
8078
implementation(libs.androidx.lifecycle.runtime.compose)
8179
implementation(libs.androidx.compose.navigation)
8280
implementation(libs.androidx.compose.runtime.livedata)
83-
//implementation(libs.androidx.compose.material3.pullrefresh)
81+
implementation(libs.io.github.vanpra.compose.dialogs.datetime)
8482

8583
// pumpX2
8684
implementation(libs.com.jakewharton.timber)
8785
implementation(libs.com.github.weliem.blessed.android)
88-
implementation("com.github.jwoglom.pumpX2:pumpx2-android:v1.6.9")
89-
86+
//implementation("com.github.jwoglom.pumpX2:pumpx2-android:v1.6.9")
87+
implementation(libs.com.github.jwoglom.pumpx2.android)
9088

9189

9290
// temporarily X2 released under atech-software instead of jwoglom (some problems with linking)

pump/tandem/src/main/kotlin/app/aaps/pump/tandem/common/comm/TandemCommunicationManager.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,12 @@ class TandemCommunicationManager(
173173
* Sends command to the pump, if driver is in preventConnect mode any messages will be ignored,
174174
* unless we specify forceSend. Force send should be used only for ChangeFillManager
175175
*/
176+
@Synchronized
176177
fun sendCommand(request: Message, forceSend: Boolean = false): Message? {
177178
var times = 0
178179

180+
aapsLogger.error(TAG, "sendCommand: ${request.javaClass.simpleName}") // TODO
181+
179182
operationMode = OperationMode.StandardOperation
180183

181184
if (pumpUtil.preventConnect) {

0 commit comments

Comments
 (0)