SmsCommunicator: only ask pump with support to add carbs.
This aligns with how this is generally handles elsewhere: check if a pump supports carbs and if not, don't bother the driver but add the carbs directly via TreatmentsPlugin.
This commit is contained in:
parent
e7c7ce32bb
commit
fce6ec8d25
|
@ -715,19 +715,26 @@ object SmsCommunicatorPlugin : PluginBase(PluginDescription()
|
||||||
detailedBolusInfo.carbs = anInteger().toDouble()
|
detailedBolusInfo.carbs = anInteger().toDouble()
|
||||||
detailedBolusInfo.source = Source.USER
|
detailedBolusInfo.source = Source.USER
|
||||||
detailedBolusInfo.date = secondLong()
|
detailedBolusInfo.date = secondLong()
|
||||||
ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
if (ConfigBuilderPlugin.getPlugin().activePump?.pumpDescription?.storesCarbInfo == true) {
|
||||||
override fun run() {
|
ConfigBuilderPlugin.getPlugin().commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||||
if (result.success) {
|
override fun run() {
|
||||||
var replyText = String.format(MainApp.gs(R.string.smscommunicator_carbsset), anInteger)
|
if (result.success) {
|
||||||
replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true)
|
var replyText = String.format(MainApp.gs(R.string.smscommunicator_carbsset), anInteger)
|
||||||
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true)
|
||||||
} else {
|
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||||
var replyText = MainApp.gs(R.string.smscommunicator_carbsfailed)
|
} else {
|
||||||
replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true)
|
var replyText = MainApp.gs(R.string.smscommunicator_carbsfailed)
|
||||||
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true)
|
||||||
|
sendSMS(Sms(receivedSms.phoneNumber, replyText))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
} else {
|
||||||
|
TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, true)
|
||||||
|
var replyText = String.format(MainApp.gs(R.string.smscommunicator_carbsset), anInteger)
|
||||||
|
replyText += "\n" + ConfigBuilderPlugin.getPlugin().activePump?.shortStatus(true)
|
||||||
|
sendSMSToAllNumbers(Sms(receivedSms.phoneNumber, replyText))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue