aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-10-05 14:34:01 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-10-05 14:34:01 -0700
commit4ecca566c4faba5f526b92d5920f542a5b03cc95 (patch)
tree4e017e0528fbf1340f3715e215f62dc3139c8b1f /src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java
parent2e71806e6c6206acffc78f28101688963418aa6c (diff)
downloadtrackermap-server-4ecca566c4faba5f526b92d5920f542a5b03cc95.tar.gz
trackermap-server-4ecca566c4faba5f526b92d5920f542a5b03cc95.tar.bz2
trackermap-server-4ecca566c4faba5f526b92d5920f542a5b03cc95.zip
Fix frame decoding
Diffstat (limited to 'src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java
index 82abeb42e..f456cd1ef 100644
--- a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java
@@ -86,13 +86,17 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder {
}
+ static boolean isLongFormat(ByteBuf buf, int flagIndex) {
+ return buf.getUnsignedByte(flagIndex) >> 4 == 0x7;
+ }
+
private List<Position> decodeBinary(ByteBuf buf, Channel channel, SocketAddress remoteAddress) {
List<Position> positions = new LinkedList<>();
buf.readByte(); // header
- boolean longFormat = buf.getUnsignedByte(buf.readerIndex()) >> 4 == 0x7;
+ boolean longFormat = isLongFormat(buf, buf.readerIndex());
String id = String.valueOf(Long.parseLong(ByteBufUtil.hexDump(buf.readSlice(5))));
DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, id);