Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
169 commits
Select commit Hold shift + click to select a range
4fc08f3
Create temp.txt
AARUY-Medical Jul 3, 2026
2cc7e14
Delete temp.txt
AARUY-Medical Jul 3, 2026
3f31355
Delete .github directory
AARUY-Medical Jul 3, 2026
7c705d5
Add files via upload
AARUY-Medical Jul 3, 2026
6d8b10a
Add files via upload
AARUY-Medical Jul 3, 2026
99e463c
Add files via upload
AARUY-Medical Jul 3, 2026
32a6cdd
Add files via upload
AARUY-Medical Jul 3, 2026
905a5e6
Add files via upload
AARUY-Medical Jul 4, 2026
943ee86
Add files via upload
AARUY-Medical Jul 4, 2026
1b3f3d0
Add files via upload
AARUY-Medical Jul 4, 2026
9ca2d48
Add files via upload
AARUY-Medical Jul 4, 2026
c6447a9
Add files via upload
AARUY-Medical Jul 4, 2026
65fe172
Create README.md
AARUY-Medical Jul 4, 2026
b08e023
Add files via upload
AARUY-Medical Jul 4, 2026
c950af4
Create ExampleUnitTest.kt
AARUY-Medical Jul 4, 2026
2d514ab
Add files via upload
AARUY-Medical Jul 4, 2026
2668c35
Create AndroidManifest.xml
AARUY-Medical Jul 4, 2026
96a9780
Add files via upload
AARUY-Medical Jul 4, 2026
19891df
Add files via upload
AARUY-Medical Jul 4, 2026
da9df13
Aaruy: keep only the driver, remove the vendor upload
MilosKozak Nov 4, 2026
9beccc2
Aaruy: remove upload code from the driver
MilosKozak Nov 4, 2026
9cb7538
Aaruy: remove Chinese translations
MilosKozak Nov 4, 2026
da6d93d
Version 3.4.2.3-aaruy
MilosKozak Nov 4, 2026
e460df2
Aaruy: BLE library sources in project
MilosKozak Nov 4, 2026
43e7905
Aaruy: test the AAR on the BLE library sources with Robolectric
MilosKozak Nov 4, 2026
0b8dd9a
Aaruy: BLE library talks to a GattLink, real Android GATT behind it
MilosKozak Nov 4, 2026
e154ef8
Copy BleTransport from dev
MilosKozak Nov 4, 2026
0c32868
Aaruy: BLE library can run on BleTransport, temporary emulator link
MilosKozak Nov 4, 2026
a870b96
Aaruy: pump emulator, tested with the unmodified AAR
MilosKozak Nov 4, 2026
9145e7f
Aaruy: start the emulator with the emulate_aaruy marker file
MilosKozak Nov 4, 2026
491af0a
Aaruy emulator: first history on connect, limit daily history
MilosKozak Nov 4, 2026
3d49840
Aaruy: a stopped bolus keeps the amount the pump reported
MilosKozak Nov 4, 2026
c5644f9
Aaruy emulator: adb broadcast to take the pump out of range
MilosKozak Nov 4, 2026
4afc84a
Aaruy: connecting to a link that is still up ends connected
MilosKozak Nov 4, 2026
3dc355b
Aaruy: split into protocol and emulator modules
MilosKozak Nov 4, 2026
3eaa908
Aaruy emulator: unit tests
MilosKozak Nov 4, 2026
cec77ef
Aaruy: protocol in Kotlin, the vendor AAR only stays as test reference
MilosKozak Nov 4, 2026
b652fad
Aaruy: BleTransport replaces the Nordic BLE library
MilosKozak Nov 4, 2026
a69a387
Aaruy: utilities in Kotlin, no crash on a locale with other digits
MilosKozak Nov 4, 2026
c0b535b
Aaruy: protocol and transport tests without the AAR
MilosKozak Nov 4, 2026
4934a0e
Aaruy: floating point noise does not lose a thousandth of a unit
MilosKozak Nov 4, 2026
0df0cf5
Aaruy: a lost link during a bolus is not success, and it does not blo…
MilosKozak Nov 4, 2026
56bcc35
Aaruy: log every frame to and from the pump
MilosKozak Nov 4, 2026
fd8d817
Aaruy: first connect does not turn the pump sounds off
MilosKozak Nov 4, 2026
34d5314
Aaruy: a connect request does not restart a running setup or pairing
MilosKozak Nov 4, 2026
e67e528
Aaruy: the pump answers a stop by going back to basal
MilosKozak Nov 4, 2026
952272f
Aaruy: writes from many threads keep the sequence in order
MilosKozak Nov 4, 2026
f254316
Aaruy: an empty history at pairing does not turn history off
MilosKozak Nov 4, 2026
8921a40
Aaruy: the profile check compares rates, not the daily total
MilosKozak Nov 4, 2026
c5a5e43
Aaruy: the emulator follows a capture of a real pump
MilosKozak Nov 4, 2026
feecc33
Merge dev into aaruy
MilosKozak Nov 4, 2026
a0f91b3
Aaruy: the driver on dev, with Metro, suspend pump calls and an empty…
MilosKozak Nov 4, 2026
4c12aa1
Aaruy: the emulator sends one frame about every 100 ms, as a real pump
MilosKozak Nov 4, 2026
ebb59a6
Aaruy: Compose overview, pairing with the button on the pump, and unp…
MilosKozak Nov 4, 2026
47f2a48
Aaruy: Compose wizard for replacing the reservoir and starting basal
MilosKozak Nov 4, 2026
776c38e
Aaruy: settings, history screen, and the pump log corrects what happe…
MilosKozak Nov 4, 2026
0ea79bb
Aaruy: remove strings of the old screens, the unknown bolus message k…
MilosKozak Nov 4, 2026
fff6310
Aaruy: history list does not crash, back returns to the pump screen, …
MilosKozak Nov 4, 2026
67309ba
Aaruy: base basal rate is the profile rate of this hour, not what run…
MilosKozak Nov 4, 2026
9dde098
Aaruy: pump description follows the pump type
MilosKozak Nov 4, 2026
2b009c4
Aaruy: an error in handling a warning does not stop the service colle…
MilosKozak Nov 4, 2026
39a61a1
Aaruy: last connection needs an answer, history is read on purpose at…
MilosKozak Nov 4, 2026
96faab4
Aaruy: commands wait for the answer, a late answer of a real pump is …
MilosKozak Nov 4, 2026
63e4c49
Aaruy: basal schedule moved to the clock of the pump, it runs on UTC+…
MilosKozak Nov 4, 2026
2402ed2
Aaruy: pump events run on their own thread, not on the main thread
MilosKozak Nov 4, 2026
86f20ef
Aaruy: Bluetooth turned off ends the link, the bolus wait message no …
MilosKozak Nov 4, 2026
11debeb
Aaruy: the pump thread and the 2 second check start at the first conn…
MilosKozak Nov 4, 2026
204f3a8
Aaruy: daily totals of the pump stay on the history screen, they are …
MilosKozak Nov 5, 2026
09cb6dc
Aaruy: strings use the same words, clearer English, unused keys removed
MilosKozak Nov 5, 2026
ff21c3f
Merge remote-tracking branch 'origin/dev' into aaruy
MilosKozak Nov 5, 2026
13d60cd
Temp basal screens show every rate the pump can run, 0.275 U/h is no …
MilosKozak Nov 5, 2026
e4e24f2
Aaruy: bolus step follows the pump setting, the pump refuses an amoun…
MilosKozak Nov 5, 2026
1c7ee8d
Aaruy: no extended bolus, it blocks temp basals and boluses while it …
MilosKozak Nov 5, 2026
2c91cee
Aaruy: temp basals and stops come from the status and the pump log, c…
MilosKozak Nov 5, 2026
3a5d3ed
Aaruy: new key in the preference snapshot
MilosKozak Nov 5, 2026
804dc95
Aaruy: fixes from the lost link scenarios, repeated log entry, end fr…
MilosKozak Nov 5, 2026
ed3cb1c
Aaruy: a running temp basal can be changed, the state check refused e…
MilosKozak Nov 5, 2026
5e07b8e
Aaruy: pump picture on the pump screen, as a vector
MilosKozak Nov 5, 2026
e6bf598
Aaruy: the button says Change reservoir, as on Equil
MilosKozak Nov 5, 2026
ef8e87a
Aaruy: pairing keeps the last bolus, the pump screen showed none unti…
MilosKozak Nov 5, 2026
669eb76
Aaruy: confirmed alarms leave the pump screen at once, they stayed up…
MilosKozak Nov 5, 2026
d272828
Aaruy: insulin and site steps in the reservoir change, profile step i…
MilosKozak Nov 5, 2026
f389fef
Aaruy: alarms in the pump history are one byte, as on a real pump; em…
MilosKozak Nov 5, 2026
5785bef
Aaruy: a bolus the pump ended early is failed, stopped too long rings
MilosKozak Nov 5, 2026
a4b1415
Aaruy: comments in English, unused constants, helpers and imports rem…
MilosKozak Nov 5, 2026
622ec39
Aaruy: unused queries, model names and a state flow removed
MilosKozak Nov 5, 2026
c1f79de
Aaruy: log levels and tags, normal events are debug, every call has a…
MilosKozak Nov 5, 2026
8bc4b03
Aaruy: wording, shared strings, imports instead of full names; Crowdi…
MilosKozak Nov 5, 2026
0461111
Aaruy: history screen names alarms from the one byte log; tests for t…
MilosKozak Nov 5, 2026
ccfec56
Aaruy: tests for how a bolus outcome reaches AAPS
MilosKozak Nov 5, 2026
ca67b04
Aaruy: tests for the pair wizard and its profile step
MilosKozak Nov 5, 2026
37d2175
Aaruy: tests for the history database queries
MilosKozak Nov 5, 2026
8c36d94
Aaruy: tests for the pump screen rows and buttons
MilosKozak Nov 5, 2026
52518f0
Aaruy: screen tests for the reservoir change wizard
MilosKozak Nov 5, 2026
b97720e
Aaruy: scanner keeps each pump once, with a test
MilosKozak Nov 5, 2026
5a1dafd
Merge branch 'dev' into aaruy
MilosKozak Nov 5, 2026
67a65f7
Aaruy: vendor AAR removed, its command bytes kept as a fixed test file
MilosKozak Nov 6, 2026
fdea47f
Aaruy: a short packet is dropped, not read with default values
MilosKozak Nov 6, 2026
f104007
Aaruy: wizard says to wait for the motor after rewind and prime
MilosKozak Nov 6, 2026
f09d625
Aaruy: a history read with a missing page is asked again, the log tim…
MilosKozak Nov 6, 2026
ba4c790
Aaruy: a bolus start with no answer is UNKNOWN, a start given up on i…
MilosKozak Nov 6, 2026
ab4a942
Aaruy: a history read with a hole writes nothing after it, a read tha…
MilosKozak Nov 6, 2026
85b3846
Aaruy: the same alarm rings again after a confirm or a restart, an al…
MilosKozak Nov 6, 2026
4df4845
Aaruy: the wizard waits for the motor state it asked for, a failed ba…
MilosKozak Nov 6, 2026
2e4eeb8
Aaruy: an older bolus read again is not shown as the last bolus
MilosKozak Nov 6, 2026
b95f12d
Aaruy: temp basal from the log: late status start corrected, end limi…
MilosKozak Nov 6, 2026
97e97cf
Aaruy: a lost link decides how a bolus ended, unpair and plugin stop …
MilosKozak Nov 6, 2026
a5a2325
Aaruy: U200 rates on the pump and history screens, lower limit of pum…
MilosKozak Nov 6, 2026
3e4d24b
Aaruy: review of the fixes: a refused start is not sent, no stop befo…
MilosKozak Nov 6, 2026
c9dc982
Merge remote-tracking branch 'origin/dev' into aaruy
MilosKozak Nov 7, 2026
6ad0992
Aaruy: reservoir and battery not known until the first status, the la…
MilosKozak Nov 7, 2026
cb31e2b
Merge remote-tracking branch 'origin/dev' into aaruy
MilosKozak Nov 7, 2026
398bb0c
Merge remote-tracking branch 'origin/dev' into aaruy
MilosKozak Nov 7, 2026
fe3e351
Aaruy: a bolus running after an app restart gets its progress and Stop
MilosKozak Nov 7, 2026
fd56f14
Aaruy: the app start does not wait for the first status read, the his…
MilosKozak Nov 7, 2026
bb0dd46
Aaruy: the command queue opens and closes the link, the driver no lon…
MilosKozak Nov 7, 2026
5054341
Aaruy: a bolus whose link is lost ends its command, and a queued stat…
MilosKozak Nov 7, 2026
4a9fbe8
Aaruy: confirm alarms and unpair go through the command queue
MilosKozak Nov 7, 2026
bd3ead9
Aaruy: a slower history read of the type chosen before does not repla…
MilosKozak Nov 7, 2026
ff38d87
Aaruy: the reservoir change moves the motor through the command queue
MilosKozak Nov 7, 2026
c9e14b2
Aaruy: dead service methods removed, the status read asks for the fir…
MilosKozak Nov 7, 2026
131d947
Aaruy: comment on confirm alarms matches the queue
MilosKozak Nov 7, 2026
fbb00a8
Aaruy: a bolus without its stored info finds its record by the saved …
MilosKozak Nov 7, 2026
9d74f4f
Aaruy: a later pump error no longer removes an earlier one, stopped t…
MilosKozak Nov 7, 2026
317c9c2
Aaruy: the pump log decides where a temp basal ended, a new temp basa…
MilosKozak Nov 7, 2026
c67476c
Aaruy: a reservoir change goes on from the pump log after an app restart
MilosKozak Nov 7, 2026
8dbaeb4
Aaruy: after a restart the reservoir change goes on after the rewind,…
MilosKozak Nov 7, 2026
764e8ef
Aaruy: keep only what the pump cannot tell again after a restart, pho…
MilosKozak Nov 7, 2026
0a93632
Aaruy: bolus step waits for the pump, daily totals have the pump date…
MilosKozak Nov 7, 2026
f5605f0
Pump unit rate text uses the digits of the driver, not of the concent…
MilosKozak Nov 7, 2026
a3e0f22
Aaruy: a daily total shows the local start and end of the pump day
MilosKozak Nov 7, 2026
591e446
Temp basal texts show every rate the pump can run, also the main scre…
MilosKozak Nov 7, 2026
aa06d0b
Merge remote-tracking branch 'origin/dev' into aaruy
MilosKozak Nov 7, 2026
f6af000
Aaruy: a settings answer of the pump is not written again
MilosKozak Nov 8, 2026
f1db9ed
Aaruy: a time zone change sends the moved profile at once
MilosKozak Nov 8, 2026
dbf2e1d
Merge branch 'dev' into aaruy
MilosKozak Nov 8, 2026
ef70b0a
Merge branch 'dev' into aaruy
MilosKozak Nov 8, 2026
e40c5c6
Aaruy: the emulator takes the test hooks, and the pump scenarios run …
MilosKozak Nov 8, 2026
052ce67
Pump scenarios: stop the driver at the end of a test, so its service …
MilosKozak Nov 8, 2026
8007fe9
Pump scenarios: a reload checks the pairing, and a skipped test stops…
MilosKozak Nov 8, 2026
b4d8128
Pump scenarios: a status read step waits for the one a driver start sent
MilosKozak Nov 8, 2026
befe8df
Aaruy: a bolus start the pump never had is set to 0 U from the pump log
MilosKozak Nov 8, 2026
b2240a1
Aaruy: the unanswered bolus start is decided whichever comes last, th…
MilosKozak Nov 8, 2026
3dbf764
Aaruy: log how the unanswered bolus start is decided
MilosKozak Nov 8, 2026
6d81abf
Aaruy: a bolus stored before the start was sent is an earlier bolus
MilosKozak Nov 8, 2026
8804a20
Merge branch 'dev' into aaruy
MilosKozak Nov 8, 2026
b37d01f
Merge remote-tracking branch 'origin/dev' into aaruy
MilosKozak Nov 9, 2026
4692e7b
Aaruy UI test: pair, history, reservoir change and unpair through the…
MilosKozak Nov 9, 2026
5570503
Aaruy: the queue's status read ends when the pump's answer is in the …
MilosKozak Nov 9, 2026
366d89a
Merge branch 'dev' into aaruy
MilosKozak Nov 9, 2026
2dc9404
Aaruy: the link is reported up when the pump has told its sequence, s…
MilosKozak Nov 9, 2026
c5c2753
Aaruy: frames the pump refused for their number go out again, as its …
MilosKozak Nov 9, 2026
f4f5cb5
Aaruy: scan through the transport like the other pumps, no emulator c…
MilosKozak Nov 9, 2026
bf6300c
Scenario: a lost bolus start may be sent again, the result must match…
MilosKozak Nov 9, 2026
d6c32b6
Aaruy: remove the device name kept at connect, nothing ever read it
MilosKozak Nov 9, 2026
1f3d19b
Aaruy: settings go to the pump only when it takes them, after a cance…
MilosKozak Nov 9, 2026
794caf5
Merge remote-tracking branch 'origin/dev' into aaruy
MilosKozak Nov 9, 2026
1498604
Aaruy: its radio code against the shared Bluetooth contract
MilosKozak Nov 9, 2026
64baaa1
Merge origin/dev into aaruy: DanaR coverage, the loop's temp basals f…
MilosKozak Nov 11, 2026
03b0de1
Aaruy emulator: the extended bolus commands of the scenarios are neve…
MilosKozak Nov 11, 2026
56bb542
Pump scenarios: a lost temp basal may be sent again, a low one so the…
MilosKozak Nov 11, 2026
4c25b5e
Aaruy scenarios: no bolus or stop on the patch, and no pump clock off…
MilosKozak Nov 11, 2026
54f433b
Aaruy: a temp basal the driver gave up on is never sent again, so a f…
MilosKozak Nov 11, 2026
db3afa7
Merge origin/dev into aaruy: Dana RS emulator answer order, LoopTest …
MilosKozak Nov 11, 2026
068c2f7
CI: Aaruy scenario part time from its first green run
MilosKozak Nov 11, 2026
1f1ae47
Merge origin/dev into aaruy: DanaR writes with no answer, profile wri…
MilosKozak Nov 11, 2026
aa1021b
Merge origin/dev into aaruy: Diaconn on the BLE transport, Dana round…
MilosKozak Nov 12, 2026
6a1a97b
Aaruy: the status read after a bolus with no answer is queued before …
MilosKozak Nov 12, 2026
a8bab86
Aaruy: one more pump fault the vendor reports
MilosKozak Nov 17, 2026
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
2 changes: 2 additions & 0 deletions .circleci/scenario-worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ part_seconds() {
DanaRv2ScenarioTest) echo 445 ;;
DanaRScenarioTest) echo 410 ;;
CarelevoScenarioTest) echo 360 ;;
# On the aaruy branch only; measured on CircleCI 42455.
AaruyScenarioTest) echo 325 ;;
DanaRKoreanScenarioTest) echo 295 ;;
DanaRSScenarioTest) echo 240 ;;
*) echo 999 ;;
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ android {
// Dana RS are separate keys so either one can be removed alone; `dana/common` holds the base
// class both use and needs only :pump:dana:common.
val pumpTestSources = mapOf(
":pump:aaruy" to "src/androidTestPumps/aaruy/kotlin",
":pump:carelevo" to "src/androidTestPumps/carelevo/kotlin",
":pump:dana:common" to "src/androidTestPumps/dana/common/kotlin",
":pump:dana:danar" to "src/androidTestPumps/dana/danar/kotlin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,22 @@ abstract class AbstractPumpScenarioTest {
scenario.checkBolusRecords()
}

/** The start never reached the pump. AAPS must not count insulin that was not given. */
/**
* The start never reached the pump. AAPS must not count insulin that was not given. A driver may find out that the
* start was lost while it still waits for it, and send it again, as Aaruy does when the pump's count shows it. Then
* the pump gives it, and the result must say so.
*/
@Test
fun aBolusStartThatIsLostGivesNoRecord() {
fun aLostBolusStartIsCountedAsThePumpDid() {
scenario.bringUp()
scenario.pair()
assertWithMessage("fault").that(scenario.control.loseCommand(EmulatedCommand.BOLUS_START)).isTrue()

assertWithMessage("bolus").that(scenario.bolus(BOLUS).success).isFalse()
val result = scenario.bolus(BOLUS)
scenario.awaitTrue("the pump ended the bolus", PumpScenario.BOLUS_TIMEOUT) { !scenario.control.state().bolusRunning }
scenario.readStatus()

assertWithMessage("the pump gave nothing").that(scenario.control.state().boluses).isEmpty()
assertWithMessage("success when the pump gave it").that(result.success).isEqualTo(scenario.control.state().boluses.isNotEmpty())
// A driver that cannot tell at once counts the whole amount, and decides from the pump once the bolus would have ended.
scenario.checkBolusRecords(PumpScenario.BOLUS_TIMEOUT)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package app.aaps.e2e

import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelStore
import app.aaps.core.interfaces.configuration.ExternalOptions
import app.aaps.core.interfaces.pump.emulator.PumpEmulatorControl
import app.aaps.core.interfaces.pump.emulator.PumpEmulators
import app.aaps.di.testGraphs
import app.aaps.e2e.scenario.PumpScenario
import app.aaps.e2e.scenario.PumpUnderTest
import app.aaps.pump.aaruy.AaruyPlugin
import app.aaps.pump.aaruy.comm.aaruyFrameKey
import app.aaps.pump.aaruy.compose.AaruyPairStep
import app.aaps.pump.aaruy.compose.AaruyPairWizardViewModel
import app.aaps.pump.aaruy.di.AaruyAccessors
import app.aaps.pump.aaruy.emulator.AaruyPumpEmulator
import app.aaps.pump.aaruy.services.AaruyUnpairCommand
import kotlinx.coroutines.runBlocking

/**
* The Aaruy pump for [PumpScenario]. It is paired as the wizard does it, with the wizard's own ViewModel from the
* app's factory and no screen: scan, pick the pump, wait for the link. The emulated pump needs no button press.
*/
class AaruyPumpUnderTest : PumpUnderTest {

override val emulatorOption = ExternalOptions.EMULATE_AARUY
override val pluginName: String = AaruyPlugin::class.java.simpleName

/**
* A status read: status and battery, the settings, the time, the log, the daily totals. 11 to 16 were seen. A burst
* writes several times a second for as long as the link is up, so this is far below one.
*/
override val maxCommandsPerStatusRead = 20

private val accessors get() = testGraphs.rootGraph as AaruyAccessors

override fun control(): PumpEmulatorControl = checkNotNull(accessors.aaruyBle.emulatorTransport) { "The Aaruy emulator is not active" }

/** The plugin's start binds its service, which every queue command needs. Private, so it is read as the plugin tests do. */
override fun awaitStarted(scenario: PumpScenario) {
val field = AaruyPlugin::class.java.getDeclaredField("aaruyService").apply { isAccessible = true }
scenario.awaitTrue("the Aaruy service is bound") { field.get(accessors.aaruyPlugin) != null }
}

override fun pair(scenario: PumpScenario) {
val viewModels = ViewModelStore()
try {
lateinit var wizard: AaruyPairWizardViewModel
scenario.onMain { wizard = ViewModelProvider(viewModels, testGraphs.viewModelFactory).get(AaruyPairWizardViewModel::class.java) }
// A profile switch is stored already, so the wizard starts at the scan.
scenario.awaitTrue("the wizard is at the scan") { wizard.step.value == AaruyPairStep.BLE_SCAN }
scenario.onMain { wizard.startScan() }
scenario.awaitTrue("the emulated pump is found") { wizard.devices.value.isNotEmpty() }
scenario.onMain { wizard.selectDevice(wizard.devices.value.first()) }
scenario.awaitTrue("the pump is paired", PAIR_TIMEOUT) { wizard.step.value == AaruyPairStep.COMPLETE }
scenario.awaitQueueIdle()
scenario.awaitTrue("the pump is ready") { testGraphs.activePlugin.activePump.isInitialized() }
} finally {
scenario.onMain { viewModels.clear() }
}
}

/** As the overview's unpair: through the queue, then the pump is forgotten. */
override fun unpair(scenario: PumpScenario) {
val result = runBlocking { scenario.commandQueue.customCommand(AaruyUnpairCommand()) }
check(result.success) { "Unpair failed: ${result.comment}" }
scenario.awaitQueueIdle()
scenario.awaitTrue("no pump is paired") { !accessors.aaruyPlugin.isConfigured() }
}

override fun restoreEmulator(saved: ByteArray, emulators: PumpEmulators) {
emulators.getOrCreate(AaruyPumpEmulator.KEY) { AaruyPumpEmulator.restore(saved, keyProvider = { aaruyFrameKey() }) }
}

private companion object {

/** A real pump needs its button, so the driver tries again after 30 s. The emulator answers at once. */
const val PAIR_TIMEOUT = 60_000L
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package app.aaps.e2e

import androidx.test.ext.junit.runners.AndroidJUnit4
import app.aaps.e2e.scenario.AbstractPumpScenarioTest
import app.aaps.e2e.scenario.PumpUnderTest
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith

/** The Aaruy driver against its emulator, through the real command queue. See [AbstractPumpScenarioTest]. */
@RunWith(AndroidJUnit4::class)
class AaruyScenarioTest : AbstractPumpScenarioTest() {

override fun pumpUnderTest(): PumpUnderTest = AaruyPumpUnderTest()

@Ignore("An Aaruy patch has no display: whether its one button can give a bolus was not looked at, so the emulator gives none")
@Test
override fun aBolusGivenOnThePumpIsImported() {
}

@Ignore("An Aaruy patch has no display: whether its one button can stop the insulin was not looked at, so the emulator does not")
@Test
override fun aSuspendOnThePumpIsRecorded() {
}

@Ignore("The Aaruy emulator keeps its pump clock on the phone clock: a clock that is off is not emulated yet")
@Test
override fun aBolusWithThePumpClockOffIsStoredAtItsTime() {
}
}
72 changes: 72 additions & 0 deletions app/src/androidTestPumps/aaruy/kotlin/app/aaps/e2e/AaruyUiTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package app.aaps.e2e

import app.aaps.e2e.ScreenDriver.Companion.COMMAND_TIMEOUT
import app.aaps.e2e.scenario.PumpScenario
import app.aaps.e2e.scenario.PumpUnderTest
import app.aaps.e2e.ui.AbstractPumpUiTest
import app.aaps.e2e.ui.PumpScreens
import app.aaps.pump.aaruy.emulator.AaruyEmulatorBleTransport
import com.google.common.truth.Truth.assertWithMessage

/** The Aaruy screens, see [AbstractPumpUiTest]. */
class AaruyUiTest : AbstractPumpUiTest() {

override fun pumpUnderTest(): PumpUnderTest = AaruyPumpUnderTest()
override fun screens(): PumpScreens = AaruyScreens
}

/**
* The Aaruy overview and its flows: pairing (BLE_SCAN → PRESS_BUTTON → COMPLETE; the emulated pump needs no button
* press), the history with its type list, the reservoir change (REWIND → ASSEMBLE → PRIME with the droplets question →
* CONNECT → FILL_CANNULA → DONE) and the unpair with its question. The pump has no stop button of its own: it stops only
* inside the reservoir change.
*
* Several button labels are also part of a sentence on the same step ("press Rewind", "press Fill cannula"), so command
* buttons are tapped with [ScreenDriver.clickButton].
*/
object AaruyScreens : PumpScreens {

override val unpairedMark = "Pair"
override val pairedMark = "Unpair"

override fun pair(screen: ScreenDriver, scenario: PumpScenario) {
// The scan starts by itself and shows the emulated pump.
screen.openVia(unpairedMark, expect = AaruyEmulatorBleTransport.DEVICE_NAME)
screen.click(AaruyEmulatorBleTransport.DEVICE_NAME) // pairs
screen.waitForVisibleOrThrow("Pump paired", COMMAND_TIMEOUT) // COMPLETE
screen.clickButton("OK")
}

override fun visitHistory(screen: ScreenDriver): Boolean {
screen.openVia("Pump history", expect = "Bolus", exact = true) // the first type of the list
screen.click("Bolus") // opens the list
screen.click("Daily totals")
screen.waitForExactOrThrow("Daily totals")
return true
}

/** A new reservoir: the pump stops at the rewind, and basal runs again after the cannula is filled. */
override fun otherFlows(screen: ScreenDriver, scenario: PumpScenario) {
screen.openVia("Change reservoir", expect = "then press Rewind") // REWIND
screen.clickButton("Rewind")
screen.assertVisibleContains("a reservoir filled with insulin", COMMAND_TIMEOUT) // ASSEMBLE
screen.openVia("Next", expect = "until droplets come out") // PRIME
screen.clickButton("Prime")
// "Next" is enabled once the pump says the prime is done; it only asks about the droplets.
screen.openVia("Next", expect = "Did droplets come out", attempts = 3)
screen.clickButton("OK")
screen.assertVisibleContains("Connect the infusion set") // CONNECT
screen.openVia("Next", expect = "then press Fill cannula") // FILL_CANNULA
screen.clickButton("Fill cannula")
screen.assertVisibleContains("Reservoir change finished", COMMAND_TIMEOUT) // DONE
screen.clickButton("OK")
screen.waitForExactOrThrow(pairedMark, COMMAND_TIMEOUT)
assertWithMessage("basal runs after the reservoir change").that(scenario.control.state().suspended).isFalse()
}

override fun unpair(screen: ScreenDriver, scenario: PumpScenario) {
screen.clickButton(pairedMark)
screen.assertVisibleContains("Unpair the pump")
screen.clickButton("OK") // through the queue, the pump is told
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class PersistentNotificationPlugin(
}
val activeTemp = processedTbrEbData.getTempBasalIncludingConvertedExtended(System.currentTimeMillis())
line1 += if (activeTemp != null) {
" • " + activeTemp.toStringShort(rh) + " "
" • " + activeTemp.toStringShort(rh, pump.pumpDescription.tempAbsoluteFormat) + " "
} else {
" • " + rh.gs(CoreUiR.string.pump_base_basal_rate, ch.fromPump(pump.baseBasalRate)) + " "
}
Expand Down
19 changes: 19 additions & 0 deletions app/src/testFull/resources/prefs-schema.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,18 @@ insulin_concentration_enabled|BooleanKey|true
insulin_configuration|StringNonKey|true
iob_threshold_percent|IntKey|true
keep_screen_on|BooleanKey|true
key_aaruy_active_alarms|AaruyStringKey|false
key_aaruy_address|AaruyStringKey|true
key_aaruy_bolus_amount_to_be_delivered|AaruyDoubleKey|false
key_aaruy_bolus_start_time|AaruyLongKey|false
key_aaruy_last_connection|AaruyLongKey|false
key_aaruy_last_delivery_end|AaruyLongKey|false
key_aaruy_last_historyDailyTime|AaruyLongKey|false
key_aaruy_last_historyTime|AaruyLongKey|false
key_aaruy_name|AaruyStringKey|true
key_aaruy_save_history|AaruyBooleanKey|false
key_autotune_last_run|AutotuneStringKey|true
key_binded_address|AaruyStringKey|false
key_bolus_storage|StringNonKey|false
key_equil_alarm_battery_10|EquilBooleanKey|true
key_equil_alarm_battery_5|EquilBooleanKey|true
Expand All @@ -254,6 +265,8 @@ key_equil_pair_password|EquilStringKey|true
key_equil_password|EquilStringKey|true
key_equil_state1|EquilStringKey|true
key_equil_tone|EquilIntPreferenceKey|true
key_param_pump_type|AaruyIntKey|true
key_param_soft_needle_type|AaruyIntKey|true
key_reset_boluswizard_percentage_time|IntKey|true
key_usersuperbolus|BooleanKey|true
language|StringKey|true
Expand Down Expand Up @@ -393,6 +406,12 @@ patch_primed_flag|MedtrumBooleanNonKey|true
patch_start_time|MedtrumLongNonKey|true
patient_name|StringKey|true
pp_ISF_weight|DoubleKey|true
pref_aaruy_bolus_step|AaruyIntPreferenceKey|true
pref_aaruy_low_alert|AaruyDoublePreferenceKey|true
pref_aaruy_max_basal|AaruyDoublePreferenceKey|true
pref_aaruy_max_bolus|AaruyDoublePreferenceKey|true
pref_aaruy_sound_alarm|AaruyIntPreferenceKey|true
pref_aaruy_sound_remind|AaruyIntPreferenceKey|true
pref_medtronic_battery_type|MedtronicStringPreferenceKey|true
pref_medtronic_bolus_delay|MedtronicIntPreferenceKey|true
pref_medtronic_encoding|RileyLinkStringPreferenceKey|true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum class ManufacturerType(val description: String) {
G2e("G2e"),
Eoflow("Eoflow"),
CareMedi("CareMedi"),
Equil("Equil");
Equil("Equil"),
Aaruy("Aaruy");

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ enum class PumpCapability {
DiaconnCapabilities(arrayOf(Capability.Bolus, Capability.ExtendedBolus, Capability.TempBasal, Capability.BasalProfileSet, Capability.Refill, Capability.ReplaceBattery, Capability.TDD, Capability.ManualTDDLoad)), //
EopatchCapabilities(arrayOf(Capability.Bolus, Capability.ExtendedBolus, Capability.TempBasal, Capability.BasalProfileSet, Capability.BasalRate30min)),
MedtrumCapabilities(arrayOf(Capability.Bolus, Capability.TempBasal, Capability.BasalProfileSet, Capability.BasalRate30min, Capability.TDD)), // Technically the pump supports ExtendedBolus, but not implemented (yet)
// No extended bolus: the pump has one, but while it runs the pump takes no temp basal and no bolus, so the loop could not work.
AaruyCapabilities(arrayOf(Capability.Bolus, Capability.TempBasal, Capability.BasalProfileSet, Capability.Refill, Capability.ReplaceBattery)),
AaruyBaseCapabilities(arrayOf(Capability.Bolus, Capability.TempBasal, Capability.BasalProfileSet, Capability.Refill, Capability.ReplaceBattery)),
CarelevoCapabilities(arrayOf(Capability.Bolus, Capability.ExtendedBolus, Capability.TempBasal, Capability.BasalProfileSet, Capability.BasalRate30min)),

// Diaconn set without ReplaceBattery: the Equil wizard fits the charged battery.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package app.aaps.core.data.pump.defs

import app.aaps.core.data.format.NumberFormat
import app.aaps.core.data.format.NumberRounding
import kotlin.math.round

class PumpDescription {

var pumpType = PumpType.GENERIC_AAPS
Expand All @@ -15,6 +19,11 @@ class PumpDescription {
var tempPercentStep = 0
var maxTempAbsolute = 0.0
var tempAbsoluteStep = 0.0

/** Shows every rate this pump can run. A step of 0.025 needs 3 digits, or 0.275 U/h looks like 0.28 U/h. */
val tempAbsoluteFormat: NumberFormat
get() = NumberFormat(minFractionDigits = 2, maxFractionDigits = if (round(tempAbsoluteStep * 1000).toLong() % 10 != 0L) 3 else 2, rounding = NumberRounding.HALF_UP)

var tempDurationStep = 0
var tempDurationStep15mAllowed = false
var tempDurationStep30mAllowed = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,40 @@ enum class PumpType(
maxReservoirReading = 200,
source = Source.EQuil,
useHardwareLink = true,
),
AARUY_FULL(
description = "Aaruy Full",
manufacturer = ManufacturerType.Aaruy,
model = "Full",
bolusSize = 0.025,
specialBolusSize = null,
extendedBolusSettings = DoseSettings(0.025, 30, 8 * 60, 0.025),
pumpTempBasalType = PumpTempBasalType.Absolute,
tbrSettings = DoseSettings(0.025, 30, 12 * 60, 0.0, 35.0),
specialBasalDurations = arrayOf(Capability.BasalRate_Duration30minAllowed),
baseBasalMinValue = 0.1,
baseBasalMaxValue = 35.0,
baseBasalStep = 0.025,
baseBasalSpecialSteps = null,
pumpCapability = PumpCapability.AaruyCapabilities,
source = Source.AaruyFull,
),
AARUY_BASE(
description = "Aaruy Base",
manufacturer = ManufacturerType.Aaruy,
model = "Base",
bolusSize = 0.025,
specialBolusSize = null,
extendedBolusSettings = DoseSettings(0.025, 30, 8 * 60, 0.025),
pumpTempBasalType = PumpTempBasalType.Absolute,
tbrSettings = DoseSettings(0.025, 30, 12 * 60, 0.0, 35.0),
specialBasalDurations = arrayOf(Capability.BasalRate_Duration30minAllowed),
baseBasalMinValue = 0.1,
baseBasalMaxValue = 35.0,
baseBasalStep = 0.025,
baseBasalSpecialSteps = null,
pumpCapability = PumpCapability.AaruyBaseCapabilities,
source = Source.AaruyBase,
);

fun manufacturer() = parent?.manufacturer ?: manufacturer ?: throw IllegalStateException()
Expand Down Expand Up @@ -540,6 +574,8 @@ enum class PumpType(
VirtualPump,
Unknown,
EQuil,
AaruyFull,
AaruyBase,
Carelevo
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ enum class Sources {
NSProfile, //From NSProfile plugin
Objectives, //From Objectives plugin
Pump, //To update with one Source per pump
AaruyFull,
AaruyBase,
Dana, //Only one UserEntry in Common module Dana
DanaR,
DanaRC,
Expand Down
Loading
Loading