diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-11 10:41:20 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-11-11 10:41:20 +1300 |
commit | f0de865dfdf1993a70a49c445f3184954e677f50 (patch) | |
tree | 92167b2f26ec2e754b67e22df1be93f29b2a3664 /src/org/traccar | |
parent | b21ac014140a61bb23801b9d07679a83e2282d6b (diff) | |
download | trackermap-server-f0de865dfdf1993a70a49c445f3184954e677f50.tar.gz trackermap-server-f0de865dfdf1993a70a49c445f3184954e677f50.tar.bz2 trackermap-server-f0de865dfdf1993a70a49c445f3184954e677f50.zip |
Add support for GV300 iButton
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/Gl200ProtocolDecoder.java | 13 |
1 files changed, 10 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()); |