aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-06-22 22:27:52 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-06-22 22:27:52 -0700
commite2ec2d17b751dc3f3b829cee8693999d9ed08f40 (patch)
tree38c3e15925774da23268e65963ae7af8233e3757
parentf2c949998733734543be2ec795b2aa9b909b0044 (diff)
downloadtrackermap-server-e2ec2d17b751dc3f3b829cee8693999d9ed08f40.tar.gz
trackermap-server-e2ec2d17b751dc3f3b829cee8693999d9ed08f40.tar.bz2
trackermap-server-e2ec2d17b751dc3f3b829cee8693999d9ed08f40.zip
Handle negative altitude values
-rw-r--r--src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java2
-rw-r--r--src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java
index 992b5c43a..652ba3f6a 100644
--- a/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/MictrackProtocolDecoder.java
@@ -54,7 +54,7 @@ public class MictrackProtocolDecoder extends BaseProtocolDecoder {
.expression("([EW]),")
.number("(d+.?d*)?,") // speed
.number("(d+.?d*)?,") // course
- .number("(d+.?d*)?,") // altitude
+ .number("(-?d+.?d*)?,") // altitude
.number("(dd)(dd)(dd)") // date (ddmmyy)
.compile();
diff --git a/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java
index 5c9e74a2d..4c17bf1f8 100644
--- a/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/MictrackProtocolDecoderTest.java
@@ -48,6 +48,9 @@ public class MictrackProtocolDecoderTest extends ProtocolTest {
var decoder = new MictrackProtocolDecoder(null);
verifyPositions(decoder, text(
+ "861836051888035$162835.00,A,4139.6460,N,07009.7239,W,,41.53,-25.8,220621"));
+
+ verifyPositions(decoder, text(
"861108032038761$062232.00,A,2238.2832,N,11401.7381,E,0.01,309.62,95.0,131117"));
verifyPositions(decoder, text(