aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-11-06 08:34:02 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-11-06 08:34:02 +1300
commit850734d2f1bef8aba5761f540caa40c23608acc6 (patch)
treee4c3fb58a3a67f3daa5c31423db9858c6e8aae82 /src/org/traccar/helper
parent77d193bf840ceb5294a6cb0d0cd6e1512e2b1efb (diff)
downloadtrackermap-server-850734d2f1bef8aba5761f540caa40c23608acc6.tar.gz
trackermap-server-850734d2f1bef8aba5761f540caa40c23608acc6.tar.bz2
trackermap-server-850734d2f1bef8aba5761f540caa40c23608acc6.zip
Fix NMEA checksum calculation (fix #2405)
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r--src/org/traccar/helper/Checksum.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/org/traccar/helper/Checksum.java b/src/org/traccar/helper/Checksum.java
index 629f6e7ca..f08292392 100644
--- a/src/org/traccar/helper/Checksum.java
+++ b/src/org/traccar/helper/Checksum.java
@@ -204,8 +204,9 @@ public final class Checksum {
public static String nmea(String msg) {
int checksum = 0;
- for (byte b : msg.getBytes(StandardCharsets.US_ASCII)) {
- checksum ^= b;
+ byte[] bytes = msg.getBytes(StandardCharsets.US_ASCII);
+ for (int i = 1; i < bytes.length; i++) {
+ checksum ^= bytes[i];
}
return String.format("*%02x", checksum).toUpperCase();
}