aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-07-13 22:36:00 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2020-07-13 22:36:00 -0700
commit47c35e66193d1dda4db5c326c9d39709aee3e2a6 (patch)
treeb838e31a36422ffcfdac12b10cf2e07d55288bc7
parentef52b738c452023472e00ef2aea75822777c5a9d (diff)
downloadtraccar-server-47c35e66193d1dda4db5c326c9d39709aee3e2a6.tar.gz
traccar-server-47c35e66193d1dda4db5c326c9d39709aee3e2a6.tar.bz2
traccar-server-47c35e66193d1dda4db5c326c9d39709aee3e2a6.zip
Handle negative altitude
-rw-r--r--src/main/java/org/traccar/protocol/WatchProtocolDecoder.java4
-rw-r--r--src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java
index 9b2bc33bf..c5431be8d 100644
--- a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2020 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.
@@ -57,7 +57,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder {
.expression("([EW])?,")
.number("(d+.?d*),") // speed
.number("(d+.?d*),") // course
- .number("(d+.?d*),") // altitude
+ .number("(-?d+.?d*),") // altitude
.number("(d+),") // satellites
.number("(d+),") // rssi
.number("(d+),") // battery
diff --git a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
index 88acd8222..4625e0eb4 100644
--- a/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/WatchProtocolDecoderTest.java
@@ -16,6 +16,9 @@ public class WatchProtocolDecoderTest extends ProtocolTest {
WatchProtocolDecoder decoder = new WatchProtocolDecoder(null);
verifyPosition(decoder, buffer(
+ "[3G*0304187088*0100*UD_WCDMA,100720,094202,V,0.0,N,0.0,E,22.0,0,-1,21,75,92,0,0,00000000,1,1,425,01,10192,1282125,75,5,Inet,04:f0:21:46:1f:57,-54,iNetSecurity,00:1e:42:25:2f:3e,-71,Gilad,58:d5:6e:9d:1b:af,-80,weekend,14:ae:db:cb:99:25,-82,advancemed1,04:f0:21:4c:c8:3e,-89,0.0]"));
+
+ verifyPosition(decoder, buffer(
"[3G*8809008845*00C0*AL,271219,094744,V,00.000000,N, 0.0000000,E,0.00,0.0,0.0,0,100,81,0,0,00010000,7,0,460,0,9336,3981,141,9336,3912,141,9336,3982,140,9765,4233,134,9765,4071,134,9765,4321,134,9336,4353,132,0,0.0]"));
verifyPosition(decoder, buffer(