aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Jt600FrameDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-09-30 02:58:57 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-09-30 02:58:57 +1300
commit7d8f4290bbd4400152660923f4e8024d016b27ec (patch)
tree00d4675384a6ebd177dfd36e6ba4899c02f1382e /src/org/traccar/protocol/Jt600FrameDecoder.java
parent2484aa3465994e7281cd98427cdc338f5cbdbce1 (diff)
downloadtrackermap-server-7d8f4290bbd4400152660923f4e8024d016b27ec.tar.gz
trackermap-server-7d8f4290bbd4400152660923f4e8024d016b27ec.tar.bz2
trackermap-server-7d8f4290bbd4400152660923f4e8024d016b27ec.zip
Implement JT701 device support
Diffstat (limited to 'src/org/traccar/protocol/Jt600FrameDecoder.java')
-rw-r--r--src/org/traccar/protocol/Jt600FrameDecoder.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Jt600FrameDecoder.java b/src/org/traccar/protocol/Jt600FrameDecoder.java
index cb7fce0c0..bc6ad1b53 100644
--- a/src/org/traccar/protocol/Jt600FrameDecoder.java
+++ b/src/org/traccar/protocol/Jt600FrameDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2013 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2012 - 2016 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,8 @@ public class Jt600FrameDecoder extends FrameDecoder {
char type = (char) buf.getByte(buf.readerIndex());
if (type == '$') {
- int length = buf.getUnsignedShort(buf.readerIndex() + 7) + 10;
+ boolean longFormat = buf.getUnsignedByte(buf.readerIndex() + 1) == 0x75;
+ int length = buf.getUnsignedShort(buf.readerIndex() + (longFormat ? 8 : 7)) + 10;
if (length >= buf.readableBytes()) {
return buf.readBytes(length);
}