SMS read status after bolus
This commit is contained in:
parent
c7c3506b53
commit
b9ea583d3d
1 changed files with 20 additions and 15 deletions
|
@ -667,18 +667,21 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
||||||
detailedBolusInfo.insulin = aDouble;
|
detailedBolusInfo.insulin = aDouble;
|
||||||
detailedBolusInfo.source = Source.USER;
|
detailedBolusInfo.source = Source.USER;
|
||||||
ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
ConfigBuilderPlugin.getPlugin().getCommandQueue().bolus(detailedBolusInfo, new Callback() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
final boolean resultSuccess = result.success;
|
||||||
|
final double resultBolusDelivered = result.bolusDelivered;
|
||||||
|
ConfigBuilderPlugin.getPlugin().getCommandQueue().readStatus("SMS", new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
|
||||||
if (result.success) {
|
if (resultSuccess) {
|
||||||
SystemClock.sleep(T.secs(15).msecs()); // wait some time to get history
|
String reply = String.format(MainApp.gs(R.string.smscommunicator_bolusdelivered), resultBolusDelivered);
|
||||||
String reply = String.format(MainApp.gs(R.string.smscommunicator_bolusdelivered), result.bolusDelivered);
|
|
||||||
if (pump != null)
|
if (pump != null)
|
||||||
reply += "\n" + pump.shortStatus(true);
|
reply += "\n" + pump.shortStatus(true);
|
||||||
lastRemoteBolusTime = new Date();
|
lastRemoteBolusTime = new Date();
|
||||||
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply));
|
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply));
|
||||||
} else {
|
} else {
|
||||||
SystemClock.sleep(T.secs(60).msecs()); // wait some time to get history
|
|
||||||
String reply = MainApp.gs(R.string.smscommunicator_bolusfailed);
|
String reply = MainApp.gs(R.string.smscommunicator_bolusfailed);
|
||||||
if (pump != null)
|
if (pump != null)
|
||||||
reply += "\n" + pump.shortStatus(true);
|
reply += "\n" + pump.shortStatus(true);
|
||||||
|
@ -688,6 +691,8 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
} else
|
} else
|
||||||
sendSMS(new Sms(receivedSms.phoneNumber, R.string.wrongformat));
|
sendSMS(new Sms(receivedSms.phoneNumber, R.string.wrongformat));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue