send carbs and insulin in one connect
This commit is contained in:
parent
267e0220c0
commit
2e72e18c62
2 changed files with 6 additions and 3 deletions
|
@ -240,8 +240,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
if (insulin > 0 || carbs > 0) {
|
if (insulin > 0 || carbs > 0) {
|
||||||
Treatment t = new Treatment();
|
Treatment t = new Treatment();
|
||||||
boolean connectionOK = false;
|
boolean connectionOK = false;
|
||||||
if (carbs > 0) connectionOK = sExecutionService.carbsEntry(carbs);
|
if (insulin > 0) connectionOK = sExecutionService.bolus(insulin, carbs, t);
|
||||||
if (insulin > 0) connectionOK = sExecutionService.bolus(insulin, t);
|
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
result.success = connectionOK;
|
result.success = connectionOK;
|
||||||
result.bolusDelivered = t.insulin;
|
result.bolusDelivered = t.insulin;
|
||||||
|
|
|
@ -355,7 +355,7 @@ public class ExecutionService extends Service {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean bolus(Double amount, Treatment t) {
|
public boolean bolus(Double amount, int carbs, Treatment t) {
|
||||||
bolusingTreatment = t;
|
bolusingTreatment = t;
|
||||||
MsgBolusStart start = new MsgBolusStart(amount);
|
MsgBolusStart start = new MsgBolusStart(amount);
|
||||||
MsgBolusProgress progress = new MsgBolusProgress(MainApp.bus(), amount, t);
|
MsgBolusProgress progress = new MsgBolusProgress(MainApp.bus(), amount, t);
|
||||||
|
@ -364,6 +364,10 @@ public class ExecutionService extends Service {
|
||||||
connect("bolus");
|
connect("bolus");
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
|
|
||||||
|
if (carbs > 0) {
|
||||||
|
Calendar time = Calendar.getInstance();
|
||||||
|
mSerialIOThread.sendMessage(new MsgSetCarbsEntry(time, carbs));
|
||||||
|
}
|
||||||
MainApp.bus().post(new EventDanaRBolusStart());
|
MainApp.bus().post(new EventDanaRBolusStart());
|
||||||
|
|
||||||
if (!stop.stopped) {
|
if (!stop.stopped) {
|
||||||
|
|
Loading…
Reference in a new issue