Skip to content
Snippets Groups Projects
Commit 2ec69ed6 authored by Lennart Goedhart's avatar Lennart Goedhart
Browse files

Fix #73. Remove all references to Bayer.

parent 045bebb3
Branches
Tags
No related merge requests found
......@@ -21,7 +21,7 @@ public class MedtronicCnlSession {
private byte radioChannel;
private byte radioRSSI;
private int bayerSequenceNumber = 1;
private int cnlSequenceNumber = 1;
private int medtronicSequenceNumber = 1;
public byte[] getHMAC() throws NoSuchAlgorithmException {
......@@ -65,8 +65,8 @@ public class MedtronicCnlSession {
this.pumpMAC = pumpMAC;
}
public int getBayerSequenceNumber() {
return bayerSequenceNumber;
public int getCnlSequenceNumber() {
return cnlSequenceNumber;
}
public int getMedtronicSequenceNumber() {
......@@ -85,8 +85,8 @@ public class MedtronicCnlSession {
return (((int) radioRSSI & 0x00FF) * 100) / 0xA8;
}
public void incrBayerSequenceNumber() {
bayerSequenceNumber++;
public void incrCnlSequenceNumber() {
cnlSequenceNumber++;
}
public void incrMedtronicSequenceNumber() {
......
......@@ -43,7 +43,7 @@ public abstract class ContourNextLinkBinaryRequestMessage<T> extends ContourNext
*/
protected void sendMessage(UsbHidDriver mDevice) throws IOException {
super.sendMessage(mDevice);
mPumpSession.incrBayerSequenceNumber();
mPumpSession.incrCnlSequenceNumber();
}
protected static byte[] buildPayload(CommandType commandType, MedtronicCnlSession pumpSession, byte[] payload) {
......@@ -58,7 +58,7 @@ public abstract class ContourNextLinkBinaryRequestMessage<T> extends ContourNext
byte[] unknownBytes = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
payloadBuffer.put(unknownBytes);
payloadBuffer.put(commandType.getValue());
payloadBuffer.putInt(pumpSession.getBayerSequenceNumber());
payloadBuffer.putInt(pumpSession.getCnlSequenceNumber());
byte[] unknownBytes2 = {0, 0, 0, 0, 0};
payloadBuffer.put(unknownBytes2);
payloadBuffer.putInt(payloadLength);
......
......@@ -18,7 +18,7 @@ public abstract class ContourNextLinkMessage {
private static final int USB_BLOCKSIZE = 64;
private static final int READ_TIMEOUT_MS = 15000; //ASTM standard is 15 seconds (note was previously set at 10 seconds)
private static final String BAYER_USB_HEADER = "ABC";
private static final String USB_HEADER = "ABC";
protected ByteBuffer mPayload;
......@@ -94,7 +94,7 @@ public abstract class ContourNextLinkMessage {
while (message.length > pos) {
ByteBuffer outputBuffer = ByteBuffer.allocate(USB_BLOCKSIZE);
int sendLength = (pos + 60 > message.length) ? message.length - pos : 60;
outputBuffer.put(BAYER_USB_HEADER.getBytes());
outputBuffer.put(USB_HEADER.getBytes());
outputBuffer.put((byte) sendLength);
outputBuffer.put(message, pos, sendLength);
......@@ -123,7 +123,7 @@ public abstract class ContourNextLinkMessage {
ByteBuffer header = ByteBuffer.allocate(3);
header.put(responseBuffer, 0, 3);
String headerString = new String(header.array());
if (!headerString.equals(BAYER_USB_HEADER)) {
if (!headerString.equals(USB_HEADER)) {
throw new IOException("Unexpected header received");
}
messageSize = responseBuffer[3];
......
......@@ -138,7 +138,7 @@ public class MedtronicCnlIntentService extends IntentService {
UsbDevice cnlStick = UsbHidDriver.getUsbDevice(mUsbManager, USB_VID, USB_PID);
if (cnlStick == null) {
sendStatus("USB connection error. Is the Bayer Contour Next Link plugged in?");
sendStatus("USB connection error. Is the Contour Next Link plugged in?");
Log.w(TAG, "USB connection error. Is the CNL plugged in?");
// TODO - set status if offline or Nightscout not reachable
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment