aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-09-26 18:31:28 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-09-26 18:31:28 +1200
commit577b4c6ed826ce723299b42c12a7ca1a29262395 (patch)
treef43d4bf8cd0402f35caaaefbb39a030e30eebaaf /src
parent28f49cce7fd77194a406bb87b20155b7872ccb62 (diff)
downloadtraccar-server-577b4c6ed826ce723299b42c12a7ca1a29262395.tar.gz
traccar-server-577b4c6ed826ce723299b42c12a7ca1a29262395.tar.bz2
traccar-server-577b4c6ed826ce723299b42c12a7ca1a29262395.zip
Decode Tytan additional data
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/TytanProtocolDecoder.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java
index bfb1e33a3..04d095a9f 100644
--- a/src/org/traccar/protocol/TytanProtocolDecoder.java
+++ b/src/org/traccar/protocol/TytanProtocolDecoder.java
@@ -115,7 +115,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
switch (type) {
case 2:
- position.set(Event.KEY_ODOMETER, buf.readUnsignedMedium());
+ position.set(Event.KEY_ODOMETER, buf.readUnsignedMedium() * 5);
break;
case 5:
position.set(Event.KEY_INPUT, buf.readUnsignedByte());
@@ -131,7 +131,13 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
}
break;
case 7:
- position.set(Event.KEY_ALARM, buf.readUnsignedShort());
+ {
+ int alarm = buf.readUnsignedByte();
+ buf.readUnsignedByte();
+ if (BitUtil.check(alarm, 5)) {
+ position.set(Event.KEY_ALARM, BitUtil.range(alarm, 0, 4));
+ }
+ }
break;
case 8:
position.set("antihijack", buf.readUnsignedByte());
@@ -165,7 +171,7 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder {
position.set(Event.KEY_POWER, readSwappedFloat(buf));
break;
case 107:
- position.set(Event.KEY_FUEL, buf.readUnsignedShort() & 0x3fff);
+ position.set(Event.KEY_FUEL, (buf.readUnsignedShort() & 0x3fff) * 0.5);
break;
case 150:
position.set("door", buf.readUnsignedByte());