diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-26 14:29:38 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-03-26 14:29:38 +1300 |
commit | dbb56e3b500c624ef26cce8f8d1188fdef49f5e3 (patch) | |
tree | b559ef44eef9c8477f58a9b47ae3df830be922bc /src/org/traccar | |
parent | 0de84ae45c6dbd1b22e764fef7ab394287e70d3c (diff) | |
download | traccar-server-dbb56e3b500c624ef26cce8f8d1188fdef49f5e3.tar.gz traccar-server-dbb56e3b500c624ef26cce8f8d1188fdef49f5e3.tar.bz2 traccar-server-dbb56e3b500c624ef26cce8f8d1188fdef49f5e3.zip |
Alternative TAIP protocol format
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/TaipProtocolDecoder.java | 16 |
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()); |