aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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;
}