aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/PositrexProtocolDecoder.java3
-rw-r--r--src/test/java/org/traccar/protocol/PositrexProtocolDecoderTest.java4
2 files changed, 2 insertions, 5 deletions
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);
diff --git a/src/test/java/org/traccar/protocol/PositrexProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/PositrexProtocolDecoderTest.java
index ff9d3ee1b..bf4f9c765 100644
--- a/src/test/java/org/traccar/protocol/PositrexProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/PositrexProtocolDecoderTest.java
@@ -1,19 +1,17 @@
package org.traccar.protocol;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.traccar.ProtocolTest;
public class PositrexProtocolDecoderTest extends ProtocolTest {
- @Disabled
@Test
public void testDecode() throws Exception {
var decoder = inject(new PositrexProtocolDecoder(null));
verifyPosition(decoder, binary(
- "TODO"));
+ "8280902e002b81c99fd607033905008b1c000003ae00003c9c000054ee00000079000000000d34d43f0fffffffda0000000000104fb80000204086464717807f8931082622128190980fffff862261047296590fffff"));
}