Only read Tdd and Alerts through buttons on Combo tab, not treatment history.
This commit is contained in:
parent
279d322c53
commit
063a5ba6b9
5 changed files with 14 additions and 32 deletions
|
@ -20,7 +20,7 @@ public class ComboAlertHistoryDialog extends DialogFragment {
|
|||
TextView text = (TextView) layout.findViewById(R.id.combo_error_history_text);
|
||||
List<PumpAlert> errors = ComboPlugin.getPlugin().getPump().errorHistory;
|
||||
if (errors.isEmpty()) {
|
||||
text.setText(R.string.combo_empty_history_note);
|
||||
text.setText(R.string.combo_no_alert_data_note);
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
DateFormat dateTimeFormatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
|
||||
|
|
|
@ -84,8 +84,11 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
|
|||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.combo_error_history:
|
||||
new Thread(() -> ComboPlugin.getPlugin().readAlertData()).start();
|
||||
return true;
|
||||
case R.id.combo_tdd_history:
|
||||
new Thread(() -> ComboPlugin.getPlugin().readAllPumpData()).start();
|
||||
new Thread(() -> ComboPlugin.getPlugin().readTddData()).start();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -96,7 +96,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
private volatile boolean bolusInProgress;
|
||||
private volatile boolean cancelBolus;
|
||||
private Bolus lastRequestedBolus;
|
||||
private long pumpHistoryLastChecked;
|
||||
|
||||
public static ComboPlugin getPlugin() {
|
||||
if (plugin == null)
|
||||
|
@ -869,34 +868,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
}
|
||||
}
|
||||
|
||||
void readAllPumpData() {
|
||||
long lastCheckInitiated = System.currentTimeMillis();
|
||||
|
||||
boolean readHistorySuccess = readHistory(new PumpHistoryRequest()
|
||||
.bolusHistory(pumpHistoryLastChecked)
|
||||
.tbrHistory(pumpHistoryLastChecked)
|
||||
.pumpErrorHistory(PumpHistoryRequest.FULL)
|
||||
.tddHistory(PumpHistoryRequest.FULL));
|
||||
if (!readHistorySuccess) {
|
||||
return;
|
||||
void readTddData() {
|
||||
readHistory(new PumpHistoryRequest().tddHistory(PumpHistoryRequest.FULL));
|
||||
}
|
||||
|
||||
pumpHistoryLastChecked = lastCheckInitiated;
|
||||
|
||||
/* not displayed in the UI anymore due to pump bug
|
||||
CommandResult reservoirResult = runCommand("Checking reservoir level", 2,
|
||||
ruffyScripter::readReservoirLevelAndLastBolus);
|
||||
if (!reservoirResult.success) {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
CommandResult basalResult = runCommand("Reading basal profile", 2, ruffyScripter::readBasalProfile);
|
||||
if (!basalResult.success) {
|
||||
return;
|
||||
}
|
||||
|
||||
pump.basalProfile = basalResult.basalProfile;
|
||||
void readAlertData() {
|
||||
readHistory(new PumpHistoryRequest()
|
||||
.pumpErrorHistory(PumpHistoryRequest.FULL));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ComboTddHistoryDialog extends DialogFragment {
|
|||
TextView text = (TextView) layout.findViewById(R.id.combo_tdd_history_text);
|
||||
List<Tdd> tdds = ComboPlugin.getPlugin().getPump().tddHistory;
|
||||
if (tdds.isEmpty()) {
|
||||
text.setText(R.string.combo_empty_history_note);
|
||||
text.setText(R.string.combo_no_tdd_data_note);
|
||||
} else {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
DateFormat dateFormatter = DateFormat.getDateInstance();
|
||||
|
|
|
@ -822,7 +822,8 @@
|
|||
<string name="combo_pump_cartridge_low_warrning">Pump cartridge level is low</string>
|
||||
<string name="combo_pump_battery_low_warrning">Pump battery is low</string>
|
||||
<string name="combo_is_in_error_state">Pump is in an error state, please check the pump</string>
|
||||
<string name="combo_empty_history_note">To read all data from the pump, long press the TDDS button. Besides alerts and TDDs, this will read boluses and TBRs from the pump and update the treatments accordingly.\n\nWARNING: this can trigger a bug which causes the pump to reject all connection attempts and requires pressing a button on the pump to recover and should therefore be avoided.</string>
|
||||
<string name="combo_no_alert_data_note">To read the pump\'s error history, long press the ALERTS button\n\nWARNING: this can trigger a bug which causes the pump to reject all connection attempts and requires pressing a button on the pump to recover and should therefore be avoided.</string>
|
||||
<string name="combo_no_tdd_data_note">To read the pump\'s TDD history, long press the TDDS button\n\nWARNING: this can trigger a bug which causes the pump to reject all connection attempts and requires pressing a button on the pump to recover and should therefore be avoided.</string>
|
||||
<string name="key_sync_profile_to_pump">sync_profile_to_pump</string>
|
||||
<string name="combo_tdd_minimum">Minimum: %3.1f U</string>
|
||||
<string name="combo_tdd_average">Average: %3.1f U</string>
|
||||
|
|
Loading…
Reference in a new issue