aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/Gl200ProtocolDecoder.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
index 4b9f6837a..28b1005df 100644
--- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java
@@ -195,10 +195,10 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN = new PatternBuilder()
.text("+").expression("(?:RESP|BUFF):GT...,")
.number("(?:[0-9A-Z]{2}xxxx)?,") // protocol version
- .number("(d{15}),") // imei
+ .number("(d{15}|x{14}),") // imei
.expression("[^,]*,") // device name
.number("d*,")
- .number("d{1,2},") // report type
+ .number("(d{1,2}),") // report type
.number("d{1,2},") // count
.expression(PATTERN_LOCATION.pattern())
.groupBegin()
@@ -476,7 +476,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
return position;
}
- private Object decodeOther(Channel channel, SocketAddress remoteAddress, String sentence) {
+ private Object decodeOther(Channel channel, SocketAddress remoteAddress, String sentence, String type) {
Parser parser = new Parser(PATTERN, sentence);
if (!parser.matches()) {
return null;
@@ -490,6 +490,11 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
}
position.setDeviceId(getDeviceId());
+ int reportType = parser.nextInt();
+ if (type.equals("NMR")) {
+ position.set(Event.KEY_MOTION, reportType);
+ }
+
decodeLocation(position, parser);
position.set(Event.KEY_ODOMETER, parser.next());
@@ -565,7 +570,8 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
}
Object result;
- switch (sentence.substring(typeIndex + 3, typeIndex + 6)) {
+ String type = sentence.substring(typeIndex + 3, typeIndex + 6);
+ switch (type) {
case "HBD":
result = decodeHbd(channel, remoteAddress, sentence);
break;
@@ -586,7 +592,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder {
result = decodeIda(channel, remoteAddress, sentence);
break;
default:
- result = decodeOther(channel, remoteAddress, sentence);
+ result = decodeOther(channel, remoteAddress, sentence, type);
break;
}