aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/protocol/H02ProtocolDecoder.java20
-rw-r--r--src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java3
2 files changed, 17 insertions, 6 deletions
diff --git a/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java b/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java
index 38c063b52..ed6460e97 100644
--- a/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java
@@ -350,24 +350,32 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
position.setValid(true);
}
+ double latitude = 0;
if (parser.hasNext(3)) {
- position.setLatitude(parser.nextCoordinate());
+ latitude = parser.nextCoordinate();
}
if (parser.hasNext(3)) {
- position.setLatitude(parser.nextCoordinate());
+ latitude = parser.nextCoordinate();
}
if (parser.hasNext(4)) {
- position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN_HEM));
+ latitude = parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN_HEM);
+ }
+ if (latitude != 99 + 99.9999 / 60) {
+ position.setLatitude(latitude);
}
+ double longitude = 0;
if (parser.hasNext(3)) {
- position.setLongitude(parser.nextCoordinate());
+ longitude = parser.nextCoordinate();
}
if (parser.hasNext(3)) {
- position.setLongitude(parser.nextCoordinate());
+ longitude = parser.nextCoordinate();
}
if (parser.hasNext(4)) {
- position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN_HEM));
+ longitude = parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN_HEM);
+ }
+ if (longitude != 999 + 99.9999 / 60) {
+ position.setLongitude(longitude);
}
position.setSpeed(parser.nextDouble(0));
diff --git a/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
index a63488960..05a362cb0 100644
--- a/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/H02ProtocolDecoderTest.java
@@ -12,6 +12,9 @@ public class H02ProtocolDecoderTest extends ProtocolTest {
var decoder = inject(new H02ProtocolDecoder(null));
verifyPosition(decoder, buffer(
+ "*HQ,8888888888,V1,083600,V,9999.9999,N,99999.9999,E,000.00,000,070724,FFFFDFFF,231,03,10,196354#"));
+
+ verifyPosition(decoder, buffer(
"*HQ,3177718238,V6,002926,V,3514.4088,N,9733.2842,W,0.00,0.00,151222,FFF7FBFF,310,260,32936,13641,8944501311217563382F,#"));
verifyPosition(decoder, buffer(