pump shortStatus String in interface
This commit is contained in:
parent
78fb6f934e
commit
5ce9d257e8
7 changed files with 37 additions and 10 deletions
|
@ -51,4 +51,6 @@ public interface PumpInterface {
|
|||
String deviceID();
|
||||
|
||||
PumpDescription getPumpDescription();
|
||||
|
||||
public String shortStatus(boolean veryShort);
|
||||
}
|
||||
|
|
|
@ -662,6 +662,15 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String shortStatus(boolean veryShort) {
|
||||
if (activePump != null) {
|
||||
return activePump.shortStatus(veryShort);
|
||||
} else {
|
||||
return "No Pump active!";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constraints interface
|
||||
**/
|
||||
|
|
|
@ -823,7 +823,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
}
|
||||
|
||||
// Reply for sms communicator
|
||||
public String shortStatus() {
|
||||
public String shortStatus(boolean veryShort) {
|
||||
String ret = "";
|
||||
if (getDanaRPump().lastConnection.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - getDanaRPump().lastConnection.getTime();
|
||||
|
@ -839,6 +839,9 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
if (isExtendedBoluslInProgress()) {
|
||||
ret += "Extended: " + getExtendedBolus().toString() + "\n";
|
||||
}
|
||||
if (!veryShort){
|
||||
ret += "TDD: " + DecimalFormatter.to0Decimal(getDanaRPump().dailyTotalUnits) + " / " + getDanaRPump().maxDailyTotalUnits + " U\n";
|
||||
}
|
||||
ret += "IOB: " + getDanaRPump().iob + "U\n";
|
||||
ret += "Reserv: " + DecimalFormatter.to0Decimal(getDanaRPump().reservoirRemainingUnits) + "U\n";
|
||||
ret += "Batt: " + getDanaRPump().batteryRemaining + "\n";
|
||||
|
|
|
@ -823,7 +823,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
}
|
||||
|
||||
// Reply for sms communicator
|
||||
public String shortStatus() {
|
||||
public String shortStatus(boolean veryShort) {
|
||||
String ret = "";
|
||||
if (getDanaRPump().lastConnection.getTime() != 0) {
|
||||
Long agoMsec = new Date().getTime() - getDanaRPump().lastConnection.getTime();
|
||||
|
@ -839,6 +839,9 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
if (isExtendedBoluslInProgress()) {
|
||||
ret += "Extended: " + getExtendedBolus().toString() + "\n";
|
||||
}
|
||||
if (!veryShort){
|
||||
ret += "TDD: " + DecimalFormatter.to0Decimal(getDanaRPump().dailyTotalUnits) + " / " + getDanaRPump().maxDailyTotalUnits + " U\n";
|
||||
}
|
||||
ret += "IOB: " + getDanaRPump().iob + "U\n";
|
||||
ret += "Reserv: " + DecimalFormatter.to0Decimal(getDanaRPump().reservoirRemainingUnits) + "U\n";
|
||||
ret += "Batt: " + getDanaRPump().batteryRemaining + "\n";
|
||||
|
|
|
@ -272,4 +272,9 @@ public class MDIPlugin implements PluginBase, PumpInterface {
|
|||
return pumpDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String shortStatus(boolean veryShort) {
|
||||
return deviceID();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -302,12 +302,12 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
case "DANAR":
|
||||
DanaRPlugin danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class);
|
||||
if (danaRPlugin != null && danaRPlugin.isEnabled(PluginBase.PUMP)) {
|
||||
reply = danaRPlugin.shortStatus();
|
||||
reply = danaRPlugin.shortStatus(true);
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
}
|
||||
DanaRKoreanPlugin danaRKoreanPlugin = (DanaRKoreanPlugin) MainApp.getSpecificPlugin(DanaRKoreanPlugin.class);
|
||||
if (danaRKoreanPlugin != null && danaRKoreanPlugin.isEnabled(PluginBase.PUMP)) {
|
||||
reply = danaRKoreanPlugin.shortStatus();
|
||||
reply = danaRKoreanPlugin.shortStatus(true);
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
}
|
||||
receivedSms.processed = true;
|
||||
|
@ -374,12 +374,12 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
PumpEnactResult result = pumpInterface.deliverTreatment(bolusWaitingForConfirmation.bolusRequested, 0, null);
|
||||
if (result.success) {
|
||||
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_bolusdelivered), result.bolusDelivered);
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus();
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
|
||||
lastRemoteBolusTime = new Date();
|
||||
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
} else {
|
||||
reply = MainApp.sResources.getString(R.string.smscommunicator_bolusfailed);
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus();
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
}
|
||||
}
|
||||
|
@ -392,11 +392,11 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
PumpEnactResult result = pumpInterface.setTempBasalAbsolute(tempBasalWaitingForConfirmation.tempBasal, 30);
|
||||
if (result.success) {
|
||||
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_tempbasalset), result.absolute, result.duration);
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus();
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
|
||||
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
} else {
|
||||
reply = MainApp.sResources.getString(R.string.smscommunicator_tempbasalfailed);
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus();
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
}
|
||||
}
|
||||
|
@ -409,11 +409,11 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
PumpEnactResult result = pumpInterface.cancelTempBasal();
|
||||
if (result.success) {
|
||||
reply = String.format(MainApp.sResources.getString(R.string.smscommunicator_tempbasalcanceled));
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus();
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
|
||||
sendSMSToAllNumbers(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
} else {
|
||||
reply = MainApp.sResources.getString(R.string.smscommunicator_tempbasalcancelfailed);
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus();
|
||||
if (danaRPlugin != null) reply += "\n" + danaRPlugin.shortStatus(true);
|
||||
sendSMS(new Sms(receivedSms.phoneNumber, reply, new Date()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -430,4 +430,9 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
return pumpDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String shortStatus(boolean veryShort) {
|
||||
return "Virtual Pump";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue