diff options
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/AutoGradeProtocolDecoder.java | 7 | ||||
-rw-r--r-- | src/org/traccar/protocol/UproProtocolDecoder.java | 2 |
2 files changed, 7 insertions, 2 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()); } diff --git a/src/org/traccar/protocol/UproProtocolDecoder.java b/src/org/traccar/protocol/UproProtocolDecoder.java index c6f400cae..24a0f5dcd 100644 --- a/src/org/traccar/protocol/UproProtocolDecoder.java +++ b/src/org/traccar/protocol/UproProtocolDecoder.java @@ -127,7 +127,7 @@ public class UproProtocolDecoder extends BaseProtocolDecoder { odometer <<= 4; odometer += data[i].charAt(j) - '0'; } - position.set(Position.KEY_ODOMETER, odometer); + position.set(Position.KEY_ODOMETER, odometer * 2 * 1852 / 3600); break; case 'P': position.set(Position.KEY_MCC, Integer.parseInt(data[i].substring(1, 5))); |