aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-06-03 07:27:30 -0700
committerAnton Tananaev <anton@traccar.org>2024-06-03 07:27:47 -0700
commitbf3770fad4ceb7aeab4f1e686c3a49f3b1aa1592 (patch)
treeaa692d3168c89b76dd24817ba9fe2c925365b504 /src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java
parenta7665afd35006c3ed2f5b11a02214bc784732304 (diff)
downloadtrackermap-server-bf3770fad4ceb7aeab4f1e686c3a49f3b1aa1592.tar.gz
trackermap-server-bf3770fad4ceb7aeab4f1e686c3a49f3b1aa1592.tar.bz2
trackermap-server-bf3770fad4ceb7aeab4f1e686c3a49f3b1aa1592.zip
Decode beacon battery data
Diffstat (limited to 'src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/TeltonikaProtocolDecoder.java10
1 files changed, 8 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());