aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-03-08 10:39:40 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-03-08 10:39:40 +1300
commitb8d2578c5448bc760a91c80793ff4141a974324f (patch)
tree6cfe4a9908e3863741113754fd0a20c16bc03090
parentabcadef0f6465743e85aa011f39367fddbe7d8e5 (diff)
downloadtrackermap-server-b8d2578c5448bc760a91c80793ff4141a974324f.tar.gz
trackermap-server-b8d2578c5448bc760a91c80793ff4141a974324f.tar.bz2
trackermap-server-b8d2578c5448bc760a91c80793ff4141a974324f.zip
Improve H02 regex pattern
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/H02ProtocolDecoderTest.java5
2 files changed, 6 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index c67eb6053..84ddaf895 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -116,9 +116,9 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
".*" +
"(\\d{2})(\\d{2})(\\d{2})," + // Time (HHMMSS)
"([AV])," + // Validity
- "(\\d+)(\\d{2}.\\d+)," + // Latitude (DDMM.MMMM)
+ "-?(\\d+)-?(\\d{2}.\\d+)," + // Latitude (DDMM.MMMM)
"([NS])," +
- "(\\d+)(\\d{2}.\\d+)," + // Longitude (DDMM.MMMM)
+ "-?(\\d+)-?(\\d{2}.\\d+)," + // Longitude (DDMM.MMMM)
"([EW])," +
"(\\d+.?\\d*)," + // Speed
"(\\d+.?\\d*)?," + // Course
diff --git a/test/org/traccar/protocol/H02ProtocolDecoderTest.java b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
index eed626380..cb8e55517 100644
--- a/test/org/traccar/protocol/H02ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/H02ProtocolDecoderTest.java
@@ -14,7 +14,10 @@ public class H02ProtocolDecoderTest {
public void testDecode() throws Exception {
H02ProtocolDecoder decoder = new H02ProtocolDecoder(new TestDataManager(), null, null);
-
+
+ verify(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
+ "*HQ,1451316409,V1,030149,A,-23-29.0095,S,-46-51.5852,W,2.4,065,070315,FFFFFFFF#", Charset.defaultCharset())));
+
assertNull(decoder.decode(null, null, ChannelBuffers.copiedBuffer(
"*HQ,353588020068342,V1,000000,V,0.0000,0,0.0000,0,0.00,0.00,000000,ffffffff,000106,000002,000203,004c87,16#", Charset.defaultCharset())));