aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/helper
diff options
context:
space:
mode:
authorStefan Clark <stefanclark@gmail.com>2022-08-06 17:42:22 +0100
committerStefan Clark <stefanclark@gmail.com>2022-08-06 17:42:22 +0100
commitdbc5fc5dcf697dcc00d357bbca5fe4669325148b (patch)
tree86396e0e6f4f2baa2af9e43f17b749eae7f651ec /src/main/java/org/traccar/helper
parent42e88c2bf95962f1274a8bbb6e8fc09af95f627f (diff)
downloadtrackermap-server-dbc5fc5dcf697dcc00d357bbca5fe4669325148b.tar.gz
trackermap-server-dbc5fc5dcf697dcc00d357bbca5fe4669325148b.tar.bz2
trackermap-server-dbc5fc5dcf697dcc00d357bbca5fe4669325148b.zip
Updated Xexun2 Protocol
Diffstat (limited to 'src/main/java/org/traccar/helper')
-rw-r--r--src/main/java/org/traccar/helper/Checksum.java8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/helper/Checksum.java b/src/main/java/org/traccar/helper/Checksum.java
index e660790ef..db5817275 100644
--- a/src/main/java/org/traccar/helper/Checksum.java
+++ b/src/main/java/org/traccar/helper/Checksum.java
@@ -200,18 +200,14 @@ public final class Checksum {
return (10 - (checksum % 10)) % 10;
}
- public static int udp(ByteBuffer data) {
+ public static int ip(ByteBuffer data) {
int sum = 0;
- int len = data.capacity();
- for (int j = 0; len > 1; len--) {
+ while (data.remaining() > 0) {
sum += data.get() & 0xff;
if ((sum & 0x80000000) > 0) {
sum = (sum & 0xffff) + (sum >> 16);
}
}
- if (len == 1) {
- sum += data.get() & 0xff;
- }
while ((sum >> 16) > 0) {
sum = (sum & 0xffff) + sum >> 16;
}