diff options
author | Anton Tananaev <anton@traccar.org> | 2023-10-14 17:00:41 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-10-14 17:00:41 -0700 |
commit | b9c2d03f189abb7360801952ba69138fdf9fe432 (patch) | |
tree | 85e3378bc96dd9bd9ac0989d717b3d7d3f6b20cd /src | |
parent | b8b84db2104b26dfeedbe1faaa4a52fef608cd1c (diff) | |
download | trackermap-server-b9c2d03f189abb7360801952ba69138fdf9fe432.tar.gz trackermap-server-b9c2d03f189abb7360801952ba69138fdf9fe432.tar.bz2 trackermap-server-b9c2d03f189abb7360801952ba69138fdf9fe432.zip |
Support Teltonika advanced beacon
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java | 6 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java index 16c1dd210..45afbd0f7 100644 --- a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java @@ -588,7 +588,7 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { } index += 1; } - } else if (id == 10829 || id == 10831) { + } else if (id == 548 || id == 10829 || id == 10831) { ByteBuf data = buf.readSlice(length); data.readUnsignedByte(); // header for (int i = 1; data.isReadable(); i++) { @@ -604,6 +604,10 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder { String beaconId = ByteBufUtil.hexDump(beacon.readSlice(parameterLength)); position.set("tag" + i + "Id", beaconId); break; + case 2: + String beaconData = ByteBufUtil.hexDump(beacon.readSlice(parameterLength)); + position.set("tag" + i + "Data", beaconData); + break; case 13: position.set("tag" + i + "LowBattery", beacon.readUnsignedByte()); break; diff --git a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java index 7a6bdba54..2a8ff87b6 100644 --- a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java @@ -15,6 +15,9 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest { verifyNull(decoder, binary( "000F313233343536373839303132333435")); + verifyPositions(decoder, binary( + "00000000000000728e010000018b23dd796300fbf7263c24f9e11a0000000000000002240001000000000000000000010224004501210001e50110cde39f7e42bb55aa788e4a29ed650055020ab70a8f264c6000ffff6b210001b00110f89b907e42bb55aaa3463b29ed650055020ab708bb2600ae0500096c01000051d4")); + verifyAttribute(decoder, binary( "000000000000004b8e010000018368952793000f0e54fc209ab05800b300b40e00002a4f0001000000000000000000012a4f001e011c0001a40110eb47706aa38255aa96f21a154e2d00550d01000e020bd6010000823f"), "tag1Battery", 3030); |