aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-03-19 21:24:09 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2019-03-19 21:24:09 -0700
commit0be9e4a11b3c288b8d6aa6a53c23623684e27e1f (patch)
tree3f08a5b4f53a07ed4184bf6a1820722e32f2689b /src/org/traccar/protocol
parent57638edf3ceb8263aad7a33fb4b860be5c3436b8 (diff)
downloadtrackermap-server-0be9e4a11b3c288b8d6aa6a53c23623684e27e1f.tar.gz
trackermap-server-0be9e4a11b3c288b8d6aa6a53c23623684e27e1f.tar.bz2
trackermap-server-0be9e4a11b3c288b8d6aa6a53c23623684e27e1f.zip
Decode additional GT06 data
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 6388455b5..0e56c9949 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2019 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -677,11 +677,31 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
decodeStatus(position, buf);
}
- if (type == MSG_GPS_LBS_1 && buf.readableBytes() >= 4 + 6) {
+ if (type == MSG_GPS_LBS_1 && buf.readableBytes() == 2 + 6) {
+ int mask = buf.readUnsignedShort();
+ position.set(Position.KEY_IGNITION, BitUtil.check(mask, 8 + 7));
+ position.set(Position.PREFIX_IN + 2, BitUtil.check(mask, 8 + 6));
+ if (BitUtil.check(mask, 8 + 4)) {
+ int value = BitUtil.to(mask, 8 + 1);
+ if (BitUtil.check(mask, 8 + 1)) {
+ value = -value;
+ }
+ position.set(Position.PREFIX_TEMP + 1, value);
+ } else {
+ int value = BitUtil.to(mask, 8 + 2);
+ if (BitUtil.check(mask, 8 + 5)) {
+ position.set(Position.PREFIX_ADC + 1, value);
+ } else {
+ position.set(Position.PREFIX_ADC + 1, value * 0.1);
+ }
+ }
+ }
+
+ if (type == MSG_GPS_LBS_1 && buf.readableBytes() == 4 + 6) {
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt());
}
- if (type == MSG_GPS_LBS_2 && buf.readableBytes() >= 3 + 6) {
+ if (type == MSG_GPS_LBS_2 && buf.readableBytes() == 3 + 6) {
position.set(Position.KEY_IGNITION, buf.readUnsignedByte() > 0);
position.set(Position.KEY_EVENT, buf.readUnsignedByte()); // reason
position.set(Position.KEY_ARCHIVE, buf.readUnsignedByte() > 0);