aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-11-18 01:45:44 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-11-18 01:45:44 +1300
commit5efc8a36b7b9f88552e70e4bded314e1b7d1e292 (patch)
treed03d6f745441cbeec9ee343740e539d220a8e5d3 /src/org/traccar
parent0d9bc43602b496aa1afdd83748388526e84cdf80 (diff)
downloadtraccar-server-5efc8a36b7b9f88552e70e4bded314e1b7d1e292.tar.gz
traccar-server-5efc8a36b7b9f88552e70e4bded314e1b7d1e292.tar.bz2
traccar-server-5efc8a36b7b9f88552e70e4bded314e1b7d1e292.zip
Decode AutoGrade status byte
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/AutoGradeProtocolDecoder.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/AutoGradeProtocolDecoder.java b/src/org/traccar/protocol/AutoGradeProtocolDecoder.java
index d520c282c..d8fe8b1a2 100644
--- a/src/org/traccar/protocol/AutoGradeProtocolDecoder.java
+++ b/src/org/traccar/protocol/AutoGradeProtocolDecoder.java
@@ -18,6 +18,7 @@ package org.traccar.protocol;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.helper.BitUtil;
import org.traccar.helper.DateBuilder;
import org.traccar.helper.Parser;
import org.traccar.helper.PatternBuilder;
@@ -43,7 +44,7 @@ public class AutoGradeProtocolDecoder extends BaseProtocolDecoder {
.number("([d.]{5})") // speed
.number("(dd)(dd)(dd)") // time
.number("([d.]{6})") // course
- .expression(".") // status
+ .expression("(.)") // status
.number("A(xxxx)")
.number("B(xxxx)")
.number("C(xxxx)")
@@ -88,6 +89,10 @@ public class AutoGradeProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(parser.nextDouble());
+ int status = (byte) parser.next().charAt(0);
+ position.set(Position.KEY_STATUS, status);
+ position.set(Position.KEY_IGNITION, BitUtil.check(status, 0));
+
for (int i = 1; i <= 5; i++) {
position.set(Position.PREFIX_ADC + i, parser.next());
}