aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-08-19 15:12:36 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-08-19 15:12:36 +1200
commit57630bcff67afefcee680142531e94b7af53c5df (patch)
tree5ebbd52cf86d7cac81b727eb3ecccad0b258d0df /src/org/traccar/protocol
parent854ad6ce2c39695ed2cdf5f584be10be53ed6c33 (diff)
downloadtrackermap-server-57630bcff67afefcee680142531e94b7af53c5df.tar.gz
trackermap-server-57630bcff67afefcee680142531e94b7af53c5df.tar.bz2
trackermap-server-57630bcff67afefcee680142531e94b7af53c5df.zip
Decode GL520 battery level
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 675a7c1fe..164f20135 100644
--- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -175,14 +175,16 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
.compile();
private static final Pattern PATTERN_FRI = new PatternBuilder()
- .text("+").expression("(?:RESP|BUFF):GTFRI,")
+ .text("+").expression("(?:RESP|BUFF):GT...,")
.number("(?:[0-9A-Z]{2}xxxx)?,") // protocol version
.number("(d{15}|x{14}),") // imei
.expression("(?:([0-9A-Z]{17}),)?") // vin
.expression("[^,]*,") // device name
.number("(d+)?,") // power
- .number("d{1,2},") // report type
- .number("d{1,2},") // count
+ .number("d{1,2},").optional() // report type
+ .number("d{1,2},").optional() // count
+ .number(",").optional() // reserved
+ .number("(d+),").optional() // battery
.expression("((?:")
.expression(PATTERN_LOCATION.pattern())
.expression(")+)")
@@ -200,6 +202,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
.number("(?:d+.?d*|Inf|NaN)?,") // fuel consumption
.number("(d+)?,") // fuel level
.groupEnd()
+ .any()
.number("(dddd)(dd)(dd)") // date (yyyymmdd)
.number("(dd)(dd)(dd)").optional(2) // time (hhmmss)
.text(",")
@@ -711,6 +714,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
String vin = parser.next();
Integer power = parser.nextInt();
+ Integer battery = parser.nextInt();
Parser itemParser = new Parser(PATTERN_LOCATION, parser.next());
while (itemParser.find()) {
@@ -731,6 +735,9 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
if (power != null && power > 10) {
position.set(Position.KEY_POWER, power * 0.001); // only on some devices
}
+ if (battery != null) {
+ position.set(Position.KEY_BATTERY_LEVEL, battery);
+ }
if (parser.hasNext()) {
position.set(Position.KEY_ODOMETER, parser.nextDouble() * 1000);
@@ -1094,6 +1101,8 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
result = decodeCan(channel, remoteAddress, sentence);
break;
case "FRI":
+ case "GEO":
+ case "STR":
result = decodeFri(channel, remoteAddress, sentence);
break;
case "ERI":