aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-01-16 08:59:58 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-01-16 09:00:15 -0800
commit4c7383d227ea4bea29739676972416de40a19cd8 (patch)
tree6a727ff6da0d821c6ae9b505e7a3aa8377e443f1
parenta5a4a31a8826998ff479294ea3885dd4a124f3e8 (diff)
downloadtraccar-server-4c7383d227ea4bea29739676972416de40a19cd8.tar.gz
traccar-server-4c7383d227ea4bea29739676972416de40a19cd8.tar.bz2
traccar-server-4c7383d227ea4bea29739676972416de40a19cd8.zip
Support negative altitude (fix #4471)
-rw-r--r--src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java2
-rw-r--r--src/test/java/org/traccar/protocol/Gps103ProtocolDecoderTest.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java
index aa02e8ad4..e00d83061 100644
--- a/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -77,7 +77,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
.expression("([EW])?,").optional()
.number("(d+.?d*)?").optional() // speed
.number(",(d+.?d*)?").optional() // course
- .number(",(d+.?d*)?").optional() // altitude
+ .number(",(-?d+.?d*)?").optional() // altitude
.number(",([01])?").optional() // ignition
.number(",([01])?").optional() // door
.groupBegin()
diff --git a/src/test/java/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index da8d8ff5a..63a6e06d0 100644
--- a/src/test/java/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -11,6 +11,9 @@ public class Gps103ProtocolDecoderTest extends ProtocolTest {
Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(null);
+ verifyPosition(decoder, text(
+ "imei:760112011448012,001,2001151918,,F,191833.000,A,6136.6174,N,2126.9901,E,0.00,202.6,-0.1,1,,,,20;"));
+
verifyAttribute(decoder, text(
"imei:868683023212255,tracker,190205084503,,F,064459.000,A,4915.1221,N,01634.5655,E,3.91,83.95;"),
"course", 83.95);