aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-10-27 22:53:54 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-10-27 22:54:00 -0700
commite9202415e19353f3513f42426e32783e05939048 (patch)
tree3927f0c84b9f8bc80837779a03d432880f401794
parent9643a56ec4102dbb9be06566ebe899c5b623fe54 (diff)
downloadtrackermap-server-e9202415e19353f3513f42426e32783e05939048.tar.gz
trackermap-server-e9202415e19353f3513f42426e32783e05939048.tar.bz2
trackermap-server-e9202415e19353f3513f42426e32783e05939048.zip
Fix speed decoding
-rw-r--r--src/main/java/org/traccar/protocol/NetProtocolDecoder.java4
-rw-r--r--src/test/java/org/traccar/protocol/NetProtocolDecoderTest.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/NetProtocolDecoder.java b/src/main/java/org/traccar/protocol/NetProtocolDecoder.java
index 2117a2cc6..61cb29b6b 100644
--- a/src/main/java/org/traccar/protocol/NetProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/NetProtocolDecoder.java
@@ -43,7 +43,7 @@ public class NetProtocolDecoder extends BaseProtocolDecoder {
.number("(x)") // flags
.number("(dd)(dd)(dddd)") // latitude
.number("(ddd)(dd)(dddd)") // longitude
- .number("(xx)") // status
+ .number("(x{8})") // status
.number("(x{4})") // speed
.number("(x{6})") // odometer
.number("(xxx)") // course
@@ -79,7 +79,7 @@ public class NetProtocolDecoder extends BaseProtocolDecoder {
position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN) * hemisphereLatitude);
position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN) * hemisphereLongitude);
- position.set(Position.KEY_STATUS, parser.nextHexInt());
+ position.set(Position.KEY_STATUS, parser.nextHexLong());
position.setSpeed(parser.nextHexInt() * 0.01);
position.set(Position.KEY_ODOMETER, parser.nextHexInt());
position.setCourse(parser.nextHexInt());
diff --git a/src/test/java/org/traccar/protocol/NetProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/NetProtocolDecoderTest.java
index 6b8754373..678e5c6c3 100644
--- a/src/test/java/org/traccar/protocol/NetProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/NetProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class NetProtocolDecoderTest extends ProtocolTest {
NetProtocolDecoder decoder = new NetProtocolDecoder(null);
verifyPosition(decoder, text(
+ "@L03686090604017761712271020161807037078881037233751000000010F850036980A4000"));
+
+ verifyPosition(decoder, text(
"@L0368609060401776171223102005072803703296103721462100008009000000300B12B000"));
}