Update last failed communication time when an exception is thrown in OmnipodCommunicationManager.transportMessages and add log response from the Pod when exchanging messages

This commit is contained in:
Bart Sopers 2020-08-11 09:49:58 +02:00
parent ae86e7fc06
commit 0ba26e8b2c

View file

@ -141,7 +141,15 @@ public class OmnipodCommunicationManager extends RileyLinkCommunicationManager {
podStateManager.advanceToNextNonce(); podStateManager.advanceToNextNonce();
} }
MessageBlock responseMessageBlock = transportMessages(podStateManager, message, addressOverride, ackAddressOverride); MessageBlock responseMessageBlock;
try {
responseMessageBlock = transportMessages(podStateManager, message, addressOverride, ackAddressOverride);
} catch (Exception ex) {
podStateManager.setLastFailedCommunication(DateTime.now());
throw ex;
}
aapsLogger.debug(LTag.PUMPCOMM, "Received response from the Pod [responseMessageBlock={}]", responseMessageBlock);
if (responseMessageBlock instanceof StatusResponse) { if (responseMessageBlock instanceof StatusResponse) {
podStateManager.updateFromStatusResponse((StatusResponse) responseMessageBlock); podStateManager.updateFromStatusResponse((StatusResponse) responseMessageBlock);