aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2022-01-28 11:08:27 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2022-01-28 11:08:27 -0800
commitff51e1ecafe3b26929baa21a20583c1e8ac82271 (patch)
tree1b2a1d7d612ada053c8e2e034d2f460d6584b74d /src/main/java
parentc45b4d8d1e29227937afa9114ead5ae16f548aa0 (diff)
downloadtrackermap-server-ff51e1ecafe3b26929baa21a20583c1e8ac82271.tar.gz
trackermap-server-ff51e1ecafe3b26929baa21a20583c1e8ac82271.tar.bz2
trackermap-server-ff51e1ecafe3b26929baa21a20583c1e8ac82271.zip
Another H02 coordinates format
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/H02ProtocolDecoder.java34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java b/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java
index dd7141a2c..10a272bff 100644
--- a/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -176,17 +176,19 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
.number("(d+),") // coding scheme
.groupEnd()
.groupBegin()
- .number("-(d+)-(d+.d+),") // latitude
+ .number("-(d+)-(d+.d+),([NS]),") // latitude
.or()
- .number("(d+)(dd.d+),") // latitude
+ .number("(d+)(dd.d+),([NS]),") // latitude
+ .or()
+ .number("(d+)(dd)(d{4}),([NS]),") // latitude
.groupEnd()
- .expression("([NS]),")
.groupBegin()
- .number("-(d+)-(d+.d+),") // longitude
+ .number("-(d+)-(d+.d+),([EW]),") // longitude
.or()
- .number("(d+)(dd.d+),") // longitude
+ .number("(d+)(dd.d+),([EW]),") // longitude
+ .or()
+ .number("(d+)(dd)(d{4}),([EW]),") // longitude
.groupEnd()
- .expression("([EW]),")
.number(" *(d+.?d*),") // speed
.number("(d+.?d*)?,") // course
.number("(?:d+,)?") // battery
@@ -349,19 +351,25 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
position.setValid(true);
}
- if (parser.hasNext(2)) {
- position.setLatitude(-parser.nextCoordinate());
+ if (parser.hasNext(3)) {
+ position.setLatitude(parser.nextCoordinate());
}
- if (parser.hasNext(2)) {
+ if (parser.hasNext(3)) {
position.setLatitude(parser.nextCoordinate());
}
+ if (parser.hasNext(4)) {
+ position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN_HEM));
+ }
- if (parser.hasNext(2)) {
- position.setLongitude(-parser.nextCoordinate());
+ if (parser.hasNext(3)) {
+ position.setLongitude(parser.nextCoordinate());
}
- if (parser.hasNext(2)) {
+ if (parser.hasNext(3)) {
position.setLongitude(parser.nextCoordinate());
}
+ if (parser.hasNext(4)) {
+ position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN_HEM));
+ }
position.setSpeed(parser.nextDouble(0));
position.setCourse(parser.nextDouble(0));