Accept packets with a packet address of 0xFFFFFFFF to match PDM & Pod
This commit is contained in:
parent
ed1efe8944
commit
45ef41d1a3
|
@ -18,7 +18,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.comm.action.OmnipodAction
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommunicationException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.CommunicationException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPacketTypeException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalPacketTypeException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalResponseException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalResponseException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSequenceNumberException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalMessageSequenceNumberException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NonceOutOfSyncException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NonceOutOfSyncException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NonceResyncException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NonceResyncException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NotEnoughDataException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.NotEnoughDataException;
|
||||||
|
@ -37,6 +37,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.PacketType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInfoType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodState;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodState;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodConst;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 6/29/18.
|
* Created by andy on 6/29/18.
|
||||||
|
@ -218,7 +219,7 @@ public class OmnipodCommunicationService extends RileyLinkCommunicationManager {
|
||||||
try {
|
try {
|
||||||
receivedMessage = OmnipodMessage.decodeMessage(receivedMessageData);
|
receivedMessage = OmnipodMessage.decodeMessage(receivedMessageData);
|
||||||
if (receivedMessage.getSequenceNumber() != podState.getMessageNumber()) {
|
if (receivedMessage.getSequenceNumber() != podState.getMessageNumber()) {
|
||||||
throw new IllegalSequenceNumberException(podState.getMessageNumber(), receivedMessage.getSequenceNumber());
|
throw new IllegalMessageSequenceNumberException(podState.getMessageNumber(), receivedMessage.getSequenceNumber());
|
||||||
}
|
}
|
||||||
} catch (NotEnoughDataException ex) {
|
} catch (NotEnoughDataException ex) {
|
||||||
// Message is (probably) not complete yet
|
// Message is (probably) not complete yet
|
||||||
|
@ -332,7 +333,8 @@ public class OmnipodCommunicationService extends RileyLinkCommunicationManager {
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (response.getAddress() != packet.getAddress()) {
|
if (response.getAddress() != packet.getAddress() &&
|
||||||
|
response.getAddress() != OmnipodConst.DEFAULT_ADDRESS) { // In some (strange) cases, the Pod remains a packet address of 0xffffffff during it's lifetime
|
||||||
if (isLoggingEnabled()) {
|
if (isLoggingEnabled()) {
|
||||||
LOG.debug("Packet address " + response.getAddress() + " doesn't match " + packet.getAddress());
|
LOG.debug("Packet address " + response.getAddress() + " doesn't match " + packet.getAddress());
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ package info.nightscout.androidaps.plugins.pump.omnipod.comm.exception;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.exception.OmnipodException;
|
||||||
|
|
||||||
public class IllegalSequenceNumberException extends OmnipodException {
|
public class IllegalMessageSequenceNumberException extends OmnipodException {
|
||||||
private final int expected;
|
private final int expected;
|
||||||
private final int actual;
|
private final int actual;
|
||||||
|
|
||||||
public IllegalSequenceNumberException(int expected, int actual) {
|
public IllegalMessageSequenceNumberException(int expected, int actual) {
|
||||||
super("Invalid sequence number. Expected="+ expected +", actual="+ actual, false);
|
super("Invalid message sequence number. Expected="+ expected +", actual="+ actual, false);
|
||||||
this.expected = expected;
|
this.expected = expected;
|
||||||
this.actual = actual;
|
this.actual = actual;
|
||||||
}
|
}
|
|
@ -37,7 +37,7 @@ import info.nightscout.androidaps.plugins.pump.common.utils.DateTimeUtil;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodCommunicationService;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodManager;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.OmnipodManager;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.SetupActionResult;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.SetupActionResult;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalSequenceNumberException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.exception.IllegalMessageSequenceNumberException;
|
||||||
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.PodInfoRecentPulseLog;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoResponse;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoResponse;
|
||||||
|
@ -613,8 +613,8 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
||||||
comment = getStringResource(R.string.omnipod_driver_error_invalid_progress_state);
|
comment = getStringResource(R.string.omnipod_driver_error_invalid_progress_state);
|
||||||
} else if (ex instanceof IllegalResponseException) {
|
} else if (ex instanceof IllegalResponseException) {
|
||||||
comment = getStringResource(R.string.omnipod_driver_error_invalid_response);
|
comment = getStringResource(R.string.omnipod_driver_error_invalid_response);
|
||||||
} else if (ex instanceof IllegalSequenceNumberException) {
|
} else if (ex instanceof IllegalMessageSequenceNumberException) {
|
||||||
comment = getStringResource(R.string.omnipod_driver_error_invalid_sequence_number);
|
comment = getStringResource(R.string.omnipod_driver_error_invalid_message_sequence_number);
|
||||||
} else if (ex instanceof MessageDecodingException) {
|
} else if (ex instanceof MessageDecodingException) {
|
||||||
comment = getStringResource(R.string.omnipod_driver_error_message_decoding_failed);
|
comment = getStringResource(R.string.omnipod_driver_error_message_decoding_failed);
|
||||||
} else if (ex instanceof NonceOutOfSyncException) {
|
} else if (ex instanceof NonceOutOfSyncException) {
|
||||||
|
|
|
@ -1756,7 +1756,7 @@
|
||||||
<string name="omnipod_driver_error_invalid_packet_type">Communication failed: received an invalid packet from the Pod.</string>
|
<string name="omnipod_driver_error_invalid_packet_type">Communication failed: received an invalid packet from the Pod.</string>
|
||||||
<string name="omnipod_driver_error_invalid_progress_state">Communication failed: the Pod is in a wrong state.</string>
|
<string name="omnipod_driver_error_invalid_progress_state">Communication failed: the Pod is in a wrong state.</string>
|
||||||
<string name="omnipod_driver_error_invalid_response">Communication failed: received an invalid response from the Pod.</string>
|
<string name="omnipod_driver_error_invalid_response">Communication failed: received an invalid response from the Pod.</string>
|
||||||
<string name="omnipod_driver_error_invalid_sequence_number">Communication failed: received a message with an invalid sequence number from the Pod.</string>
|
<string name="omnipod_driver_error_invalid_message_sequence_number">Communication failed: received a message with an invalid sequence number from the Pod.</string>
|
||||||
<string name="omnipod_driver_error_message_decoding_failed">Communication failed: failed to decode message from the Pod.</string>
|
<string name="omnipod_driver_error_message_decoding_failed">Communication failed: failed to decode message from the Pod.</string>
|
||||||
<string name="omnipod_driver_error_nonce_resync_failed">Communication failed: nonce resync failed.</string>
|
<string name="omnipod_driver_error_nonce_resync_failed">Communication failed: nonce resync failed.</string>
|
||||||
<string name="omnipod_driver_error_nonce_out_of_sync">Communication failed: nonce out of sync.</string>
|
<string name="omnipod_driver_error_nonce_out_of_sync">Communication failed: nonce out of sync.</string>
|
||||||
|
|
Loading…
Reference in a new issue