aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/DmtProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-03-21 05:10:11 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-03-21 05:10:11 +1300
commit568e88255e282084b8af46aca3acf27f0822b2d2 (patch)
treec50af2e958043d4f2df2c8fdb123cf43b04d378e /src/org/traccar/protocol/DmtProtocolDecoder.java
parent04c087935a2bd4b703134d86bbe9456e6930c287 (diff)
downloadtrackermap-server-568e88255e282084b8af46aca3acf27f0822b2d2.tar.gz
trackermap-server-568e88255e282084b8af46aca3acf27f0822b2d2.tar.bz2
trackermap-server-568e88255e282084b8af46aca3acf27f0822b2d2.zip
Additional DMT attributes
Diffstat (limited to 'src/org/traccar/protocol/DmtProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/DmtProtocolDecoder.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/DmtProtocolDecoder.java b/src/org/traccar/protocol/DmtProtocolDecoder.java
index 6481255e9..9b4f9400b 100644
--- a/src/org/traccar/protocol/DmtProtocolDecoder.java
+++ b/src/org/traccar/protocol/DmtProtocolDecoder.java
@@ -20,6 +20,7 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
+import org.traccar.helper.BitUtil;
import org.traccar.helper.UnitsConverter;
import org.traccar.model.Position;
@@ -127,6 +128,42 @@ public class DmtProtocolDecoder extends BaseProtocolDecoder {
position.setAccuracy(buf.readUnsignedByte());
position.setValid(buf.readUnsignedByte() != 0);
+ } else if (fieldId == 2) {
+
+ int input = buf.readInt();
+ int output = buf.readUnsignedShort();
+ int status = buf.readUnsignedShort();
+
+ position.set(Position.KEY_IGNITION, BitUtil.check(input, 0));
+
+ position.set(Position.KEY_INPUT, input);
+ position.set(Position.KEY_OUTPUT, output);
+ position.set(Position.KEY_STATUS, status);
+
+ } else if (fieldId == 6) {
+
+ while (buf.readerIndex() < fieldEnd) {
+ switch (buf.readUnsignedByte()) {
+ case 1:
+ position.set(Position.KEY_BATTERY, buf.readUnsignedShort() * 0.001);
+ break;
+ case 2:
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
+ break;
+ case 3:
+ position.set(Position.KEY_DEVICE_TEMP, buf.readShort() * 0.01);
+ break;
+ case 4:
+ position.set(Position.KEY_RSSI, buf.readUnsignedShort());
+ break;
+ case 5:
+ position.set("solarPower", buf.readUnsignedShort() * 0.001);
+ break;
+ default:
+ break;
+ }
+ }
+
}
buf.readerIndex(fieldEnd);