aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/Crc.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-01-18 19:07:39 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2014-01-18 19:07:39 +1300
commitba4af96c2b771e3984887de0a4d2d7338aed1270 (patch)
tree1a44ff7bd7d8292d67986b7c51aa1b50504050d1 /src/org/traccar/helper/Crc.java
parent0f0bcf8bf31723e67d703d8ea67e40a921536d9a (diff)
downloadtrackermap-server-ba4af96c2b771e3984887de0a4d2d7338aed1270.tar.gz
trackermap-server-ba4af96c2b771e3984887de0a4d2d7338aed1270.tar.bz2
trackermap-server-ba4af96c2b771e3984887de0a4d2d7338aed1270.zip
Implement KHD protocol
Diffstat (limited to 'src/org/traccar/helper/Crc.java')
-rw-r--r--src/org/traccar/helper/Crc.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/org/traccar/helper/Crc.java b/src/org/traccar/helper/Crc.java
index 84224a781..5a668f30a 100644
--- a/src/org/traccar/helper/Crc.java
+++ b/src/org/traccar/helper/Crc.java
@@ -136,6 +136,14 @@ public class Crc {
}
return (int) checksum.getValue();
}
+
+ public static int xorChecksum(ByteBuffer buf) {
+ int checksum = 0;
+ for (int i = 0; i < buf.remaining(); i++) {
+ checksum ^= buf.get(i);
+ }
+ return checksum;
+ }
public static String nmeaChecksum(String msg) {
int checksum = 0;