aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-11-23 09:44:37 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-11-23 09:44:37 +1300
commitb3e0f34d6dc7a996ffa70b02e480937268514b22 (patch)
tree2e931b1cad773aa6ece7d03eaf188db05be64991
parent6c0fe165f72a998d447d0983c94e234681a6b680 (diff)
downloadtraccar-server-b3e0f34d6dc7a996ffa70b02e480937268514b22.tar.gz
traccar-server-b3e0f34d6dc7a996ffa70b02e480937268514b22.tar.bz2
traccar-server-b3e0f34d6dc7a996ffa70b02e480937268514b22.zip
Support GK310 long cell format
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java6
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolDecoderTest.java3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 7703650a4..2018fb6a6 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -528,6 +528,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
if (type == MSG_LBS_MULTIPLE || type == MSG_LBS_EXTEND || type == MSG_LBS_WIFI
|| type == MSG_LBS_2 || type == MSG_WIFI_3) {
+ boolean longFormat = type == MSG_LBS_2 || type == MSG_WIFI_3;
+
DateBuilder dateBuilder = new DateBuilder(timeZone)
.setDate(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte())
.setTime(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte());
@@ -538,8 +540,8 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
int mnc = buf.readUnsignedByte();
Network network = new Network();
for (int i = 0; i < 7; i++) {
- int lac = buf.readUnsignedShort();
- int cid = buf.readUnsignedMedium();
+ int lac = longFormat ? buf.readInt() : buf.readUnsignedShort();
+ int cid = longFormat ? (int) buf.readLong() : buf.readUnsignedMedium();
int rssi = -buf.readUnsignedByte();
if (lac > 0) {
network.addCellTower(CellTower.from(mcc, mnc, lac, cid, rssi));
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index c6a95e6fc..b6493e85b 100644
--- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -20,6 +20,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
"78780B23C00122040001000818720D0A"));
verifyNotNull(decoder, binary(
+ "787880a2110b161010140136040000591200000000009d7c01020000591200000000009d7c01020000591200000000009d7c01020000591200000000009d7c01020000591200000000009d7c01020000591200000000009d7c01020000591200000000009d7c0102ff033c1e04ddc28aa6001801eb4039c90000000000000014db84730d0a"));
+
+ verifyNotNull(decoder, binary(
"78782ba701cc000000919100000000090617032b3836313832323038343735363200000000000000000100049fb60d0a"));
verifyNotNull(decoder, binary(