From 5efc8a36b7b9f88552e70e4bded314e1b7d1e292 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 18 Nov 2016 01:45:44 +1300 Subject: Decode AutoGrade status byte --- src/org/traccar/protocol/AutoGradeProtocolDecoder.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/org/traccar/protocol') 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()); } -- cgit v1.2.3