diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-21 17:27:48 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-21 17:28:07 +1300 |
commit | ff3cf10de072d4ee522447b05278d8c2f029a034 (patch) | |
tree | 8aa64fc4a8f44dc9c146c6c5e45aa2a6a754a560 | |
parent | 973b9e34ea077abba137d91da3000be41e35055b (diff) | |
download | trackermap-server-ff3cf10de072d4ee522447b05278d8c2f029a034.tar.gz trackermap-server-ff3cf10de072d4ee522447b05278d8c2f029a034.tar.bz2 trackermap-server-ff3cf10de072d4ee522447b05278d8c2f029a034.zip |
Implement GT06 LBS extended support (fix #2690)
-rw-r--r-- | src/org/traccar/protocol/Gt06ProtocolDecoder.java | 26 | ||||
-rw-r--r-- | test/org/traccar/protocol/Gt06ProtocolDecoderTest.java | 3 |
2 files changed, 28 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java index 9a3efa553..59c301186 100644 --- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -235,7 +235,31 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { return null; } - if (type == MSG_STRING) { + if (type == MSG_LBS_EXTEND) { + + Position position = new Position(); + position.setDeviceId(deviceSession.getDeviceId()); + position.setProtocol(getProtocolName()); + + DateBuilder dateBuilder = new DateBuilder(timeZone) + .setDate(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()) + .setTime(buf.readUnsignedByte(), buf.readUnsignedByte(), buf.readUnsignedByte()); + + getLastLocation(position, dateBuilder.getDate()); + + int mcc = buf.readUnsignedShort(); + int mnc = buf.readUnsignedByte(); + + Network network = new Network(); + for (int i = 0; i < 7; i++) { + network.addCellTower(CellTower.from( + mcc, mnc, buf.readUnsignedShort(), buf.readUnsignedMedium(), -buf.readUnsignedByte())); + } + position.setNetwork(network); + + return position; + + } if (type == MSG_STRING) { Position position = new Position(); position.setDeviceId(deviceSession.getDeviceId()); diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java index 8b6b65b8c..ea9fee0b5 100644 --- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java @@ -22,6 +22,9 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest { verifyAttributes(decoder, binary( "7979000794050000c9b63e0d0a")); + verifyNotNull(decoder, binary( + "78783b18100c0f1201010195271784005ab63617840002fa47178400ff8f4817840019f3491784005ab54b178400ff8e4c17840019f24cff0002012287c80d0a")); + verifyPosition(decoder, binary( "7878251610051b0f1c34c5022515d504b5dcd20738080902d4022bdf009cba5006640201006759680d0a")); |