Skip to content
Snippets Groups Projects
Commit 0f51ca9a authored by Volker Richert's avatar Volker Richert
Browse files

show log for last line in every case. was missing with 16 char in last line

parent 0f057afc
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ import info.nightscout.android.USB.UsbHidDriver;
import info.nightscout.android.medtronic.MedtronicCnlSession;
import info.nightscout.android.medtronic.exception.ChecksumException;
import info.nightscout.android.medtronic.exception.EncryptionException;
import info.nightscout.android.medtronic.exception.UnexpectedMessageException;
/**
* Created by volker on 22.12.2016.
......@@ -18,7 +19,7 @@ public class EHSMMessage extends MedtronicSendMessageRequestMessage<ContourNext
}
@Override
public ContourNextLinkResponseMessage send(UsbHidDriver mDevice, int millis) throws IOException, TimeoutException {
public ContourNextLinkResponseMessage send(UsbHidDriver mDevice, int millis) throws IOException, TimeoutException, UnexpectedMessageException {
sendMessage(mDevice);
if (millis > 0) {
try {
......@@ -28,6 +29,9 @@ public class EHSMMessage extends MedtronicSendMessageRequestMessage<ContourNext
}
// The End EHSM Session only has an 0x81 response
readMessage(mDevice);
if (this.encode().length != 54) {
throw new UnexpectedMessageException("length of EHSMMessage response does not match");
}
return null;
}
}
......@@ -63,19 +63,17 @@ public class HexDump {
line[lineIndex++] = b;
}
if (lineIndex != 16) {
int count = (16 - lineIndex) * 3;
count++;
for (int i = 0; i < count; i++) {
result.append(" ");
}
int count = (16 - lineIndex) * 3;
count++;
for (int i = 0; i < count; i++) {
result.append(" ");
}
for (int i = 0; i < lineIndex; i++) {
if (line[i] > ' ' && line[i] < '~') {
result.append(new String(line, i, 1));
} else {
result.append(".");
}
for (int i = 0; i < lineIndex; i++) {
if (line[i] > ' ' && line[i] < '~') {
result.append(new String(line, i, 1));
} else {
result.append(".");
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment