aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-08-21 16:18:39 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-08-21 16:19:11 +1200
commit2a386eab0a4baed5c606113dd9a875a088f9f4e5 (patch)
treec1521c01924a353e5ee5603ee58a9ba530da26f2 /src/org/traccar/protocol
parent5f3f51c20755d21784d9cfa5a9aa16474d25b1c0 (diff)
downloadtrackermap-server-2a386eab0a4baed5c606113dd9a875a088f9f4e5.tar.gz
trackermap-server-2a386eab0a4baed5c606113dd9a875a088f9f4e5.tar.bz2
trackermap-server-2a386eab0a4baed5c606113dd9a875a088f9f4e5.zip
Support codec 16 for Teltonika
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 1bd56c176..6eac52585 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -353,7 +353,12 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedShort()));
- position.set(Position.KEY_EVENT, buf.readUnsignedByte());
+ if (codec == CODEC_16) {
+ position.set(Position.KEY_EVENT, buf.readUnsignedShort());
+ buf.readUnsignedByte(); // generation type
+ } else {
+ position.set(Position.KEY_EVENT, buf.readUnsignedByte());
+ }
buf.readUnsignedByte(); // total IO data records
@@ -363,7 +368,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(globalMask, 1)) {
int cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- decodeParameter(position, buf.readUnsignedByte(), buf, 1, codec);
+ int id = codec == CODEC_16 ? buf.readUnsignedShort() : buf.readUnsignedByte();
+ decodeParameter(position, id, buf, 1, codec);
}
}
@@ -371,7 +377,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(globalMask, 2)) {
int cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- decodeParameter(position, buf.readUnsignedByte(), buf, 2, codec);
+ int id = codec == CODEC_16 ? buf.readUnsignedShort() : buf.readUnsignedByte();
+ decodeParameter(position, id, buf, 2, codec);
}
}
@@ -379,7 +386,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(globalMask, 3)) {
int cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- decodeParameter(position, buf.readUnsignedByte(), buf, 4, codec);
+ int id = codec == CODEC_16 ? buf.readUnsignedShort() : buf.readUnsignedByte();
+ decodeParameter(position, id, buf, 4, codec);
}
}
@@ -387,7 +395,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (codec == CODEC_FM4X00 || codec == CODEC_16) {
int cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- decodeOtherParameter(position, buf.readUnsignedByte(), buf, 8);
+ int id = codec == CODEC_16 ? buf.readUnsignedShort() : buf.readUnsignedByte();
+ decodeOtherParameter(position, id, buf, 8);
}
}
@@ -395,7 +404,8 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
if (extended) {
int cnt = buf.readUnsignedByte();
for (int j = 0; j < cnt; j++) {
- position.set(Position.PREFIX_IO + buf.readUnsignedByte(), ByteBufUtil.hexDump(buf.readSlice(16)));
+ int id = codec == CODEC_16 ? buf.readUnsignedShort() : buf.readUnsignedByte();
+ position.set(Position.PREFIX_IO + id, ByteBufUtil.hexDump(buf.readSlice(16)));
}
}