aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/protocol/BceProtocolDecoder.java8
-rw-r--r--src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java5
2 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/BceProtocolDecoder.java b/src/main/java/org/traccar/protocol/BceProtocolDecoder.java
index 60d705db8..a26b8e8e6 100644
--- a/src/main/java/org/traccar/protocol/BceProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/BceProtocolDecoder.java
@@ -225,7 +225,13 @@ public class BceProtocolDecoder extends BaseProtocolDecoder {
buf.skipBytes(16);
}
if (BitUtil.check(mask, 8)) {
- buf.skipBytes(40); // temperature sensors
+ for (int i = 1; i <= 4; i++) {
+ int temperature = buf.readUnsignedShortLE();
+ if (temperature > 0) {
+ position.set(Position.PREFIX_TEMP + i, temperature * 0.1 - 273);
+ }
+ buf.skipBytes(8);
+ }
}
if (BitUtil.check(mask, 9)) {
position.set("driver1", buf.readCharSequence(16, StandardCharsets.US_ASCII).toString().trim());
diff --git a/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java
index 9801b56cc..862c69d31 100644
--- a/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/BceProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class BceProtocolDecoderTest extends ProtocolTest {
@@ -13,6 +14,10 @@ public class BceProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"3ab90b71bc1503000300c10bff11"));
+ verifyAttribute(decoder, binary(
+ "a59821bf480f0300cd00a5196d6770b6b90bc0db80408005010f9d5d426138ca41002900410000000000b080a32fa8010222103d37004a000000000000000000000000000000000000000000000000000000de0b7a3fdb0a00000000de0b4ee5dc0a0000000000000000000000000000000000000000000000005c5771b6b90ac0db8040800501b080a32fa8010222103d37004d000000000000000000000000000000000000000000000000000000de0b7a3fdb0a00000000de0b4ee5dc0a000000000000000000000000000000000000000000000000c7"),
+ Position.PREFIX_TEMP + 1, 30.80000000000001);
+
verifyPositions(decoder, binary(
"cdc3440cf31403001902a58c0a06e0ceb0009f4e4452419417e0ceb08bc0ffcf428014463627b24018104b425b1c508b00d16a9743d188da6e0110ce001455069262002e4c5adabb810200418728157501004229460377000bb4d04b10c000ffff335aa800000000000000000000000000a912963d0042313130303030313236313432303031202020202020202020202020202020203f2946030301f70100007b0400009f130000762700000a26e0ceb06f074e4452419427e0ceb08bc0ffcf42801446ee28b240a40f4b425c1c518a00df414c42d188936eff0fce001455069262002e4c5adabb810200417b28157501004c294603770008b4d04b10c000ffff4c5a89000000000000000000000000009a2c8c3b004231313030303031323631343230303120202020202020202020202020202020492946030301f80100007c040000a9130000802700009477e0ceb08bc0ffcf42801446eb2fb2405c0d4b425d1c53830089e07e43d188a56eff0fce001455069262002eb35700bb810200415227167501007e294603780000b4d04b10c000ffff995700000000000000000000000000008bd9f43b004231313030303031323631343230303120202020202020202020202020202020802946030301fd01000081040000e0130000b72700000a86e0ceb064464e4452410a96e0ceb000a54e4452410aa6e0ceb000914e4452410ab6e0ceb068334e4452410ac6e0ceb0009f4e4452410ac6e0ceb06f074e445241f4"));