aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-06-04 17:59:44 -0700
committerAnton Tananaev <anton@traccar.org>2023-06-04 17:59:44 -0700
commitfdbd269b9b99de074e2fd9d99d1702620102801b (patch)
treee043cd5ca946140d90da475a0a62512b27098700
parenta24d7d5d7a61946b45ed5d344fee0a0e27bd3144 (diff)
downloadtrackermap-server-fdbd269b9b99de074e2fd9d99d1702620102801b.tar.gz
trackermap-server-fdbd269b9b99de074e2fd9d99d1702620102801b.tar.bz2
trackermap-server-fdbd269b9b99de074e2fd9d99d1702620102801b.zip
Handle decimal temperature
-rw-r--r--src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java2
-rw-r--r--src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java b/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
index 4e5200f37..4d8e7e7ea 100644
--- a/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/FreematicsProtocolDecoder.java
@@ -153,7 +153,7 @@ public class FreematicsProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_RSSI, Integer.parseInt(value));
break;
case 0x82:
- position.set(Position.KEY_DEVICE_TEMP, Integer.parseInt(value) * 0.1);
+ position.set(Position.KEY_DEVICE_TEMP, Double.parseDouble(value) * 0.1);
break;
case 0x104:
position.set(Position.KEY_ENGINE_LOAD, Integer.parseInt(value));
diff --git a/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
index dae3815ac..53ed07da7 100644
--- a/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/FreematicsProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class FreematicsProtocolDecoderTest extends ProtocolTest {
var decoder = inject(new FreematicsProtocolDecoder(null));
verifyPositions(decoder, text(
+ "UCFLFAYM#0:33770,24:300,82:53.000000,*F9"));
+
+ verifyPositions(decoder, text(
"M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5"));
verifyNull(decoder, text(