aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/BceProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/BceProtocolDecoderTest.java3
2 files changed, 7 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/BceProtocolDecoder.java b/src/org/traccar/protocol/BceProtocolDecoder.java
index a023e60c5..db0ec8c66 100644
--- a/src/org/traccar/protocol/BceProtocolDecoder.java
+++ b/src/org/traccar/protocol/BceProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -96,9 +96,9 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(buf.readFloat());
position.setSpeed(UnitsConverter.knotsFromKph(buf.readUnsignedByte()));
- int gps = buf.readUnsignedByte();
- position.set(Position.KEY_SATELLITES, gps & 0xf);
- position.set(Position.KEY_HDOP, gps >> 4);
+ int status = buf.readUnsignedByte();
+ position.set(Position.KEY_SATELLITES, BitUtil.to(status, 4));
+ position.set(Position.KEY_HDOP, BitUtil.from(status, 4));
position.setCourse(buf.readUnsignedByte());
position.setAltitude(buf.readUnsignedShort());
diff --git a/test/org/traccar/protocol/BceProtocolDecoderTest.java b/test/org/traccar/protocol/BceProtocolDecoderTest.java
index 5e9bef2b4..53daf5ff3 100644
--- a/test/org/traccar/protocol/BceProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/BceProtocolDecoderTest.java
@@ -13,6 +13,9 @@ public class BceProtocolDecoderTest extends ProtocolTest {
BceProtocolDecoder decoder = new BceProtocolDecoder(new BceProtocol());
verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
+ "789622d1cb1303003401a53365b70f4a9babc0ffd700c04400f0b6c741e63933428f1c431c015468de43f18221341b007e0ae20001430a698f003f008d000000000031f85900000000f0831c018400000000000000000000000000000000000209000000000000000000000000000000030065f70f4a9babc0ffd700c0440069bcc741e73733427f1c431a01a9378343f1829c391b00a80be2000170056da7003e007c000000000031c04e00000000f0831c01810000000000000000000000000000000000060100000000000000000000000000000003006537104a9babc0ffd700c0440051c1c74129363342721c421801e4809543f18210341b00710ae2000170056da7003e0072000000000031c04800000000b8841c017e00000000000000000000000000000000000306000000000000000000000000000000030069"));
+
+ verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,
"be76619c834601004200a0003fd769c568ffc3db0079161d420683a9414918b1150000000000d102660167040000000000009f06357f0000a401042ea415e10232000000000000000000000051"));
verifyPositions(decoder, binary(ByteOrder.LITTLE_ENDIAN,