Fix PumpStoppedException while fetching status

This commit is contained in:
TebbeUbben 2019-01-19 00:43:58 +01:00
parent 85ae946296
commit f27ace7568

View file

@ -374,12 +374,18 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
cartridgeStatus = connectionService.requestMessage(new GetCartridgeStatusMessage()).await().getCartridgeStatus(); cartridgeStatus = connectionService.requestMessage(new GetCartridgeStatusMessage()).await().getCartridgeStatus();
if (registerMessage.isTotalDailyDoseChanged()) if (registerMessage.isTotalDailyDoseChanged())
totalDailyDose = connectionService.requestMessage(new GetTotalDailyDoseMessage()).await().getTDD(); totalDailyDose = connectionService.requestMessage(new GetTotalDailyDoseMessage()).await().getTDD();
if (registerMessage.isActiveBasalRateChanged()) if (operatingMode == OperatingMode.STARTED) {
activeBasalRate = connectionService.requestMessage(new GetActiveBasalRateMessage()).await().getActiveBasalRate(); if (registerMessage.isActiveBasalRateChanged())
if (registerMessage.isActiveTBRChanged()) activeBasalRate = connectionService.requestMessage(new GetActiveBasalRateMessage()).await().getActiveBasalRate();
activeTBR = connectionService.requestMessage(new GetActiveTBRMessage()).await().getActiveTBR(); if (registerMessage.isActiveTBRChanged())
if (registerMessage.isActiveBolusesChanged()) activeTBR = connectionService.requestMessage(new GetActiveTBRMessage()).await().getActiveTBR();
activeBoluses = connectionService.requestMessage(new GetActiveBolusesMessage()).await().getActiveBoluses(); if (registerMessage.isActiveBolusesChanged())
activeBoluses = connectionService.requestMessage(new GetActiveBolusesMessage()).await().getActiveBoluses();
} else {
activeBasalRate = null;
activeTBR = null;
activeBoluses = null;
}
} else { } else {
ResetPumpStatusRegisterMessage resetMessage = new ResetPumpStatusRegisterMessage(); ResetPumpStatusRegisterMessage resetMessage = new ResetPumpStatusRegisterMessage();
@ -395,9 +401,15 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
batteryStatus = connectionService.requestMessage(new GetBatteryStatusMessage()).await().getBatteryStatus(); batteryStatus = connectionService.requestMessage(new GetBatteryStatusMessage()).await().getBatteryStatus();
cartridgeStatus = connectionService.requestMessage(new GetCartridgeStatusMessage()).await().getCartridgeStatus(); cartridgeStatus = connectionService.requestMessage(new GetCartridgeStatusMessage()).await().getCartridgeStatus();
totalDailyDose = connectionService.requestMessage(new GetTotalDailyDoseMessage()).await().getTDD(); totalDailyDose = connectionService.requestMessage(new GetTotalDailyDoseMessage()).await().getTDD();
activeBasalRate = connectionService.requestMessage(new GetActiveBasalRateMessage()).await().getActiveBasalRate(); if (operatingMode == OperatingMode.STARTED) {
activeTBR = connectionService.requestMessage(new GetActiveTBRMessage()).await().getActiveTBR(); activeBasalRate = connectionService.requestMessage(new GetActiveBasalRateMessage()).await().getActiveBasalRate();
activeBoluses = connectionService.requestMessage(new GetActiveBolusesMessage()).await().getActiveBoluses(); activeTBR = connectionService.requestMessage(new GetActiveTBRMessage()).await().getActiveTBR();
activeBoluses = connectionService.requestMessage(new GetActiveBolusesMessage()).await().getActiveBoluses();
} else {
activeBasalRate = null;
activeTBR = null;
activeBoluses = null;
}
statusLoaded = true; statusLoaded = true;
} }
lastUpdated = System.currentTimeMillis(); lastUpdated = System.currentTimeMillis();