From d6d8a33bd28a5e9c2e712f0a2f7041cb681a28d7 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 11 Oct 2021 22:54:11 -0700 Subject: Support JT701 devices --- src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java | 6 +++--- src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java | 4 ++++ src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java index d745153a4..37c1674d4 100644 --- a/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2019 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -87,7 +87,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { } static boolean isLongFormat(ByteBuf buf, int flagIndex) { - return buf.getUnsignedByte(flagIndex) >> 4 == 0x7; + return buf.getUnsignedByte(flagIndex) >> 4 >= 7; } static void decodeBinaryLocation(ByteBuf buf, Position position) { @@ -176,7 +176,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { cellTower.setSignalStrength((int) buf.readUnsignedByte()); position.setNetwork(new Network(cellTower)); - if (protocolVersion == 0x17) { + if (protocolVersion == 0x17 || protocolVersion == 0x19) { buf.readUnsignedByte(); // geofence id buf.skipBytes(3); // reserved buf.skipBytes(buf.readableBytes() - 1); diff --git a/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java index cd2d5b102..eda97ba2d 100644 --- a/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Jt600FrameDecoderTest.java @@ -10,6 +10,10 @@ public class Jt600FrameDecoderTest extends ProtocolTest { var decoder = new Jt600FrameDecoder(); + verifyFrame( + binary("2480413009781914003406102107544354193631006213423b00000000006c070000000020e064f91ea0671d00020f0f0f0f0f0f0f0f0f0f07f100ea0f6e"), + decoder.decode(null, null, binary("2480413009781914003406102107544354193631006213423b00000000006c070000000020e064f91ea0671d00020f0f0f0f0f0f0f0f0f0f07f100ea0f6e"))); + verifyFrame( binary("2478905197081711003405101917164812492365028134847d0a1c000002640c0000000020c032759600731000000f0f0f0f0f0f0f0f0f0f000702850274"), decoder.decode(null, null, binary("2478905197081711003405101917164812492365028134847d0a1c000002640c0000000020c032759600731000000f0f0f0f0f0f0f0f0f0f000702850274"))); diff --git a/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java index be384c0f1..3c681ec58 100644 --- a/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/Jt600ProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class Jt600ProtocolDecoderTest extends ProtocolTest { var decoder = new Jt600ProtocolDecoder(null); + verifyPositions(decoder, binary( + "2480413009781914003406102107544354193631006213423b00000000006c070000000020e064f91ea0671d00020f0f0f0f0f0f0f0f0f0f07f100ea0f6e")); + verifyPositions(decoder, binary( "2478807035371711003419081920061851380856003256223b000000000000070000000020c0ff965d54de1800000f0f0f0f0f0f0f0f0f0f02d600ea0a21")); -- cgit v1.2.3