aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-03-26 20:51:13 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-03-26 20:51:13 -0700
commit0cd2d9e4d78fd586f71027e4eab486b047a7383e (patch)
tree7e9ae39b2c8c26958a088a581816e3b51836a357
parent854e4c6f1de4620b86842ebd5f21aa26b3f13f2f (diff)
downloadtrackermap-server-0cd2d9e4d78fd586f71027e4eab486b047a7383e.tar.gz
trackermap-server-0cd2d9e4d78fd586f71027e4eab486b047a7383e.tar.bz2
trackermap-server-0cd2d9e4d78fd586f71027e4eab486b047a7383e.zip
Update binary frame decoding
-rw-r--r--src/main/java/org/traccar/protocol/Gl200FrameDecoder.java3
-rw-r--r--src/test/java/org/traccar/protocol/Gl200FrameDecoderTest.java4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/Gl200FrameDecoder.java b/src/main/java/org/traccar/protocol/Gl200FrameDecoder.java
index c192cc28d..4ce243425 100644
--- a/src/main/java/org/traccar/protocol/Gl200FrameDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gl200FrameDecoder.java
@@ -31,7 +31,7 @@ public class Gl200FrameDecoder extends BaseFrameDecoder {
private static final int MINIMUM_LENGTH = 11;
private static final Set<String> BINARY_HEADERS = new HashSet<>(
- Arrays.asList("+RSP", "+BSP", "+EVT", "+BVT", "+INF", "+BNF", "+HBD", "+CRD", "+BRD"));
+ Arrays.asList("+RSP", "+BSP", "+EVT", "+BVT", "+INF", "+BNF", "+HBD", "+CRD", "+BRD", "+LGN"));
public static boolean isBinary(ByteBuf buf) {
String header = buf.toString(buf.readerIndex(), 4, StandardCharsets.US_ASCII);
@@ -66,6 +66,7 @@ public class Gl200FrameDecoder extends BaseFrameDecoder {
break;
case "+CRD":
case "+BRD":
+ case "+LGN":
length = buf.getUnsignedShort(buf.readerIndex() + 6);
break;
default:
diff --git a/src/test/java/org/traccar/protocol/Gl200FrameDecoderTest.java b/src/test/java/org/traccar/protocol/Gl200FrameDecoderTest.java
index e90c6495a..ed5e9d226 100644
--- a/src/test/java/org/traccar/protocol/Gl200FrameDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gl200FrameDecoderTest.java
@@ -13,8 +13,8 @@ public class Gl200FrameDecoderTest extends ProtocolTest {
Gl200FrameDecoder decoder = new Gl200FrameDecoder();
assertEquals(
- binary("2b41434b017f244501010108676231303000000000ffff07e1070b03112d054dfe030d0a"),
- decoder.decode(null, null, binary("2b41434b017f244501010108676231303000000000ffff07e1070b03112d054dfe030d0a")));
+ binary("2b4c474e00ff0026fe110b07020106563454040d054905000007e4031911213905083abd0d0a"),
+ decoder.decode(null, null, binary("2b4c474e00ff0026fe110b07020106563454040d054905000007e4031911213905083abd0d0a")));
assertEquals(
binary("2b4556540c00fc1fbf005c4501010108563254030003430564312a41090100000000003f007dff75a11a025c6a7807e1070a14041202680003189c1ac500000000000000000000000000000000000007e1070b041134054e5c6e0d0a"),