From f0de865dfdf1993a70a49c445f3184954e677f50 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 11 Nov 2015 10:41:20 +1300 Subject: Add support for GV300 iButton --- src/org/traccar/protocol/Gl200ProtocolDecoder.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') 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()); -- cgit v1.2.3