diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-03-19 09:30:43 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-03-19 09:30:43 +1300 |
commit | 1e6fec776c579ab11b190cef38fc9af13784f241 (patch) | |
tree | 6ece11809a6ac6b52cd27ae9f7a77a03bdb66c2b /src/org/traccar/LocationProviderHandler.java | |
parent | beddf46069c0e1a656cd2c2263fcb4309ccb0ac9 (diff) | |
download | trackermap-server-1e6fec776c579ab11b190cef38fc9af13784f241.tar.gz trackermap-server-1e6fec776c579ab11b190cef38fc9af13784f241.tar.bz2 trackermap-server-1e6fec776c579ab11b190cef38fc9af13784f241.zip |
Option to use GSM location for invalid
Diffstat (limited to 'src/org/traccar/LocationProviderHandler.java')
-rw-r--r-- | src/org/traccar/LocationProviderHandler.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/org/traccar/LocationProviderHandler.java b/src/org/traccar/LocationProviderHandler.java index 62d5f1d04..c59427474 100644 --- a/src/org/traccar/LocationProviderHandler.java +++ b/src/org/traccar/LocationProviderHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2015 - 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. @@ -27,9 +27,11 @@ import org.traccar.model.Position; public class LocationProviderHandler implements ChannelUpstreamHandler { private final LocationProvider locationProvider; + private final boolean processInvalidPositions; - public LocationProviderHandler(LocationProvider locationProvider) { + public LocationProviderHandler(LocationProvider locationProvider, boolean processInvalidPositions) { this.locationProvider = locationProvider; + this.processInvalidPositions = processInvalidPositions; } @Override @@ -43,7 +45,7 @@ public class LocationProviderHandler implements ChannelUpstreamHandler { Object message = e.getMessage(); if (message instanceof Position) { final Position position = (Position) message; - if (locationProvider != null && position.getOutdated()) { + if (position.getOutdated() || (processInvalidPositions && !position.getValid())) { locationProvider.getLocation(position.getAttributes(), new LocationProvider.LocationProviderCallback() { @Override public void onSuccess(double latitude, double longitude) { |