diff options
author | Anton Tananaev <anton@traccar.org> | 2023-07-25 05:15:13 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-07-25 05:15:18 -0700 |
commit | 1a1126d2d39220f3f28d98662a8c3d5fd4c1cfee (patch) | |
tree | d3fcd558dae0b7fd0114ec25f4345d8158be6788 /src/main/java | |
parent | 6e5481ebb1858726604706d011e5c5f509ac5306 (diff) | |
download | trackermap-server-1a1126d2d39220f3f28d98662a8c3d5fd4c1cfee.tar.gz trackermap-server-1a1126d2d39220f3f28d98662a8c3d5fd4c1cfee.tar.bz2 trackermap-server-1a1126d2d39220f3f28d98662a8c3d5fd4c1cfee.zip |
Handle ST410 no GPS data
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java index 047a1822a..86a8bf6fe 100644 --- a/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/SuntechProtocolDecoder.java @@ -271,18 +271,26 @@ public class SuntechProtocolDecoder extends BaseProtocolDecoder { index += 1; // collaborative network } - DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH:mm:ss"); - dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - position.setTime(dateFormat.parse(values[index++] + values[index++])); + if (values[index].isEmpty()) { - position.setLatitude(Double.parseDouble(values[index++])); - position.setLongitude(Double.parseDouble(values[index++])); - position.setSpeed(UnitsConverter.knotsFromKph(Double.parseDouble(values[index++]))); - position.setCourse(Double.parseDouble(values[index++])); + getLastLocation(position, null); - position.set(Position.KEY_SATELLITES, Integer.parseInt(values[index++])); + } else { - position.setValid(values[index++].equals("1")); + DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH:mm:ss"); + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + position.setTime(dateFormat.parse(values[index++] + values[index++])); + + position.setLatitude(Double.parseDouble(values[index++])); + position.setLongitude(Double.parseDouble(values[index++])); + position.setSpeed(UnitsConverter.knotsFromKph(Double.parseDouble(values[index++]))); + position.setCourse(Double.parseDouble(values[index++])); + + position.set(Position.KEY_SATELLITES, Integer.parseInt(values[index++])); + + position.setValid(values[index++].equals("1")); + + } return position; } |