From 577b4c6ed826ce723299b42c12a7ca1a29262395 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 26 Sep 2015 18:31:28 +1200 Subject: Decode Tytan additional data --- src/org/traccar/protocol/TytanProtocolDecoder.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') 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()); -- cgit v1.2.3