Initial project commit

This commit is contained in:
2020-07-18 21:44:27 -04:00
parent 8a1141b373
commit fea891a268
127 changed files with 20838 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package com.eveningoutpost.dexdrip.ImportedLibraries.dexcom;
// This code and this particular library are from the NightScout android uploader
// Check them out here: https://github.com/nightscout/android-uploader
// Some of this code may have been modified for use in this project
public class CRC16 {
public static byte[] calculate(byte[] buff, int start, int end) {
int crcShort = 0;
for (int i = start; i < end; i++) {
crcShort = ((crcShort >>> 8) | (crcShort << 8) )& 0xffff;
crcShort ^= (buff[i] & 0xff);
crcShort ^= ((crcShort & 0xff) >> 4);
crcShort ^= (crcShort << 12) & 0xffff;
crcShort ^= ((crcShort & 0xFF) << 5) & 0xffff;
}
crcShort &= 0xffff;
return new byte[] {(byte) (crcShort & 0xff), (byte) ((crcShort >> 8) & 0xff)};
}
}