aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-05-08 22:59:58 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-05-08 22:59:58 +1200
commit986912687a15f3d1376beae751a9160c3db5dc7a (patch)
treefef077321f44d2de04a1457b7ef87bd8ecf0df1e /src/org/traccar/protocol/TeltonikaProtocolDecoder.java
parent86796b2c2c46e866af63c599a83b4de0112b78f1 (diff)
downloadtrackermap-server-986912687a15f3d1376beae751a9160c3db5dc7a.tar.gz
trackermap-server-986912687a15f3d1376beae751a9160c3db5dc7a.tar.bz2
trackermap-server-986912687a15f3d1376beae751a9160c3db5dc7a.zip
Add IO support for Teltonika (fix #143)
Diffstat (limited to 'src/org/traccar/protocol/TeltonikaProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 4d9e72588..a7bdf6132 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -87,12 +87,31 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("event", buf.readUnsignedByte());
- // Skip IO data
buf.readUnsignedByte(); // total IO data records
- buf.skipBytes(buf.readUnsignedByte() * (1 + 1));
- buf.skipBytes(buf.readUnsignedByte() * (1 + 2));
- buf.skipBytes(buf.readUnsignedByte() * (1 + 4));
- buf.skipBytes(buf.readUnsignedByte() * (1 + 8));
+
+ // Read 1 byte data
+ int cnt = buf.readUnsignedByte();
+ for (int j = 0; j < cnt; j++) {
+ extendedInfo.set("io" + buf.readUnsignedByte(), buf.readUnsignedByte());
+ }
+
+ // Read 2 byte data
+ cnt = buf.readUnsignedByte();
+ for (int j = 0; j < cnt; j++) {
+ extendedInfo.set("io" + buf.readUnsignedByte(), buf.readUnsignedShort());
+ }
+
+ // Read 4 byte data
+ cnt = buf.readUnsignedByte();
+ for (int j = 0; j < cnt; j++) {
+ extendedInfo.set("io" + buf.readUnsignedByte(), buf.readUnsignedInt());
+ }
+
+ // Read 8 byte data
+ cnt = buf.readUnsignedByte();
+ for (int j = 0; j < cnt; j++) {
+ extendedInfo.set("io" + buf.readUnsignedByte(), buf.readLong());
+ }
position.setExtendedInfo(extendedInfo.toString());
positions.add(position);