aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-11 10:41:20 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-11 10:41:20 +1300
commitf0de865dfdf1993a70a49c445f3184954e677f50 (patch)
tree92167b2f26ec2e754b67e22df1be93f29b2a3664
parentb21ac014140a61bb23801b9d07679a83e2282d6b (diff)
downloadtrackermap-server-f0de865dfdf1993a70a49c445f3184954e677f50.tar.gz
trackermap-server-f0de865dfdf1993a70a49c445f3184954e677f50.tar.bz2
trackermap-server-f0de865dfdf1993a70a49c445f3184954e677f50.zip
Add support for GV300 iButton
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java13
-rw-r--r--test/org/traccar/protocol/Gl200ProtocolDecoderTest.java3
2 files changed, 13 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index a0d8bd1b2..bf481667e 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -131,7 +131,9 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
protected Object decode(
Channel channel, SocketAddress remoteAddress, Object msg) throws Exception {
- Parser parser = new Parser(PATTERN_HEARTBEAT, (String) msg);
+ String sentence = (String) msg;
+
+ Parser parser = new Parser(PATTERN_HEARTBEAT, sentence);
if (parser.matches()) {
if (channel != null) {
channel.write("+SACK:GTHBD," + parser.next() + "," + parser.next() + "$", remoteAddress);
@@ -139,7 +141,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
return null;
}
- parser = new Parser(PATTERN_INF, (String) msg);
+ parser = new Parser(PATTERN_INF, sentence);
if (parser.matches()) {
Position position = new Position();
@@ -166,7 +168,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
return position;
}
- parser = new Parser(PATTERN, (String) msg);
+ parser = new Parser(PATTERN, sentence);
if (!parser.matches()) {
return null;
}
@@ -179,6 +181,11 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
+ // RFID
+ if (sentence.startsWith("+RESP:GTIDA")) {
+ position.set(Event.KEY_RFID, sentence.split(",")[5]);
+ }
+
// OBD
position.set(Event.KEY_RPM, parser.next());
position.set(Event.KEY_OBD_SPEED, parser.next());
diff --git a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
index 4596a5c90..1f5242b9c 100644
--- a/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200ProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class Gl200ProtocolDecoderTest extends ProtocolDecoderTest {
Gl200ProtocolDecoder decoder = new Gl200ProtocolDecoder(new Gl200Protocol());
+ verifyPosition(decoder, text(
+ "+RESP:GTIDA,06020A,862170013895931,,,D2C4FBC5,1,1,1,0.8,0,22.2,117.198630,31.845229,20120802121626,0460,0000,5663,2BB9,00,0.0,,,,,20120802121627,008E$"));
+
verifyAttributes(decoder, text(
"+RESP:GTINF,1F0101,135790246811220,1G1JC5444R7252367,,16,898600810906F8048812,16,0,1,12000,,4.2,0,0,,,20090214013254,,,,,,+0800,0,20090214093254,11F0$"));