From 79ecdf701ce5db5505c366bafe4f04e4d565ec7d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 17 Sep 2022 16:57:29 -0700 Subject: Fix temperature decoding --- src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java') diff --git a/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java index 9122eb362..eb8c1c466 100644 --- a/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 Anton Tananaev (anton@traccar.org) + * Copyright 2021 - 2022 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. @@ -293,7 +293,9 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder { case 51: case 52: value = buf.readByte(); - position.set(Position.PREFIX_TEMP + (j + 2 - 45), (value != 0x80) ? value : null); + position.set( + Position.PREFIX_TEMP + (j + 2 - 45), + (value != (byte) 0x80) ? value : null); break; default: buf.skipBytes(getItemLength(j + 1)); -- cgit v1.2.3 From 3a6219d8cc2a014a78d53f9ca9695558ffd72926 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 17 Sep 2022 16:58:10 -0700 Subject: Remove unnecessary assignment --- src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java') diff --git a/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java index eb8c1c466..20e10cdcd 100644 --- a/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java @@ -196,7 +196,7 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder { for (int j = 0; j < bits.length(); j++) { if (bits.get(j)) { - int value = 0; + int value; switch (j + 1) { case 1: -- cgit v1.2.3 From 6864e0a0a067f432bead08331404d4b141959a64 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 17 Sep 2022 17:26:52 -0700 Subject: Navtelecom fuel temperature --- .../java/org/traccar/protocol/NavtelecomProtocolDecoder.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java') diff --git a/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java index 20e10cdcd..08b1a8d0f 100644 --- a/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/NavtelecomProtocolDecoder.java @@ -278,11 +278,11 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder { case 42: case 43: value = buf.readUnsignedShortLE(); - position.set("rs485Fuel" + (j + 2 - 38), (value < 65500) ? value : null); + position.set("fuel" + (j + 2 - 38), (value < 65500) ? value : null); break; case 44: value = buf.readUnsignedShortLE(); - position.set("rs232Fuel", (value < 65500) ? value : null); + position.set(Position.KEY_FUEL_LEVEL, (value < 65500) ? value : null); break; case 45: case 46: @@ -297,6 +297,14 @@ public class NavtelecomProtocolDecoder extends BaseProtocolDecoder { Position.PREFIX_TEMP + (j + 2 - 45), (value != (byte) 0x80) ? value : null); break; + case 78: + case 79: + case 80: + case 81: + case 82: + case 83: + position.set("fuelTemp" + (j + 2 - 78), (int) buf.readByte()); + break; default: buf.skipBytes(getItemLength(j + 1)); break; -- cgit v1.2.3