diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-31 19:09:28 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-31 19:09:28 +1300 |
commit | 7949f0d11aa427bc0ffe3b0722d2390e14d62cc7 (patch) | |
tree | 75be19e6ddabc04374afa769c20679b4dfabb3f8 | |
parent | a76e8d71083ef44384b541d33bab92eb096902d2 (diff) | |
download | traccar-server-7949f0d11aa427bc0ffe3b0722d2390e14d62cc7.tar.gz traccar-server-7949f0d11aa427bc0ffe3b0722d2390e14d62cc7.tar.bz2 traccar-server-7949f0d11aa427bc0ffe3b0722d2390e14d62cc7.zip |
Improve Watch decoder pattern
-rw-r--r-- | src/org/traccar/protocol/WatchProtocolDecoder.java | 2 | ||||
-rw-r--r-- | test/org/traccar/protocol/WatchProtocolDecoderTest.java | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/WatchProtocolDecoder.java b/src/org/traccar/protocol/WatchProtocolDecoder.java index adaa41061..4d71a7f5d 100644 --- a/src/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/org/traccar/protocol/WatchProtocolDecoder.java @@ -53,7 +53,7 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { .expression("([EW]),") .number("(d+.d+),") // speed .number("(d+.d+),") // course - .number("(d+),") // altitude + .number("(d+.?d*),") // altitude .number("(d+),") // satellites .number("(d+),") // gsm .number("(d+),") // battery diff --git a/test/org/traccar/protocol/WatchProtocolDecoderTest.java b/test/org/traccar/protocol/WatchProtocolDecoderTest.java index 712b38f5b..c34447634 100644 --- a/test/org/traccar/protocol/WatchProtocolDecoderTest.java +++ b/test/org/traccar/protocol/WatchProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class WatchProtocolDecoderTest extends ProtocolDecoderTest { WatchProtocolDecoder decoder = new WatchProtocolDecoder(new WatchProtocol()); + verifyPosition(decoder, text( + "[3G*4700186508*00B1*UD,301015,084840,V,45.853100,N,14.6224899,E,0.00,0.0,0.0,0,84,61,0,11,00000008,7,255,293,70,60,6453,139,60,6432,139,60,6431,132,60,6457,127,60,16353,126,60,6451,121,60,16352,118")); + verifyNothing(decoder, text( "[SG*8800000015*0002*LK")); |