aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-06-18 14:25:43 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-06-18 14:25:43 +1200
commit16e6c030243d5a3bd77df4faddba91bdfea0bfad (patch)
tree0d4fda7e4014b5fc8557f2a2d163fb13719e31d5
parentb03f931ee7a294650a919c7b85e3bb988c913277 (diff)
downloadtrackermap-server-16e6c030243d5a3bd77df4faddba91bdfea0bfad.tar.gz
trackermap-server-16e6c030243d5a3bd77df4faddba91bdfea0bfad.tar.bz2
trackermap-server-16e6c030243d5a3bd77df4faddba91bdfea0bfad.zip
Implement GL300 acknowledgement
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java9
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;
}