aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java28
-rw-r--r--src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java4
2 files changed, 32 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
index e888642b4..16c1dd210 100644
--- a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -588,6 +588,34 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
}
index += 1;
}
+ } else if (id == 10829 || id == 10831) {
+ ByteBuf data = buf.readSlice(length);
+ data.readUnsignedByte(); // header
+ for (int i = 1; data.isReadable(); i++) {
+ ByteBuf beacon = data.readSlice(data.readUnsignedByte());
+ while (beacon.isReadable()) {
+ int parameterId = beacon.readUnsignedByte();
+ int parameterLength = beacon.readUnsignedByte();
+ switch (parameterId) {
+ case 0:
+ position.set("tag" + i + "Rssi", (int) beacon.readByte());
+ break;
+ case 1:
+ String beaconId = ByteBufUtil.hexDump(beacon.readSlice(parameterLength));
+ position.set("tag" + i + "Id", beaconId);
+ break;
+ case 13:
+ position.set("tag" + i + "LowBattery", beacon.readUnsignedByte());
+ break;
+ case 14:
+ position.set("tag" + i + "Battery", beacon.readUnsignedShort());
+ break;
+ default:
+ beacon.skipBytes(parameterLength);
+ break;
+ }
+ }
+ }
} else {
position.set(Position.PREFIX_IO + id, ByteBufUtil.hexDump(buf.readSlice(length)));
}
diff --git a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
index 0b4f1d243..7a6bdba54 100644
--- a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
@@ -16,6 +16,10 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest {
"000F313233343536373839303132333435"));
verifyAttribute(decoder, binary(
+ "000000000000004b8e010000018368952793000f0e54fc209ab05800b300b40e00002a4f0001000000000000000000012a4f001e011c0001a40110eb47706aa38255aa96f21a154e2d00550d01000e020bd6010000823f"),
+ "tag1Battery", 3030);
+
+ verifyAttribute(decoder, binary(
"00000000000000240d01060000001c642b3ad14754534c7c367c317c307c31323734393838347c317c0d0a010000ec11"),
Position.KEY_DRIVER_UNIQUE_ID, "12749884");