aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/TaipProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-03-26 14:29:38 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-03-26 14:29:38 +1300
commitdbb56e3b500c624ef26cce8f8d1188fdef49f5e3 (patch)
treeb559ef44eef9c8477f58a9b47ae3df830be922bc /src/org/traccar/protocol/TaipProtocolDecoder.java
parent0de84ae45c6dbd1b22e764fef7ab394287e70d3c (diff)
downloadtrackermap-server-dbb56e3b500c624ef26cce8f8d1188fdef49f5e3.tar.gz
trackermap-server-dbb56e3b500c624ef26cce8f8d1188fdef49f5e3.tar.bz2
trackermap-server-dbb56e3b500c624ef26cce8f8d1188fdef49f5e3.zip
Alternative TAIP protocol format
Diffstat (limited to 'src/org/traccar/protocol/TaipProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/TaipProtocolDecoder.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/TaipProtocolDecoder.java b/src/org/traccar/protocol/TaipProtocolDecoder.java
index 309263cd5..a46cdefe3 100644
--- a/src/org/traccar/protocol/TaipProtocolDecoder.java
+++ b/src/org/traccar/protocol/TaipProtocolDecoder.java
@@ -54,8 +54,13 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
.number("(dd)(dd)(dd)") // date (mmddyy)
.number("(dd)(dd)(dd)") // time (hhmmss)
.groupEnd()
+ .groupBegin()
.number("([-+]dd)(d{5})") // latitude
.number("([-+]ddd)(d{5})") // longitude
+ .or()
+ .number("([-+])(dd)(dd.dddd)") // latitude
+ .number("([-+])(ddd)(dd.dddd)") // longitude
+ .groupEnd()
.number("(ddd)") // speed
.number("(ddd)") // course
.groupBegin()
@@ -112,8 +117,15 @@ public class TaipProtocolDecoder extends BaseProtocolDecoder {
position.setTime(parser.nextDateTime(Parser.DateTimeFormat.DMY_HMS));
}
- position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_DEG));
- position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_DEG));
+ if (parser.hasNext(4)) {
+ position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_DEG));
+ position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_DEG));
+ }
+ if (parser.hasNext(6)) {
+ position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN));
+ position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN));
+ }
+
position.setSpeed(UnitsConverter.knotsFromMph(parser.nextDouble()));
position.setCourse(parser.nextDouble());