diff options
author | Anton Tananaev <anton@traccar.org> | 2023-02-17 08:16:37 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-02-17 08:16:37 -0800 |
commit | ec2b7b64a83aa1c3dcd0cd69c1ae7b2d0d8a7864 (patch) | |
tree | 8ea35258d07932b7e23301a68b1478bc62140ffe /src/main/java/org/traccar | |
parent | 596036dc3380e0750d27c814a4d3bb94f4c7e1ea (diff) | |
download | trackermap-server-ec2b7b64a83aa1c3dcd0cd69c1ae7b2d0d8a7864.tar.gz trackermap-server-ec2b7b64a83aa1c3dcd0cd69c1ae7b2d0d8a7864.tar.bz2 trackermap-server-ec2b7b64a83aa1c3dcd0cd69c1ae7b2d0d8a7864.zip |
Support GL600 frames
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/Jt600FrameDecoder.java | 2 | ||||
-rw-r--r-- | src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/Jt600FrameDecoder.java b/src/main/java/org/traccar/protocol/Jt600FrameDecoder.java index bfefb94a7..f7890f814 100644 --- a/src/main/java/org/traccar/protocol/Jt600FrameDecoder.java +++ b/src/main/java/org/traccar/protocol/Jt600FrameDecoder.java @@ -35,7 +35,7 @@ public class Jt600FrameDecoder extends BaseFrameDecoder { char type = (char) buf.getByte(buf.readerIndex()); if (type == '$') { - boolean longFormat = Jt600ProtocolDecoder.isLongFormat(buf, buf.readerIndex() + 1); + boolean longFormat = Jt600ProtocolDecoder.isLongFormat(buf); int length = buf.getUnsignedShort(buf.readerIndex() + (longFormat ? 8 : 7)) + 10; if (length <= buf.readableBytes()) { return buf.readRetainedSlice(length); diff --git a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java index 9ed44f565..dc763dea7 100644 --- a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -86,8 +86,8 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { } - static boolean isLongFormat(ByteBuf buf, int flagIndex) { - return buf.getUnsignedByte(flagIndex) >> 4 >= 7; + static boolean isLongFormat(ByteBuf buf) { + return buf.getUnsignedByte(buf.readerIndex() + 8) == 0; } static void decodeBinaryLocation(ByteBuf buf, Position position) { @@ -123,9 +123,9 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { List<Position> positions = new LinkedList<>(); - buf.readByte(); // header + boolean longFormat = isLongFormat(buf); - boolean longFormat = isLongFormat(buf, buf.readerIndex()); + buf.readByte(); // header String id = String.valueOf(Long.parseLong(ByteBufUtil.hexDump(buf.readSlice(5)))); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id); |