Johannes Mockenhaupt
485b99e260
Show last command and pump state better in the Combo tab.
...
Gets rid of unhelpful "Unknown error" messaegs.
2017-07-19 01:33:19 +02:00
Johannes Mockenhaupt
5aacf8410d
Fix CancelTbrCommand to return command resutlt not in PumpState but as part of the CommandResult object.
2017-07-19 01:30:26 +02:00
Johannes Mockenhaupt
9927ab4989
Raise an error upon attempting to cancel a TBR when none is active.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
3b287df77d
Check active menu again when retrying inputs.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
abf9566476
Log exception
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
ebe14fb0cf
BolusCommand: deal with blinking values.
...
How did this not trigger with all the boluses I've issued so far?
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
7fe9ad7910
Add retries for inputing values.
...
Rarely there seem to be timing issues and e.g.
10 button down presses to go from 100% to 0% only goes down to 20%.
Retry two more times in that case, restarting the input process on the
active screen (bolus input, tbr percent/duration input).
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
e52c2a857c
RuffyScripter: log command execution time.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
7dda253b88
RuffyScripter: when pump is suspended fail all commands but ReadPumpState.
...
Safest way for v1 (which I'm trying to stabilize, not rework ;-) ).
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
bd14b399d5
Comment.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
55e7006967
Remove superfluous code (state is always set later in controlling thread).
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
02a9ed6eda
Set an active command before establishing a connection.
...
Otherwise the disconnect thread will close the connection
due to inactivity. We could add a variable 'isConnecting',
but I'm not sure if adding another (ruffy-) global state
variable will make things simpler to grasp.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
c37310685a
Don't count the time establishing a connection towards a command timeout.
...
Note: connection timeouts are also dealt with. They're now (cleanly)
separated: connect- and command-timeouts.
If the pump's display is one due to the user interacting with the pump
directly, the pump needs a display timeout before being ready for an
incoming connection. What I'm trying to say is, it might take some time,
maybe up to 30s to establish a connection in that cause and can thus
easily create a false timeout error.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
36966c8907
Handle the pump being stopped: don't treat it like an error, but don't execute commands either.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
af4ec4d072
BolusCommand: fix contstraint check (doh!)
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
5f43f0f147
* Fix stale data in Combo tab after error
...
* Add info about last command ran to the Combo tab
* Don't refresh data more than once a minute.
* Specify not only error, but also command that raised the error in
alert notification
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
ac10bdc01c
First stab at dynamic timeout.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
44ae79bd50
Move command argument checking out of ctor into a dedicated method and check prior to execution.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
5fad9b3a85
Cleanups.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
20a8350c67
Robustness for RuffyScripter.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
c131280e91
RuffyScripter.verifyMenuIsDisplayed: don't call waitForMenuUpdate, menu should already be displayed. If not, wait up to 1 second.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
362c3681d5
Clean up commands package.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
c63c86f98a
RuffyScripter improvements:
...
* Keep track of connection status rather than relying in IRuffyService.isConnected
* Abort running command if pump stops sending menu updates
* Fail if ruffy goes away (binding becomes invalid), currently only if this happens during disconnect attempts
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
52b9621e29
Paranoia: check we're in the expected menu before each and every button press.
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
d619796019
Improving pump status in the UI (combo tab)
2017-07-18 21:20:40 +02:00
Johannes Mockenhaupt
f7586268c7
Dead code be gone.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
93c0147b23
RuffyScripter: take over connection management. Disconnect after 5s of inactivity. Plus some fixes.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
2ddccd3c31
RuffyScripter.runCommand: Next shot at understanding threading better.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
4c0944b9f8
Optimize cancelling TBR.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
8ecf6922f7
Misc improvements:
...
* Make command execution (RuffyScripter/ComoboPlugin.runCommand) more robust (I still suck at threading).
* Return all possible states in PumpState
* Add absolute TBR to PumpState
* Add NoOpCommand to fetch state data from pump
* Display returned pump state in Combo fragment/tab.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
f251427d1b
Remove ReadStateCommand, all state will be return through the PumpState field on CommandResult, so it's passed back after every command.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
ec6491fcb7
Return absolute TBR rate in PumpState.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
69b98c54c6
Polish.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
9653af5501
RuffyScripter.navigateToMenu: detect if we're wrapping around not finding a menu (likely because it's hidden)
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
7e538cbcf6
Update PumpState s/errorCode/errorMsg/g
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
99830b05b6
Fix detecting error state on connection and fix cancelling TBR.
...
When there's an error, timing is crucial. Waiting for the blinking error code
to be readable hangs the thread running the command.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
4ff81e885c
Simplify reading alerts (message doesn't blink)
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
e01e85c54f
On connect, check if pump is in an error state.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
d0dabf34da
Fix handling TBR CANCELLED alert, remove ill-advised attempts to fake a command queue and have all commands return a state object.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
952aa0e8a2
RuffyScripter.waitForMenuToBeLeft: add timeout.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
d8011aeaa4
Make cancelling TBR more robust to dismiss TBR cancelled alert specifially and only if it is raised.
...
Cancelling a TBR with a runtime < 60s (0:01 in the display) does NOT raise a TBR cancelled alert.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
2c706e7c22
Remove status logging in Ruffy, now done by command.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
f5ef666061
Add timestamp to State and rename to PumpState.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
9d8d12fcb9
Cleanups.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
e76524a539
Include state in CommandResult.toString.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
375eb46695
ReadStateCommand: properly read TBR %.
2017-07-18 21:20:39 +02:00
Johannes Mockenhaupt
fa039e6961
Note on cancelling TBRs that don't trigger a pump alert.
2017-07-18 21:20:18 +02:00
Johannes Mockenhaupt
0345a01fc1
Make CancelTbrCommand more robust.
2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt
5631488cc8
Add ReadStateCommand.
2017-07-18 20:59:56 +02:00
Johannes Mockenhaupt
a2b3c26b33
Log pump status on connect.
2017-07-18 20:59:56 +02:00