aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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())));