From 1b7802c639f8d40db141429f2c15b96e3b743a04 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 6 Nov 2023 06:38:30 -0800 Subject: Fix device id decoding --- src/main/java/org/traccar/protocol/PositrexProtocolDecoder.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/traccar/protocol/PositrexProtocolDecoder.java b/src/main/java/org/traccar/protocol/PositrexProtocolDecoder.java index 8726bc831..ff4825e8d 100644 --- a/src/main/java/org/traccar/protocol/PositrexProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/PositrexProtocolDecoder.java @@ -59,12 +59,11 @@ public class PositrexProtocolDecoder extends BaseProtocolDecoder { ByteBuf buf = (ByteBuf) msg; int first = buf.getUnsignedByte(buf.readerIndex()); - int second = buf.getUnsignedByte(buf.readerIndex() + 1); long deviceId; if (BitUtil.check(first, 7)) { if (BitUtil.check(first, 6)) { deviceId = 73000000 + BitUtil.to(buf.readUnsignedInt(), 30); - } else if (second == 0) { + } else if (!BitUtil.check(first, 5) && !BitUtil.check(first, 4)) { deviceId = 7590000 + BitUtil.to(buf.readUnsignedMedium(), 20); } else { deviceId = 70000000 + BitUtil.to(buf.readUnsignedMedium(), 20); -- cgit v1.2.3