diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-02-21 11:48:00 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-02-21 11:48:00 +1300 |
commit | 2c8223bed1ae6ed809a50a4e459e3cc50068bd86 (patch) | |
tree | 919c279ad1750109910c0e1e0c9ba270909a34bc /src/org/traccar/protocol/TelicProtocolDecoder.java | |
parent | 63d3e629fd0b4d02b1885160e4289596cfd958c0 (diff) | |
download | trackermap-server-2c8223bed1ae6ed809a50a4e459e3cc50068bd86.tar.gz trackermap-server-2c8223bed1ae6ed809a50a4e459e3cc50068bd86.tar.bz2 trackermap-server-2c8223bed1ae6ed809a50a4e459e3cc50068bd86.zip |
Support another Telic protocol format
Diffstat (limited to 'src/org/traccar/protocol/TelicProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/TelicProtocolDecoder.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/TelicProtocolDecoder.java b/src/org/traccar/protocol/TelicProtocolDecoder.java index 466b40aa4..3ba81de6e 100644 --- a/src/org/traccar/protocol/TelicProtocolDecoder.java +++ b/src/org/traccar/protocol/TelicProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 - 2015 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2014 - 2016 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,8 +39,13 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder { .number("d+,") .number("(dd)(dd)(dd)") // date .number("(dd)(dd)(dd),") // time + .groupBegin() + .number("(ddd)(dd)(dddd),") // longitude + .number("(dd)(dd)(dddd),") // latitude + .or() .number("(-?d+),") // longitude .number("(-?d+),") // latitude + .groupEnd() .number("(d),") // validity .number("(d+),") // speed .number("(d+),") // course @@ -72,8 +77,16 @@ public class TelicProtocolDecoder extends BaseProtocolDecoder { .setTime(parser.nextInt(), parser.nextInt(), parser.nextInt()); position.setTime(dateBuilder.getDate()); - position.setLongitude(parser.nextDouble() / 10000); - position.setLatitude(parser.nextDouble() / 10000); + if (parser.hasNext(6)) { + position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN)); + position.setLongitude(parser.nextCoordinate(Parser.CoordinateFormat.DEG_MIN_MIN)); + } + + if (parser.hasNext(2)) { + position.setLongitude(parser.nextDouble() / 10000); + position.setLatitude(parser.nextDouble() / 10000); + } + position.setValid(parser.nextInt() != 1); position.setSpeed(parser.nextDouble()); position.setCourse(parser.nextDouble()); |