Commit graph

52 commits

Author SHA1 Message Date
Carlos Rafael Giani d280a2bec5 comboctl-main: Allow fetching TDDs while the pump is suspended
There is no good reason for disallowing TDD retrieval while the Combo
is suspended - the TDD history screens are accessible, and TDD retrieval
does not cause any insulin delivery to take place.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-03-22 08:53:21 +01:00
Milos Kozak 438f384c67 lints 2023-03-16 18:36:47 +01:00
Carlos Rafael Giani 9979331ef0 comboctl-parser: Fix typo in E2BatteryEmptyErrorScreenParsing test
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-03-13 21:46:31 +01:00
Carlos Rafael Giani cc4cd2dc04 comboctl-parser: Don't try to interpret text in error screens
That text shows contents that are different to that of warning screens.
Instead of extending the interpretation logic to cover such contents as
well, just use a generic ERROR_TEXT AlertScreenState. That text won't
be interpreted by any program logic anyway, since error screens are
never dismissed automatically.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-03-12 22:40:54 +01:00
Carlos Rafael Giani c1058ad113 comboctl-android: Check that the adapter is available and enabled
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-03-11 19:00:25 +01:00
Carlos Rafael Giani 72819cbc53 comboctl-base: Add exceptions for disabled and missing Bluetooth adapters
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-03-11 19:00:25 +01:00
Carlos Rafael Giani 2cdc4c45ea comboctl-parser: Add Lithuanian support
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-03-11 19:00:25 +01:00
Carlos Rafael Giani 3f3884e513 comboctl-parser: Handle percent symbol in some TBR percentage screens
Some TBR percentage screens like the Lithuanian one show a % symbol
right after the text. Add an optional symbol parser to handle it.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-03-11 19:00:25 +01:00
Carlos Rafael Giani dbe72e72da comboctl-parser: Add Slovenian support
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-03-11 19:00:25 +01:00
Carlos Rafael Giani d2c0aba2b5 comboctl-main: Improve alert screen handling
* Check if the alert screen is the confirm or snooze screen, and press
  the CHECK button once or twice accordingly. This avoids fringe cases
  where the amount of button presses is incorrect.
* In rare cases, more alert screens may show up after dismissing the
  current one. Add code to keep observing remaining alerts and redo
  the dismissing logic after a while if necessary.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-03-11 19:00:25 +01:00
Carlos Rafael Giani 76dec4aad6 comboctl-parser: Also parse text in alert screens
This helps with distinguishing the "snooze" and "confirm" screens.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-03-11 19:00:25 +01:00
Carlos Rafael Giani 82bdb4df9a comboctl-main: Use the standard bolus' total amount as its immediate amount
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-02-09 18:50:27 +01:00
Carlos Rafael Giani 409852685e comboctl-base: Fix PumpIOTest
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-03 13:35:30 +01:00
Carlos Rafael Giani 4bb163a633 comboctl-main: Support extended/multiwave bolus in Pump.deliverBolus()
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-02 19:21:26 +01:00
Carlos Rafael Giani 83dce8bee3 comboctl-base: Handle ext/multiwave bolus in PumpIO.deliverCMDStandardBolus
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-02 19:21:26 +01:00
Carlos Rafael Giani 05674ba552 comboctl-base: Support automatic extended/multiwave boluses in history
When delivering extended and multiwave boluses through the command mode,
the boluses are marked as "automatic" by the Combo, and use different IDs
compared to extended/multiwave boluses that were initiated through the
remote terminal mode. Add support for these IDs, and extend the
CMDHistoryEventDetail subclasses for extended and multiwave boluses with
a field that specifies whether the bolus was manual or automatic.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-02 19:21:26 +01:00
Carlos Rafael Giani 916b847b21 comboctl-base: Add support for creating extended/multiwave bolus packets
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-02 19:21:26 +01:00
Carlos Rafael Giani 22a144416b comboctl-main: Parse ext bolus main screen instead of throwing exception
To support extended and multiwave boluses in the future, it is necessary
to properly parse the main screen when it shows extended/multiwave
content. This requires some rework. Most notably, the code needs to be
changed to no longer throw ExtendedOrMultiwaveBolusActiveException.

