diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-11-15 22:28:25 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-11-15 22:28:25 +1300 |
commit | 09ee4cc93d600edce023f414c9d373639c137975 (patch) | |
tree | 7995615ab99aadec97eb9cffc94f0bd1b0dbc3ab /src | |
parent | 0a2205a648243a755325c2cfceaa630f887d8952 (diff) | |
download | trackermap-server-09ee4cc93d600edce023f414c9d373639c137975.tar.gz trackermap-server-09ee4cc93d600edce023f414c9d373639c137975.tar.bz2 trackermap-server-09ee4cc93d600edce023f414c9d373639c137975.zip |
Improve OKO NAVI regex pattern
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/OkoProtocolDecoder.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/OkoProtocolDecoder.java b/src/org/traccar/protocol/OkoProtocolDecoder.java index 312127283..e86acf0b8 100644 --- a/src/org/traccar/protocol/OkoProtocolDecoder.java +++ b/src/org/traccar/protocol/OkoProtocolDecoder.java @@ -35,14 +35,14 @@ public class OkoProtocolDecoder extends BaseProtocolDecoder { private static final Pattern PATTERN = new PatternBuilder() .text("{") .number("(d{15}),").optional() // imei - .number("(dd)(dd)(dd).(ddd),") // time + .number("(dd)(dd)(dd).d+,") // time .expression("([AV]),") // validity .number("(dd)(dd.d+),") // latitude .expression("([NS]),") .number("(ddd)(dd.d+),") // longitude .expression("([EW]),") - .number("(d+.?d*),") // speed - .number("(d+.?d*),") // course + .number("(d+.?d*)?,") // speed + .number("(d+.?d*)?,") // course .number("(dd)(dd)(dd),") // date (ddmmyy) .number("(d+),") // satellites .number("(d+.d+),") // adc @@ -77,13 +77,13 @@ public class OkoProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); DateBuilder dateBuilder = new DateBuilder() - .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt(), parser.nextInt()); + .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setValid(parser.next().equals("A")); position.setLatitude(parser.nextCoordinate()); position.setLongitude(parser.nextCoordinate()); - position.setSpeed(parser.nextDouble()); - position.setCourse(parser.nextDouble()); + position.setSpeed(parser.nextDouble(0)); + position.setCourse(parser.nextDouble(0)); dateBuilder.setDateReverse(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setTime(dateBuilder.getDate()); |