diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-10-29 16:01:47 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-10-29 16:01:47 +1300 |
commit | e8f2247e719e44796a4d89f6973e3a3c0d21568a (patch) | |
tree | 0d3adbfad509349c5ba08f5c241ebae2c1f151a5 /src/org/traccar/helper/Checksum.java | |
parent | 464348b91591a684bc16cf3c207f38ca3f923daa (diff) | |
download | trackermap-server-e8f2247e719e44796a4d89f6973e3a3c0d21568a.tar.gz trackermap-server-e8f2247e719e44796a4d89f6973e3a3c0d21568a.tar.bz2 trackermap-server-e8f2247e719e44796a4d89f6973e3a3c0d21568a.zip |
Implement BCE output control
Diffstat (limited to 'src/org/traccar/helper/Checksum.java')
-rw-r--r-- | src/org/traccar/helper/Checksum.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/org/traccar/helper/Checksum.java b/src/org/traccar/helper/Checksum.java index 5aed84bf8..adfa697c5 100644 --- a/src/org/traccar/helper/Checksum.java +++ b/src/org/traccar/helper/Checksum.java @@ -160,6 +160,14 @@ public final class Checksum { return String.format("*%02x", checksum).toUpperCase(); } + public static int sum(ByteBuffer buf) { + byte checksum = 0; + while (buf.hasRemaining()) { + checksum += buf.get(); + } + return checksum; + } + public static String sum(String msg) { byte checksum = 0; for (byte b : msg.getBytes(StandardCharsets.US_ASCII)) { |