One problem with extended/multiwave content on the main screen is that
it does not show TBR details (percentage & remaining duration). For this
reason, it is necessary to actually navigate to the TBR percentage screen
and read those value there. This means that the setTbr() call is slower
when an extended/multiwave bolus is ongoing, but better to be slower than
to omit post-setTbr checks that may catch rare errors.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-02 19:21:26 +01:00
Carlos Rafael Giani 7f6f63bcf4 comboctl-main: Always move past skipped screens in navigateToRTScreen()
Without this, navigation gets stuck if an unrecognized screen
is encountered.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-02 19:21:26 +01:00
Carlos Rafael Giani 9af5499d70 comboctl-base: Rename CMDBolusType to CMDImmediateBolusType
This name is less confusing, especially if another enum class for the
bolus delivery is about to be introduced.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-02 19:21:26 +01:00
Carlos Rafael Giani 7598ae758c comboctl-parser: Fix battery in ExtendedAndMultiwaveBolusMainScreenParser
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-02 19:21:26 +01:00
Carlos Rafael Giani 8d9e5cc833 comboctl: Apply ktlint based fixes
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2023-01-02 19:21:22 +01:00
Carlos Rafael Giani 16a3b74f50 comboctl-main: Fix getBasalProfile() progress report and screen counting
The previous behavior was reading the profile correctly, but the progress
report was off by one factor. Also, blinking screens were considered as
separate ones, causing the short button press based fallback to kick in
unnecessarily often because that blinking screen behavior caused the
main long button press based reading loop to miss the last profile factor.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-12-10 19:18:30 +01:00
Carlos Rafael Giani e06ecaa7d8 comboctl-android: Remove some obsolete / unnecessary / solved TODOs
* device is unpaired while discovery is ongoing" does not happen because
  discovery only occurs if no device is paired.
* Using the second offered BluetoothDevice works reliably on all tested
  phones so far.
* AndroidBluetoothDevice throws a BluetoothException if all of its
  internal connect attempts fail.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-12-10 18:49:12 +01:00
Carlos Rafael Giani 6ecc1073df comboctl-main: Finish reading profile by pressing BACK to avoid vibration
When exiting the basal profile screens by pressing CHECK twice, a
vibration happens. This can be avoided by instead pressing BACK until
the main screen is reached.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-12-10 17:34:53 +01:00
Milos Kozak 53e29aaf33 minor cleanup 2022-12-09 14:21:28 +01:00
Carlos Rafael Giani ad381e3c26 comboctl: main: Improvements to Pump.setTbr()
* Don't set a fake 100% TBR again if the current fake 100% TBR
  is finished within 15 minutes (reduces number of TBR operations
  and allows the Combo to return to a non-TBR state).
* If the expected TBR percentage was a non-100% one, but not we see
  a non-TBR main screen, check if the expected TBR duration was <= 2
  minutes. This covers the edge case when the TBR ends at the same
  time when we run this check.
* Inform callers about the exact outcome of the setTbr() call. It could
  be that it set the TBR normally. Or, it might have set a fake 100% TBR
  (if the user requested a 100% TBR and force100Percent was set to false),
  and so on.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-12-07 12:38:59 +01:00
