From 3ac7982d48bd7b3ed207a1461bc90a1cb7a888c4 Mon Sep 17 00:00:00 2001 From: Matjaž Črnko Date: Mon, 12 Jun 2023 23:22:21 +0200 Subject: Ruptela - decode TCO Driver ID and BLE Beacon ID --- .../org/traccar/protocol/RuptelaProtocolDecoder.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java index 737d30f10..8a9bf21a4 100644 --- a/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/RuptelaProtocolDecoder.java @@ -285,6 +285,22 @@ public class RuptelaProtocolDecoder extends BaseProtocolDecoder { driverId.release(); } + Long tcoDriverIdPart1 = (Long) position.getAttributes().remove(Position.PREFIX_IO + 155); + Long tcoDriverIdPart2 = (Long) position.getAttributes().remove(Position.PREFIX_IO + 156); + if (tcoDriverIdPart1 != null && tcoDriverIdPart2 != null) { + ByteBuf driverId = Unpooled.copyLong(tcoDriverIdPart1, tcoDriverIdPart2); + position.set(Position.KEY_DRIVER_UNIQUE_ID, driverId.toString(StandardCharsets.US_ASCII)); + driverId.release(); + } + + Long bleBeaconIdPart1 = (Long) position.getAttributes().remove(Position.PREFIX_IO + 760); + Long bleBeaconIdPart2 = (Long) position.getAttributes().remove(Position.PREFIX_IO + 761); + if (bleBeaconIdPart1 != null && bleBeaconIdPart2 != null) { + ByteBuf bleBeaconId = Unpooled.copyLong(bleBeaconIdPart1, bleBeaconIdPart2); + position.set("bleBeaconId", bleBeaconId.toString(StandardCharsets.US_ASCII)); + bleBeaconId.release(); + } + positions.add(position); } -- cgit v1.2.3