Disable reading history while incomplete.
This commit is contained in:
parent
550ed57ca5
commit
bffd1239c0
|
@ -234,7 +234,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
|
|
||||||
// TODO fuse the below into 'sync'? or make checkForTbrMismatch jut a trigger to issue a sync if needed; don't run sync twice as is nice
|
// TODO fuse the below into 'sync'? or make checkForTbrMismatch jut a trigger to issue a sync if needed; don't run sync twice as is nice
|
||||||
// checkForTbrMismatch();
|
// checkForTbrMismatch();
|
||||||
checkPumpHistory();
|
// checkPumpHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -582,21 +582,34 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
|
|
||||||
private synchronized CommandResult runCommand(String activity, CommandExecution commandExecution) {
|
private synchronized CommandResult runCommand(String activity, CommandExecution commandExecution) {
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
|
// danar has this is message on the overview screen, no?
|
||||||
pump.activity = activity;
|
pump.activity = activity;
|
||||||
MainApp.bus().post(new EventComboPumpUpdateGUI());
|
MainApp.bus().post(new EventComboPumpUpdateGUI());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO should probably specialize this:
|
||||||
|
// smb, tbr stuff can be retried.
|
||||||
|
// non-smb bolus shall be blocked if same amount already delivered within last 1 min
|
||||||
|
|
||||||
|
// i need a version of this which sets activity, updates local state etc and one
|
||||||
|
// which just does something, read history etc.
|
||||||
|
// retrying: separate r/o and r/w commands? flag for it?
|
||||||
|
|
||||||
// CommandResult precheck = ruffyScripter.readPumpState();
|
// CommandResult precheck = ruffyScripter.readPumpState();
|
||||||
// tbrcheck?
|
// tbrcheck?
|
||||||
// check for active alert; if warning confirm; on warning confirm, read history (bolus, errors), which shall raise alerts if appropriate
|
// check for active alert; if warning confirm; on warning confirm, read history (bolus, errors), which shall raise alerts if appropriate
|
||||||
//
|
//
|
||||||
// precheck.
|
// precheck.
|
||||||
|
// todo don't send out commands requining run mode if pump is suspended
|
||||||
|
//
|
||||||
|
|
||||||
CommandResult commandResult = commandExecution.execute();
|
CommandResult commandResult = commandExecution.execute();
|
||||||
pump.lastCmdResult = commandResult;
|
pump.lastCmdResult = commandResult;
|
||||||
pump.lastConnectionAttempt = System.currentTimeMillis();
|
pump.lastConnectionAttempt = System.currentTimeMillis();
|
||||||
if (commandResult.success) {
|
if (commandResult.success) {
|
||||||
pump.lastSuccessfulConnection = System.currentTimeMillis();
|
pump.lastSuccessfulConnection = System.currentTimeMillis();
|
||||||
|
} else {
|
||||||
|
// TODO set flag to force sync on next connect; try to run immediately? or would this make things worse and we should just wait till the next iteratio?L
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy over state (as supplied) so it will still be available when another command runs that doesn't return that data
|
// copy over state (as supplied) so it will still be available when another command runs that doesn't return that data
|
||||||
|
@ -694,6 +707,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sync) {
|
if (sync) {
|
||||||
|
// todo just return the PHR?
|
||||||
runFullSync(new PumpHistoryRequest().tbrHistory(System.currentTimeMillis() - 3 * 60 * 60 * 1000));
|
runFullSync(new PumpHistoryRequest().tbrHistory(System.currentTimeMillis() - 3 * 60 * 60 * 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class ReadHistoryCommand extends BaseCommand {
|
||||||
if (request.bolusHistory != PumpHistoryRequest.SKIP) {
|
if (request.bolusHistory != PumpHistoryRequest.SKIP) {
|
||||||
int totalRecords = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.TOTAL_RECORD);
|
int totalRecords = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.TOTAL_RECORD);
|
||||||
if (totalRecords > 0) {
|
if (totalRecords > 0) {
|
||||||
if (true || request.bolusHistory == PumpHistoryRequest.LAST) {
|
if (request.bolusHistory == PumpHistoryRequest.LAST) {
|
||||||
Bolus bolus = readBolusRecord();
|
Bolus bolus = readBolusRecord();
|
||||||
history.bolusHistory.add(bolus);
|
history.bolusHistory.add(bolus);
|
||||||
} else {
|
} else {
|
||||||
|
@ -58,7 +58,7 @@ public class ReadHistoryCommand extends BaseCommand {
|
||||||
if (request.pumpErrorHistory != PumpHistoryRequest.SKIP) {
|
if (request.pumpErrorHistory != PumpHistoryRequest.SKIP) {
|
||||||
int totalRecords = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.TOTAL_RECORD);
|
int totalRecords = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.TOTAL_RECORD);
|
||||||
if (totalRecords > 0) {
|
if (totalRecords > 0) {
|
||||||
if (true || request.pumpErrorHistory == PumpHistoryRequest.LAST) {
|
if (request.pumpErrorHistory == PumpHistoryRequest.LAST) {
|
||||||
PumpError error = readErrorRecord();
|
PumpError error = readErrorRecord();
|
||||||
history.pumpErrorHistory.add(error);
|
history.pumpErrorHistory.add(error);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue