cancel temp on suspend loop
This commit is contained in:
parent
462849af12
commit
448a420fad
|
@ -392,21 +392,57 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor1h))) {
|
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor1h))) {
|
||||||
activeloop.suspendTo(new Date().getTime() + 60L * 60 * 1000);
|
activeloop.suspendTo(new Date().getTime() + 60L * 60 * 1000);
|
||||||
scheduleUpdateGUI("suspendmenu");
|
scheduleUpdateGUI("suspendmenu");
|
||||||
|
sHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||||
|
if (!result.success) {
|
||||||
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
ConfigBuilderPlugin.uploadOpenAPSOffline(60);
|
ConfigBuilderPlugin.uploadOpenAPSOffline(60);
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor2h))) {
|
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor2h))) {
|
||||||
activeloop.suspendTo(new Date().getTime() + 2 * 60L * 60 * 1000);
|
activeloop.suspendTo(new Date().getTime() + 2 * 60L * 60 * 1000);
|
||||||
scheduleUpdateGUI("suspendmenu");
|
scheduleUpdateGUI("suspendmenu");
|
||||||
|
sHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||||
|
if (!result.success) {
|
||||||
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
ConfigBuilderPlugin.uploadOpenAPSOffline(120);
|
ConfigBuilderPlugin.uploadOpenAPSOffline(120);
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor3h))) {
|
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor3h))) {
|
||||||
activeloop.suspendTo(new Date().getTime() + 3 * 60L * 60 * 1000);
|
activeloop.suspendTo(new Date().getTime() + 3 * 60L * 60 * 1000);
|
||||||
scheduleUpdateGUI("suspendmenu");
|
scheduleUpdateGUI("suspendmenu");
|
||||||
|
sHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||||
|
if (!result.success) {
|
||||||
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
ConfigBuilderPlugin.uploadOpenAPSOffline(180);
|
ConfigBuilderPlugin.uploadOpenAPSOffline(180);
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor10h))) {
|
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.suspendloopfor10h))) {
|
||||||
activeloop.suspendTo(new Date().getTime() + 10 * 60L * 60 * 1000);
|
activeloop.suspendTo(new Date().getTime() + 10 * 60L * 60 * 1000);
|
||||||
scheduleUpdateGUI("suspendmenu");
|
scheduleUpdateGUI("suspendmenu");
|
||||||
|
sHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||||
|
if (!result.success) {
|
||||||
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
ConfigBuilderPlugin.uploadOpenAPSOffline(600);
|
ConfigBuilderPlugin.uploadOpenAPSOffline(600);
|
||||||
return true;
|
return true;
|
||||||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor30m))) {
|
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor30m))) {
|
||||||
|
|
|
@ -530,9 +530,11 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
||||||
suspendWaitingForConfirmation.processed = true;
|
suspendWaitingForConfirmation.processed = true;
|
||||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||||
activeloop.suspendTo(new Date().getTime() + suspendWaitingForConfirmation.duration * 60L * 1000);
|
activeloop.suspendTo(new Date().getTime() + suspendWaitingForConfirmation.duration * 60L * 1000);
|
||||||
|
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
|
||||||
ConfigBuilderPlugin.uploadOpenAPSOffline(suspendWaitingForConfirmation.duration * 60);
|
ConfigBuilderPlugin.uploadOpenAPSOffline(suspendWaitingForConfirmation.duration * 60);
|
||||||
MainApp.bus().post(new EventRefreshGui(false));
|
MainApp.bus().post(new EventRefreshGui(false));
|
||||||
reply = MainApp.sResources.getString(R.string.smscommunicator_loopsuspended);
|
reply = MainApp.sResources.getString(R.string.smscommunicator_loopsuspended) + " " +
|
||||||
|
MainApp.sResources.getString(result.success?R.string.smscommunicator_tempbasalcanceled:R.string.smscommunicator_tempbasalcancelfailed);
|
||||||
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||||
} else {
|
} else {
|
||||||
sendSMS(new Sms(receivedSms.phoneNumber, MainApp.sResources.getString(R.string.smscommunicator_unknowncommand), new Date()));
|
sendSMS(new Sms(receivedSms.phoneNumber, MainApp.sResources.getString(R.string.smscommunicator_unknowncommand), new Date()));
|
||||||
|
|
Loading…
Reference in a new issue