diff options
author | Vitaly Litvak <vitavaque@gmail.com> | 2015-10-29 00:19:36 +0300 |
---|---|---|
committer | Vitaly Litvak <vitavaque@gmail.com> | 2015-10-29 00:19:36 +0300 |
commit | 98162399456d9386797f7b2cce48e4d93299ad82 (patch) | |
tree | aee5277c6eb92efa10780ab8b9faf0eab80ec892 /src/org/traccar/protocol/GlobalSatProtocolDecoder.java | |
parent | 4610c2245dea9178ff46e7eea63b9fffd99f852d (diff) | |
download | trackermap-server-98162399456d9386797f7b2cce48e4d93299ad82.tar.gz trackermap-server-98162399456d9386797f7b2cce48e4d93299ad82.tar.bz2 trackermap-server-98162399456d9386797f7b2cce48e4d93299ad82.zip |
For #1484 - updated GlobalSat alternative decoder to support EusPro SF-400 device, fixed validity detection which was broken during refactoring
Diffstat (limited to 'src/org/traccar/protocol/GlobalSatProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/GlobalSatProtocolDecoder.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java index 049bb2f7f..918f17348 100644 --- a/src/org/traccar/protocol/GlobalSatProtocolDecoder.java +++ b/src/org/traccar/protocol/GlobalSatProtocolDecoder.java @@ -180,7 +180,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { .text("$") .number("(d+),") // imei .number("d+,") // mode - .number("(d),") // fix + .number("(d+),") // fix .number("(dd)(dd)(dd),") // date (ddmmyy) .number("(dd)(dd)(dd),") // time (hhmmss) .expression("([EW])") @@ -189,8 +189,8 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { .number("(dd)(dd.d+),") // latitude (ddmm.mmmm) .number("(d+.?d*),") // altitude .number("(d+.?d*),") // speed - .number("(d+.?d*),") // course - .number("(d+),") // satellites + .number("(d*.?d*),") // course + .number("(d+)[,\\\\*]") // satellites .number("(d+.?d*)") // hdop .compile(); @@ -209,7 +209,7 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { } position.setDeviceId(getDeviceId()); - position.setValid(parser.next().equals("1")); + position.setValid(!parser.next().equals("1")); DateBuilder dateBuilder = new DateBuilder() .setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()) @@ -220,7 +220,8 @@ public class GlobalSatProtocolDecoder extends BaseProtocolDecoder { position.setLatitude(parser.nextCoordinate(Parser.CoordinateFormat.HEM_DEG_MIN)); position.setAltitude(parser.nextDouble()); position.setSpeed(parser.nextDouble()); - position.setCourse(parser.nextDouble()); + String course = parser.next(); + position.setCourse(course.isEmpty() ? 0d : Double.parseDouble(course)); position.set(Event.KEY_SATELLITES, parser.nextInt()); position.set(Event.KEY_HDOP, parser.next()); |