diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-12-06 14:53:03 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-12-06 14:53:22 +1300 |
commit | 9ec8be4360ad3088af66d9fd432d9a85cd0ee074 (patch) | |
tree | 2955c967858b3f4251eeb69c598263c14614f64d | |
parent | c166601c0344ca826043c15688aac43de3c490d1 (diff) | |
download | trackermap-server-9ec8be4360ad3088af66d9fd432d9a85cd0ee074.tar.gz trackermap-server-9ec8be4360ad3088af66d9fd432d9a85cd0ee074.tar.bz2 trackermap-server-9ec8be4360ad3088af66d9fd432d9a85cd0ee074.zip |
Support JT701 protocol version
-rw-r--r-- | src/org/traccar/protocol/Jt600ProtocolDecoder.java | 8 | ||||
-rw-r--r-- | test/org/traccar/protocol/Jt600ProtocolDecoderTest.java | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index 58835c7d6..e935c1449 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -63,8 +63,9 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { return null; } + int protocolVersion = 0; if (longFormat) { - buf.readUnsignedByte(); // protocol + protocolVersion = buf.readUnsignedByte(); } int version = BitUtil.from(buf.readUnsignedByte(), 4); @@ -122,6 +123,11 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { cellTower.setSignalStrength((int) buf.readUnsignedByte()); position.setNetwork(new Network(cellTower)); + if (protocolVersion == 0x17) { + buf.readUnsignedByte(); // geofence id + buf.skipBytes(3); // reserved + } + } else if (version == 1) { position.set(Position.KEY_SATELLITES, buf.readUnsignedByte()); diff --git a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java index 33959bc29..dd01ef783 100644 --- a/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Jt600ProtocolDecoderTest.java @@ -12,6 +12,9 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest { Jt600ProtocolDecoder decoder = new Jt600ProtocolDecoder(new Jt600Protocol()); verifyPositions(decoder, binary( + "2475609213701711002701010000020200000000000000000e00000000000f000000000020c164cd7b00d516000f0f0f02")); + + verifyPositions(decoder, binary( "24657060730131001b13111710361906538525079524797f000000000000000003f300036c")); verifyPositions(decoder, binary( |