aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java10
-rw-r--r--src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java4
2 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
index de42031d7..372deae67 100644
--- a/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
@@ -607,8 +607,14 @@ public class TeltonikaProtocolDecoder extends BaseProtocolDecoder {
position.set("tag" + i + "Id", beaconId);
break;
case 2:
- String beaconData = ByteBufUtil.hexDump(beacon.readSlice(parameterLength));
- position.set("tag" + i + "Data", beaconData);
+ ByteBuf beaconData = beacon.readSlice(parameterLength);
+ int flag = beaconData.readUnsignedByte();
+ if (BitUtil.check(flag, 6)) {
+ position.set("tag" + i + "LowBattery", true);
+ }
+ if (BitUtil.check(flag, 7)) {
+ position.set("tag" + i + "Voltage", beaconData.readUnsignedByte() * 10 + 2000);
+ }
break;
case 13:
position.set("tag" + i + "LowBattery", beacon.readUnsignedByte());
diff --git a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
index 2a8ff87b6..d8e480f25 100644
--- a/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/TeltonikaProtocolDecoderTest.java
@@ -15,6 +15,10 @@ public class TeltonikaProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"000F313233343536373839303132333435"));
+ verifyAttribute(decoder, binary(
+ "00000000000000768e010000018fdc4b27cb015b3e33ceefa529030009013f0e0000022400010000000000000000000102240049010f0001c60106babbf36300550202806d0f0001ca01063456555565690202806b0f0001d10106467975425450020280690b0001c90106fa54ba8d00550b0001cf0106cabbf36300550100005455"),
+ "tag1Voltage", 3090);
+
verifyPositions(decoder, binary(
"00000000000000728e010000018b23dd796300fbf7263c24f9e11a0000000000000002240001000000000000000000010224004501210001e50110cde39f7e42bb55aa788e4a29ed650055020ab70a8f264c6000ffff6b210001b00110f89b907e42bb55aaa3463b29ed650055020ab708bb2600ae0500096c01000051d4"));