Don't pad messages that contain a DeactivatePodCommand message block and don't use verification for deactivatePod
This commit is contained in:
parent
aea725e9ad
commit
36a1a13846
|
@ -18,6 +18,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.OmnipodAction
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.MessageBlock;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodMessage;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodPacket;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.OmnipodPacket;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.command.DeactivatePodCommand;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.ErrorResponse;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.ErrorResponse;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.StatusResponse;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoFaultEvent;
|
||||||
|
@ -149,7 +150,9 @@ public class OmnipodCommunicationService extends RileyLinkCommunicationManager {
|
||||||
|
|
||||||
boolean firstPacket = true;
|
boolean firstPacket = true;
|
||||||
byte[] encodedMessage;
|
byte[] encodedMessage;
|
||||||
if (message.isNonceResyncable()) {
|
// this does not work well with the deactivate pod command, we somehow either
|
||||||
|
// receive an ACK instead of a normal response, or a partial response and a communication timeout
|
||||||
|
if (message.isNonceResyncable() && !message.containsBlock(DeactivatePodCommand.class)) {
|
||||||
OmnipodMessage paddedMessage = new OmnipodMessage(message);
|
OmnipodMessage paddedMessage = new OmnipodMessage(message);
|
||||||
// If messages are nonce resyncable, we want do distinguish between certain and uncertain failures for verification purposes
|
// If messages are nonce resyncable, we want do distinguish between certain and uncertain failures for verification purposes
|
||||||
// However, some commands (e.g. cancel delivery) are single packet command by nature. When we get a timeout with a single packet,
|
// However, some commands (e.g. cancel delivery) are single packet command by nature. When we get a timeout with a single packet,
|
||||||
|
|
|
@ -403,7 +403,7 @@ public class OmnipodManager {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Always send acknowledgement beeps here. Matches the PDM's behavior
|
// Always send acknowledgement beeps here. Matches the PDM's behavior
|
||||||
executeAndVerify(() -> communicationService.executeAction(new DeactivatePodAction(podState, true)));
|
communicationService.executeAction(new DeactivatePodAction(podState, true));
|
||||||
} catch (PodFaultException ex) {
|
} catch (PodFaultException ex) {
|
||||||
if (isLoggingEnabled()) {
|
if (isLoggingEnabled()) {
|
||||||
LOG.info("Ignoring PodFaultException in deactivatePod", ex);
|
LOG.info("Ignoring PodFaultException in deactivatePod", ex);
|
||||||
|
|
|
@ -115,12 +115,7 @@ public class OmnipodMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNonceResyncable() {
|
public boolean isNonceResyncable() {
|
||||||
for (MessageBlock messageBlock : messageBlocks) {
|
return containsBlock(NonceResyncableMessageBlock.class);
|
||||||
if (messageBlock instanceof NonceResyncableMessageBlock) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSentNonce() {
|
public int getSentNonce() {
|
||||||
|
@ -139,4 +134,13 @@ public class OmnipodMessage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean containsBlock(Class<? extends MessageBlock> blockType) {
|
||||||
|
for (MessageBlock messageBlock : messageBlocks) {
|
||||||
|
if (blockType.isInstance(messageBlock)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue