aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/H02ProtocolDecoder.java
diff options
context:
space:
mode:
authorRafael Guterres <guterresrafael@gmail.com>2015-11-27 03:45:22 -0200
committerRafael Guterres <guterresrafael@gmail.com>2015-11-27 03:45:22 -0200
commitca06e8d38c0bbd5a68e63ebada8e115da252b055 (patch)
tree39c00c4ceb571cae540d4c25d38ad3d45c72b49c /src/org/traccar/protocol/H02ProtocolDecoder.java
parentc57bd2d472467b1b3a45aee1b97c9a0aeef5958a (diff)
parent7db2eb1ad224bf00608ebbcfe13bfa7fd519a7fc (diff)
downloadtrackermap-server-ca06e8d38c0bbd5a68e63ebada8e115da252b055.tar.gz
trackermap-server-ca06e8d38c0bbd5a68e63ebada8e115da252b055.tar.bz2
trackermap-server-ca06e8d38c0bbd5a68e63ebada8e115da252b055.zip
Merge tananaev/master
Conflicts: src/org/traccar/web/WebServer.java
Diffstat (limited to 'src/org/traccar/protocol/H02ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java
index d245fbdc8..31bdd9aa9 100644
--- a/src/org/traccar/protocol/H02ProtocolDecoder.java
+++ b/src/org/traccar/protocol/H02ProtocolDecoder.java
@@ -122,9 +122,17 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
.any()
.number("(dd)(dd)(dd),") // time
.expression("([AV])?,") // validity
- .number("-?(d+)-?(dd.d+),") // latitude
+ .groupBegin()
+ .number("(d+)(dd.d+),") // latitude
+ .or()
+ .number("-(d+)-(d+.d+),") // latitude
+ .groupEnd()
.expression("([NS]),")
- .number("-?(d+)-?(dd.d+),") // longitude
+ .groupBegin()
+ .number("(d+)(dd.d+),") // longitude
+ .or()
+ .number("-(d+)-(d+.d+),") // longitude
+ .groupEnd()
.expression("([EW]),")
.number("(d+.?d*),") // speed
.number("(d+.?d*)?,") // course
@@ -155,8 +163,20 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder {
position.setValid(parser.next().equals("A"));
}
- position.setLatitude(parser.nextCoordinate());
- position.setLongitude(parser.nextCoordinate());
+ if (parser.hasNext(2)) {
+ position.setLatitude(parser.nextCoordinate());
+ }
+ if (parser.hasNext(2)) {
+ position.setLatitude(parser.nextCoordinate());
+ }
+
+ if (parser.hasNext(2)) {
+ position.setLongitude(parser.nextCoordinate());
+ }
+ if (parser.hasNext(2)) {
+ position.setLongitude(parser.nextCoordinate());
+ }
+
position.setSpeed(parser.nextDouble());
position.setCourse(parser.nextDouble());