aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-03-06 13:53:03 -0800
committerAnton Tananaev <anton@traccar.org>2022-03-06 13:53:03 -0800
commit09ee3fb9ac865d88f1966cd67fcba67d3c69e390 (patch)
treed8b03242bcbf12d56697c857cf8befc2e2a9e8ba /src
parent4d0c564b3e8a82de392ad9672c87586d9d24f73c (diff)
downloadtrackermap-server-09ee3fb9ac865d88f1966cd67fcba67d3c69e390.tar.gz
trackermap-server-09ee3fb9ac865d88f1966cd67fcba67d3c69e390.tar.bz2
trackermap-server-09ee3fb9ac865d88f1966cd67fcba67d3c69e390.zip
Support Wanway S20 format
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java14
-rw-r--r--src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java3
2 files changed, 14 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index ec09f371b..4d3448e84 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2021 Anton Tananaev (anton@traccar.org)
+Supp * Copyright 2012 - 2022 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.
@@ -712,11 +712,17 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
getLastLocation(position, dateBuilder.getDate());
+ boolean hasCellCount = type == MSG_LBS_MULTIPLE_3 && dataLength == 44;
+
+ if (hasCellCount) {
+ buf.readUnsignedByte(); // ta
+ }
+
int mcc = buf.readUnsignedShort();
int mnc = BitUtil.check(mcc, 15) ? buf.readUnsignedShort() : buf.readUnsignedByte();
Network network = new Network();
- int cellCount = type == MSG_WIFI_5 ? 6 : 7;
+ int cellCount = hasCellCount ? buf.readUnsignedByte() : type == MSG_WIFI_5 ? 6 : 7;
for (int i = 0; i < cellCount; i++) {
int lac = longFormat ? buf.readInt() : buf.readUnsignedShort();
int cid = longFormat ? (int) buf.readLong() : buf.readUnsignedMedium();
@@ -726,7 +732,9 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
}
- buf.readUnsignedByte(); // time leads
+ if (!hasCellCount) {
+ buf.readUnsignedByte(); // ta
+ }
if (type != MSG_LBS_MULTIPLE_1 && type != MSG_LBS_MULTIPLE_2 && type != MSG_LBS_MULTIPLE_3
&& type != MSG_LBS_2) {
diff --git a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index 8aadb7fe3..ad65ec960 100644
--- a/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -18,6 +18,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
"78780D01086471700328358100093F040D0A"));
verifyNotNull(decoder, binary(
+ "787831241603060c231e000194620213ee00606a3413ee0060692e000000000000000000000000000000000000000000003a0cb70d0a"));
+
+ verifyNotNull(decoder, binary(
"78783B2810010D02020201CC00287D001F713E287D001F7231287D001E232D287D001F4018000000000000000000000000000000000000FF00020005B14B0D0A"));
verifyNotNull(decoder, binary(