aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-08-26 09:41:37 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-08-26 09:41:37 +1200
commit819bca366f89f237f19e52b7a916895ed1761fb9 (patch)
tree40003114990615a08486b6a3906b9bb2798358f6
parentd5ad3af86c6faa5d45b8724219bf06cdd58e3eed (diff)
downloadtraccar-server-819bca366f89f237f19e52b7a916895ed1761fb9.tar.gz
traccar-server-819bca366f89f237f19e52b7a916895ed1761fb9.tar.bz2
traccar-server-819bca366f89f237f19e52b7a916895ed1761fb9.zip
Decode negative temperature
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java2
-rw-r--r--test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 37793a6ff..3bee39cc4 100644
--- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -614,7 +614,7 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
for (int i = 1; i <= deviceCount; i++) {
index++; // id
index++; // type
- position.set(Position.PREFIX_TEMP + i, Short.parseShort(data[index++], 16) * 0.0625);
+ position.set(Position.PREFIX_TEMP + i, (short) Integer.parseInt(data[index++], 16) * 0.0625);
}
}
}
diff --git a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
index ac58049df..6796f48ee 100644
--- a/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gl200TextProtocolDecoderTest.java
@@ -10,6 +10,9 @@ public class Gl200TextProtocolDecoderTest extends ProtocolTest {
Gl200TextProtocolDecoder decoder = new Gl200TextProtocolDecoder(new Gl200Protocol());
+ verifyPositions(decoder, buffer(
+ "+RESP:GTERI,060502,861074023620928,,00000002,27822,10,1,1,0.0,84,2870.9,-78.531796,-0.277329,20170825045344,,,,,,0.0,01138:30:24,,,83,220104,2,1,28FF2776A2150308,1,FFAD,0,20170825045348,A88C$"));
+
verifyAttributes(decoder, buffer(
"+RESP:GTINF,280500,A1000043D20139,GL300VC,41,,31,0,0,,,3.87,0,1,1,,,20170802150751,70,,48.0,,,20170802112145,03AC$"));