Merge pull request #2061 from andyrozman/bug_1969_error_decoding_basal_profile
Bug 1969 error decoding basal profile
This commit is contained in:
commit
a8f68e1182
|
@ -703,7 +703,6 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
|
|||
// create message
|
||||
PumpMessage msg;
|
||||
|
||||
// if (bodyData == null)
|
||||
msg = makePumpMessage(commandType);
|
||||
|
||||
// send and wait for response
|
||||
|
@ -718,8 +717,6 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
|
|||
|
||||
byte[] data = null;
|
||||
|
||||
int runs = 1;
|
||||
|
||||
if (check == null) {
|
||||
|
||||
data = response.getRawContentOfFrame();
|
||||
|
@ -728,24 +725,21 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
|
|||
|
||||
while (checkIfWeHaveMoreData(commandType, response, data)) {
|
||||
|
||||
runs++;
|
||||
|
||||
PumpMessage response2 = sendAndListen(ackMsg, DEFAULT_TIMEOUT + (DEFAULT_TIMEOUT * retries));
|
||||
response = sendAndListen(ackMsg, DEFAULT_TIMEOUT + (DEFAULT_TIMEOUT * retries));
|
||||
|
||||
// LOG.debug("{} Response: {}", runs, HexDump.toHexStringDisplayable(response2.getRawContent()));
|
||||
// LOG.debug("{} Response: {}", runs,
|
||||
// HexDump.toHexStringDisplayable(response2.getMessageBody().getTxData()));
|
||||
|
||||
String check2 = checkResponseContent(response2, commandType.commandDescription, 1);
|
||||
String check2 = checkResponseContent(response, commandType.commandDescription, 1);
|
||||
|
||||
if (check2 == null) {
|
||||
|
||||
data = ByteUtil.concat(data, response2.getRawContentOfFrame());
|
||||
data = ByteUtil.concat(data, response.getRawContentOfFrame());
|
||||
|
||||
} else {
|
||||
this.errorMessage = check2;
|
||||
if (isLogEnabled())
|
||||
LOG.debug("Error message: " + check2);
|
||||
LOG.error("Error with response got GetProfile: " + check2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -784,11 +778,10 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
|
|||
if (commandType == MedtronicCommandType.GetBasalProfileSTD || //
|
||||
commandType == MedtronicCommandType.GetBasalProfileA || //
|
||||
commandType == MedtronicCommandType.GetBasalProfileB) {
|
||||
byte[] responseRaw = response.getRawContent();
|
||||
byte[] responseRaw = response.getRawContentOfFrame();
|
||||
|
||||
int last = responseRaw.length - 1;
|
||||
|
||||
if (isLogEnabled())
|
||||
LOG.debug("Length: " + data.length);
|
||||
|
||||
if (data.length >= BasalProfile.MAX_RAW_DATA_SIZE) {
|
||||
|
@ -954,7 +947,7 @@ public class MedtronicCommunicationManager extends RileyLinkCommunicationManager
|
|||
LOG.warn("Error getting response from RileyLink (error={}, retry={})", e.getMessage(), retries + 1);
|
||||
}
|
||||
|
||||
if (responseMessage!=null)
|
||||
if (responseMessage != null)
|
||||
LOG.warn("Set Basal Profile: Invalid response: commandType={},rawData={}", responseMessage.commandType, ByteUtil.shortHexString(responseMessage.getRawContent()));
|
||||
else
|
||||
LOG.warn("Set Basal Profile: Null response.");
|
||||
|
|
|
@ -22,6 +22,8 @@ public class PumpMessage implements RLMessage {
|
|||
public MessageBody messageBody = new MessageBody();
|
||||
public String error = null;
|
||||
|
||||
public static final int FRAME_DATA_LENGTH = 64;
|
||||
|
||||
|
||||
public PumpMessage(String error) {
|
||||
this.error = error;
|
||||
|
@ -129,9 +131,10 @@ public class PumpMessage implements RLMessage {
|
|||
return arrayOut;
|
||||
}
|
||||
|
||||
|
||||
public byte[] getRawContentOfFrame() {
|
||||
byte[] raw = getRawContent();
|
||||
return ByteUtil.substring(raw, 0, raw.length - 1);
|
||||
byte[] raw = messageBody.getTxData();
|
||||
return ByteUtil.substring(raw, 1, Math.min(FRAME_DATA_LENGTH, raw.length - 1));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -105,9 +105,9 @@ public enum MedtronicDeviceType {
|
|||
}
|
||||
|
||||
|
||||
public static boolean isLargerFormat(MedtronicDeviceType model) {
|
||||
return isSameDevice(model, Medtronic_523andHigher);
|
||||
}
|
||||
// public static boolean isLargerFormat(MedtronicDeviceType model) {
|
||||
// return isSameDevice(model, Medtronic_523andHigher);
|
||||
// }
|
||||
|
||||
|
||||
public boolean isFamily() {
|
||||
|
@ -120,13 +120,17 @@ public enum MedtronicDeviceType {
|
|||
}
|
||||
|
||||
|
||||
public boolean isLargerFormat() {
|
||||
// public boolean isLargerFormat() {
|
||||
// return isSameDevice(this, Medtronic_523andHigher);
|
||||
// }
|
||||
|
||||
public boolean isMedtronic_523orHigher() {
|
||||
return isSameDevice(this, Medtronic_523andHigher);
|
||||
}
|
||||
|
||||
|
||||
public int getBolusStrokes() {
|
||||
return (isLargerFormat(this)) ? 40 : 10;
|
||||
return (isMedtronic_523orHigher()) ? 40 : 10;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue