diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-01-11 22:02:51 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-01-11 22:02:51 +1300 |
commit | 3899a1b71eed65ee42a35f75b9d82d235e8ff4d5 (patch) | |
tree | 964d063e3e39510f3176eed600e3d4e2afacb91d | |
parent | 8c7173a6e6ae0b81d96009b86cb88460daab2f4e (diff) | |
download | traccar-server-3899a1b71eed65ee42a35f75b9d82d235e8ff4d5.tar.gz traccar-server-3899a1b71eed65ee42a35f75b9d82d235e8ff4d5.tar.bz2 traccar-server-3899a1b71eed65ee42a35f75b9d82d235e8ff4d5.zip |
Support negative coordinates (fix #1654)
-rw-r--r-- | src/org/traccar/protocol/WatchProtocolDecoder.java | 4 | ||||
-rw-r--r-- | test/org/traccar/protocol/WatchProtocolDecoderTest.java | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/WatchProtocolDecoder.java b/src/org/traccar/protocol/WatchProtocolDecoder.java index bfa8c081d..00f49deb5 100644 --- a/src/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/org/traccar/protocol/WatchProtocolDecoder.java @@ -47,9 +47,9 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { .number("(dd)(dd)(dd),") // date (ddmmyy) .number("(dd)(dd)(dd),") // time .expression("([AV]),") // validity - .number("(d+.d+),") // latitude + .number("-?(d+.d+),") // latitude .expression("([NS]),") - .number("(d+.d+),") // longitude + .number("-?(d+.d+),") // longitude .expression("([EW]),") .number("(d+.d+),") // speed .number("(d+.d+),") // course diff --git a/test/org/traccar/protocol/WatchProtocolDecoderTest.java b/test/org/traccar/protocol/WatchProtocolDecoderTest.java index 993148477..5b09f48ff 100644 --- a/test/org/traccar/protocol/WatchProtocolDecoderTest.java +++ b/test/org/traccar/protocol/WatchProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class WatchProtocolDecoderTest extends ProtocolTest { WatchProtocolDecoder decoder = new WatchProtocolDecoder(new WatchProtocol()); + verifyPosition(decoder, text( + "[3G*2256002206*0079*UD2,100116,153723,A,38.000000,N,-9.000000,W,0.44,299.3,0.0,7,100,86,0,0,00000008,2,0,268,3,3010,51042,146,3010,51043,132]")); + verifyNothing(decoder, text( "[3G*8800000015*0003*TKQ")); |