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,25 @@
package com.eveningoutpost.dexdrip.G5Model;
import com.eveningoutpost.dexdrip.ImportedLibraries.dexcom.CRC16;
/**
* Created by jcostik1 on 3/24/16.
*/
public class CRC {
public static byte[] calculate(byte b) {
int crcShort = 0;
crcShort = ((crcShort >>> 8) | (crcShort << 8)) & 0xffff;
crcShort ^= (b & 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)};
}
public static byte[] calculate(byte[] bytes, int start, int end) {
return CRC16.calculate(bytes, 0, end);
}
}