Carlos Rafael Giani 14c39ee05e Fix comboctl unit test integration
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-12-07 12:38:59 +01:00
Carlos Rafael Giani aa595fefcb combov2: Integrate comboctl unit tests
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-12-05 20:43:48 +01:00
Milos Kozak ff9cbe2cb0 Non transitive R classes 2022-12-02 10:56:11 +01:00
Milos Kozak 2b5e51c857 code cleanup 2022-11-30 19:30:46 +01:00
Carlos Rafael Giani b029814de5 comboctl-main: Adjust pump's local datetime when timezones change
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-28 14:19:01 +01:00
Milos Kozak ae52eb3402 resolve deprecation warnings 2022-11-27 22:42:33 +01:00
Carlos Rafael Giani 1131ad1195 comboctl-main: Refine waiting periods during long RT button press
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-25 00:26:32 +01:00
Carlos Rafael Giani 1e6b560199 combov2: Refer to correct comboctl source subdirectory in gradle script
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-25 00:26:30 +01:00
Carlos Rafael Giani ede5ad1cda comboctl-main: Rename variables such that currentQuantity is not shadowed
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-25 00:26:21 +01:00
Carlos Rafael Giani 5745e95244 Update combov2 code to match recent changes in dev branch
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-21 19:58:29 +01:00
Carlos Rafael Giani 90480ab1d9 comboctl-main: Add more argument checks to Pump.connect()
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-20 23:04:30 +01:00
Carlos Rafael Giani 605fe04d74 comboctl-main: Check for unchanging screen type in navigateToRTScreen()
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-20 21:58:50 +01:00
Carlos Rafael Giani 2bde0f154d comboctl-main: Add and fix unit tests
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-20 18:59:21 +01:00
Carlos Rafael Giani 96c8145dc3 comboctl-main: During corrective short button presses check screens
After a long button press, short button presses may be necessary to
fix "overshoots". An alert screen may appear during those short button
presses, so look at the screens to make sure alerts are not missed.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-20 18:59:17 +01:00
Carlos Rafael Giani 8b2666ff74 comboctl-main: Only receive frames if long RT button press was skipped
The code in adjustQuantityOnScreen() needs an current quantity. This is
determined during the long button press. If no such long button press
happens, get the quantity by explicitly receiving parsed frames. But
don't read those parsed frames if a long button press happened; this
is redundant and just slows down the function.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-20 18:59:12 +01:00
Carlos Rafael Giani 03a32f09cf comboctl-main: Catch getParsedDisplayFrame() exceptions and rethrow later
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-20 18:59:08 +01:00
Carlos Rafael Giani 8d6171db49 comboctl-parser: Support main screens with ext/multiwave and TBR symbols
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-20 18:58:51 +01:00
Carlos Rafael Giani e9294c59a0 comboctl-parser: Parse remaining duration in TBR percentage screen
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-20 18:58:47 +01:00
Carlos Rafael Giani d50feec302 comboctl-main: Correctly handle alerts after bolus was delivered
In particular, if a bolus brings the reservoir level below the low
threshold, a W1 warning shows up on the pump itself during bolus delivery.
Once delivery is done, the W1 shows up in the RT mode as well. Bolus
delivery is special in that the deliverBolus() function has to manually
switch back to RT mode to get the reservoir level post-bolus to update
the reservoirLevel value. When that is done, the aforementioned alert
screen can show up. Add code to handle alert screen handling to that
special post-bolus check.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-19 13:56:01 +01:00
Carlos Rafael Giani 20d4a0c692 comboctl-main: Fix computeShortRTButtonPress() cyclic quantity bug
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-19 11:22:10 +01:00
Carlos Rafael Giani ced93e4a53 comboctl-main: Check if RT quantity adjustment hits an unexpected limit
This is important for example if the Combo is not properly configured
and the user tries to set a TBR percentage beyond the configured limit.
The RT UI will then clamp the percentage to that limit, and the quantity
won't increase anymore. Without this new check, this causes the code
to be stuck in an endless loop.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-10 19:21:02 +01:00
Carlos Rafael Giani c3c894cccb comboctl-main: Rework longPressRTButtonUntil() implementation
The new implementation overshoots less often, runs generally faster,
and correctly forwards exceptions thrown by the checkScreen callback.

Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-10 19:21:02 +01:00
Carlos Rafael Giani 01560f45be comboctl-main: Fix missing entry #1 in TDD history
Signed-off-by: Carlos Rafael Giani <crg7475@mailbox.org>
2022-11-06 00:13:43 +01:00