aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-02-13 08:09:03 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-02-13 08:09:03 +1300
commit582d431cd4a01bf2a6f826f32f2b93c17fd00a7b (patch)
tree8cd40a4bec2450e66a804e4208897fcdf07e1168
parent9fc8bdbe23dcbc478dbdfe6d12b6b1f93fb045d1 (diff)
downloadtrackermap-server-582d431cd4a01bf2a6f826f32f2b93c17fd00a7b.tar.gz
trackermap-server-582d431cd4a01bf2a6f826f32f2b93c17fd00a7b.tar.bz2
trackermap-server-582d431cd4a01bf2a6f826f32f2b93c17fd00a7b.zip
Support Bitrek protocol
-rw-r--r--src/org/traccar/protocol/TeltonikaProtocolDecoder.java15
-rw-r--r--test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java3
2 files changed, 18 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
index 411915400..fc7a8fd3a 100644
--- a/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -73,15 +73,30 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
private void decodeParameter(Position position, int id, ChannelBuffer buf, int length) {
switch (id) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ position.set("di" + id, buf.readUnsignedByte());
+ break;
case 9:
position.set(Position.PREFIX_ADC + 1, buf.readUnsignedShort());
break;
+ case 21:
+ position.set(Position.KEY_RSSI, buf.readUnsignedByte());
+ break;
+ case 22:
+ position.set("profile", buf.readUnsignedByte());
+ break;
case 66:
position.set(Position.KEY_POWER, buf.readUnsignedShort() + "mV");
break;
case 67:
position.set(Position.KEY_BATTERY, buf.readUnsignedShort() + "mV");
break;
+ case 70:
+ position.set("pcbTemp", buf.readInt() * 0.1);
+ break;
case 72:
position.set(Position.PREFIX_TEMP + 1, buf.readInt() * 0.1);
break;
diff --git a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
index 22c9c4b4b..289a4f28d 100644
--- a/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
@@ -14,6 +14,9 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest {
"000F313233343536373839303132333435"));
verifyPositions(decoder, false, binary(
+ "0000000000000000080100000113fc208dff00209cca800f14f650006f00d60400040004030101150316030001460000015d000100000000")); // invalid length and checksum
+
+ verifyPositions(decoder, false, binary(
"000000000000009f080400000159738f76b8012e13b796110ab27600d700000b00004e01000000014e000000000000000000000159738f6ee8012e13b796110ab27600d700000a00004e01000000014e01000b00791c179300000159738f6b00012e13b796110ab27600d700000a00004e01000000014e000000000000000000000159738f5f48012e13b796110ab27600d700000b00004e01000000014e01000b00791c17930400009671"));
verifyPositions(decoder, false, binary(