aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-20 10:01:06 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-20 10:01:06 +1300
commitaac5af7aa0c2449459c88282dfcab5bee7785a6a (patch)
treea9c07ab339357a37e681ee5615e0f6377fc4c1dc
parentde9a600541738bd14608e740b495693f79bc97a1 (diff)
downloadtrackermap-server-aac5af7aa0c2449459c88282dfcab5bee7785a6a.tar.gz
trackermap-server-aac5af7aa0c2449459c88282dfcab5bee7785a6a.tar.bz2
trackermap-server-aac5af7aa0c2449459c88282dfcab5bee7785a6a.zip
Add support for GT300 message format
-rw-r--r--src/org/traccar/protocol/Gl100Protocol.java9
-rw-r--r--src/org/traccar/protocol/Gl100ProtocolDecoder.java2
-rw-r--r--src/org/traccar/protocol/Gl200Protocol.java1
-rw-r--r--test/org/traccar/protocol/Gl100ProtocolDecoderTest.java9
4 files changed, 19 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gl100Protocol.java b/src/org/traccar/protocol/Gl100Protocol.java
index 9867c653a..cc2c826ab 100644
--- a/src/org/traccar/protocol/Gl100Protocol.java
+++ b/src/org/traccar/protocol/Gl100Protocol.java
@@ -15,6 +15,7 @@
*/
package org.traccar.protocol;
+import org.jboss.netty.bootstrap.ConnectionlessBootstrap;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.handler.codec.string.StringDecoder;
@@ -42,6 +43,14 @@ public class Gl100Protocol extends BaseProtocol {
pipeline.addLast("objectDecoder", new Gl100ProtocolDecoder(Gl100Protocol.this));
}
});
+ serverList.add(new TrackerServer(new ConnectionlessBootstrap(), this.getName()) {
+ @Override
+ protected void addSpecificHandlers(ChannelPipeline pipeline) {
+ pipeline.addLast("stringDecoder", new StringDecoder());
+ pipeline.addLast("stringEncoder", new StringEncoder());
+ pipeline.addLast("objectDecoder", new Gl100ProtocolDecoder(Gl100Protocol.this));
+ }
+ });
}
}
diff --git a/src/org/traccar/protocol/Gl100ProtocolDecoder.java b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
index 1a144ae27..db5e60838 100644
--- a/src/org/traccar/protocol/Gl100ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl100ProtocolDecoder.java
@@ -37,7 +37,7 @@ public class Gl100ProtocolDecoder extends BaseProtocolDecoder {
.groupBegin()
.number("d+,") // number
.number("d,") // reserved / geofence id
- .number("d") // reserved / geofence alert
+ .number("d+") // reserved / geofence alert // battery
.or()
.number("[^,]*") // calling number
.groupEnd(",")
diff --git a/src/org/traccar/protocol/Gl200Protocol.java b/src/org/traccar/protocol/Gl200Protocol.java
index f007001c0..4162b0fc2 100644
--- a/src/org/traccar/protocol/Gl200Protocol.java
+++ b/src/org/traccar/protocol/Gl200Protocol.java
@@ -46,7 +46,6 @@ public class Gl200Protocol extends BaseProtocol {
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), this.getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
-
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectDecoder", new Gl200ProtocolDecoder(Gl200Protocol.this));
diff --git a/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java
index f86cab503..1e4490f09 100644
--- a/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl100ProtocolDecoderTest.java
@@ -11,6 +11,15 @@ public class Gl100ProtocolDecoderTest extends ProtocolTest {
Gl100ProtocolDecoder decoder = new Gl100ProtocolDecoder(new Gl100Protocol());
+ verifyPosition(decoder, text(
+ "+RESP:GTTRI,359464030439249,1,0,61,1,0.0,346,-2.7,2,-80.392825,26.122424,20151214000354,0310,0260,72BC,35F5,00,04B6,0102070407"));
+
+ verifyPosition(decoder, text(
+ "+RESP:GTTRI,135790246811220,1,0,0,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,11F0,0102070202"));
+
+ verifyPosition(decoder, text(
+ "+RESP:GTTRI,135790246811220,2,0,0,1,4.3,92,70.0,1,121.354335,31.222073,20090101000000,0460,0000,18d8,6141,00,1,-3.6,145,30.0,2,121.354442,31.221940,20090101000100,0460,0000,18d8,6141,00,11F0,0102070202"));
+
verifyNothing(decoder, text(
"AT+GTHBD=HeartBeat,359231030000010,20090101000000,11F0,0102120204"));