Minor improvements in OmnipodPumpPlugin

This commit is contained in:
Bart Sopers 2020-08-23 11:30:45 +02:00
parent 9bce1fdc6c
commit 25b6ddcbc0

View file

@ -419,7 +419,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
} else if (!omnipodStatusRequestList.isEmpty()) { } else if (!omnipodStatusRequestList.isEmpty()) {
Iterator<OmnipodStatusRequest> iterator = omnipodStatusRequestList.iterator(); Iterator<OmnipodStatusRequest> iterator = omnipodStatusRequestList.iterator();
while(iterator.hasNext()) { while (iterator.hasNext()) {
OmnipodStatusRequest omnipodStatusRequest = iterator.next(); OmnipodStatusRequest omnipodStatusRequest = iterator.next();
if (omnipodStatusRequest == OmnipodStatusRequest.GetPodPulseLog) { if (omnipodStatusRequest == OmnipodStatusRequest.GetPodPulseLog) {
OmnipodUITask omnipodUITask = getDeviceCommandExecutor().executeCommand(omnipodStatusRequest.getCommandType()); OmnipodUITask omnipodUITask = getDeviceCommandExecutor().executeCommand(omnipodStatusRequest.getCommandType());
@ -680,7 +680,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
JSONObject status = new JSONObject(); JSONObject status = new JSONObject();
JSONObject extended = new JSONObject(); JSONObject extended = new JSONObject();
try { try {
status.put("status", podStateManager.isPodRunning() ? "normal" : "error"); status.put("status", podStateManager.isPodRunning() ? (podStateManager.isSuspended() ? "suspended" : "normal") : "no active Pod");
status.put("timestamp", DateUtil.toISOString(new Date())); status.put("timestamp", DateUtil.toISOString(new Date()));
battery.put("percent", getBatteryLevel()); battery.put("percent", getBatteryLevel());
@ -792,12 +792,12 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
OmnipodCustomActionType mcat = (OmnipodCustomActionType) customActionType; OmnipodCustomActionType mcat = (OmnipodCustomActionType) customActionType;
switch (mcat) { switch (mcat) {
case ResetRileyLinkConfiguration: { case ResetRileyLinkConfiguration:
serviceTaskExecutor.startTask(new ResetRileyLinkConfigurationTask(getInjector())); serviceTaskExecutor.startTask(new ResetRileyLinkConfigurationTask(getInjector()));
} break;
break;
default: default:
aapsLogger.warn(LTag.PUMP, "Unknown custom action: {}" + mcat);
break; break;
} }
} }