From bf3770fad4ceb7aeab4f1e686c3a49f3b1aa1592 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 3 Jun 2024 07:27:30 -0700 Subject: Decode beacon battery data --- .../java/org/traccar/protocol/TeltonikaProtocolDecoder.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main') 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()); -- cgit v1.2.3