diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-18 14:25:43 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-06-18 14:25:43 +1200 |
commit | 16e6c030243d5a3bd77df4faddba91bdfea0bfad (patch) | |
tree | 0d4fda7e4014b5fc8557f2a2d163fb13719e31d5 /src/org | |
parent | b03f931ee7a294650a919c7b85e3bb988c913277 (diff) | |
download | traccar-server-16e6c030243d5a3bd77df4faddba91bdfea0bfad.tar.gz traccar-server-16e6c030243d5a3bd77df4faddba91bdfea0bfad.tar.bz2 traccar-server-16e6c030243d5a3bd77df4faddba91bdfea0bfad.zip |
Implement GL300 acknowledgement
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/protocol/Gl200ProtocolDecoder.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 5db31a397..9383f2d4e 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -25,6 +25,7 @@ import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; import org.traccar.BaseProtocolDecoder; +import org.traccar.Context; import org.traccar.model.Event; import org.traccar.model.Position; @@ -60,7 +61,8 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { "(\\p{XDigit}{4})?," + // Cell "(?:(\\d+\\.\\d)?," + // Odometer "(\\d{1,3})?)?" + // Battery - ".*"); + ".*," + + "(\\p{XDigit}{4})\\$?"); @Override protected Object decode( @@ -72,7 +74,6 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { // Handle heartbeat Matcher parser = heartbeatPattern.matcher(sentence); if (parser.matches()) { - String s = "+SACK:GTHBD," + parser.group(1) + "," + parser.group(2) + "$"; if (channel != null) { channel.write("+SACK:GTHBD," + parser.group(1) + "," + parser.group(2) + "$", remoteAddress); } @@ -148,6 +149,10 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { } position.set(Event.KEY_BATTERY, parser.group(index++)); + if (Boolean.valueOf(Context.getProps().getProperty(getProtocol() + ".ack")) && channel != null) { + channel.write("+SACK:" + parser.group(index++) + "$", remoteAddress); + } + return position; } |