aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-01-22 21:36:17 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2019-01-22 21:36:17 -0800
commit555c537739df5fc505f48530afe245f4f308a548 (patch)
treea5c024ce18097e1eb2a9dcb604e9a2a7dbf8c942
parentdaa652338717cdcb83c66e9e78fb337b9d86f83d (diff)
downloadtraccar-server-555c537739df5fc505f48530afe245f4f308a548.tar.gz
traccar-server-555c537739df5fc505f48530afe245f4f308a548.tar.bz2
traccar-server-555c537739df5fc505f48530afe245f4f308a548.zip
Decode eelink probe temperature
-rw-r--r--src/org/traccar/protocol/EelinkProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/EelinkProtocolDecoderTest.java5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/org/traccar/protocol/EelinkProtocolDecoder.java b/src/org/traccar/protocol/EelinkProtocolDecoder.java
index bffefbddf..dcc87dccc 100644
--- a/src/org/traccar/protocol/EelinkProtocolDecoder.java
+++ b/src/org/traccar/protocol/EelinkProtocolDecoder.java
@@ -273,6 +273,10 @@ public class EelinkProtocolDecoder extends BaseProtocolDecoder {
position.set("co2", buf.readUnsignedInt());
}
+ if (buf.readableBytes() >= 2) {
+ position.set(Position.PREFIX_TEMP + 2, buf.readUnsignedShort() / 16.0);
+ }
+
}
return position;
diff --git a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
index 921b9e327..3e2a896f7 100644
--- a/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/EelinkProtocolDecoderTest.java
@@ -2,6 +2,7 @@ package org.traccar.protocol;
import org.junit.Test;
import org.traccar.ProtocolTest;
+import org.traccar.model.Position;
public class EelinkProtocolDecoderTest extends ProtocolTest {
@@ -13,6 +14,10 @@ public class EelinkProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"454C0027E753035254407167747167670100180002035254407167747100200205020500010432000086BD"));
+ verifyAttribute(decoder, binary(
+ "6767120043000e5c37387c0304e4e1b4f8194fa800160013009408012e03702d8706453c6e5b066f115f05710000001b067f8d248d240313020500000000000000000000000001cc"),
+ Position.PREFIX_TEMP + 2, 28.75);
+
verifyPosition(decoder, binary(
"676714002414B05AD43A7D03026B92B10C395499FFD7000000000701CC00002495000014203604067B"));