Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2012-11-09 01:54:01 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:46:51 +0300
commit58d629c8e214ba4b28671217b49000505ef0167d (patch)
tree8227b919d51f0b156fa9622d83013c9e30d026af
parentd83b3d3384389e571445b5e95ee1effe3b0f7604 (diff)
Minor style changes.
-rw-r--r--android/src/com/mapswithme/maps/location/LocationService.java14
-rw-r--r--platform/location.hpp8
-rw-r--r--platform/location_service.cpp3
3 files changed, 14 insertions, 11 deletions
diff --git a/android/src/com/mapswithme/maps/location/LocationService.java b/android/src/com/mapswithme/maps/location/LocationService.java
index e292e1c420..d24284320e 100644
--- a/android/src/com/mapswithme/maps/location/LocationService.java
+++ b/android/src/com/mapswithme/maps/location/LocationService.java
@@ -27,7 +27,9 @@ public class LocationService implements LocationListener, SensorEventListener, W
private static final String TAG = "LocationService";
/// These constants should correspond to values defined in platform/location.hpp
- public static final int ERROR_DENIED = 0;
+ /// Leave 0-value as no any error.
+ public static final int ERROR_DENIED = 1;
+ public static final int ERROR_GPS_OFF = 2;
public interface Listener
{
@@ -38,7 +40,7 @@ public class LocationService implements LocationListener, SensorEventListener, W
private HashSet<Listener> m_observers = new HashSet<Listener>(10);
- // Used to filter locations from different providers
+ /// Used to filter locations from different providers
private Location m_lastLocation = null;
private long m_lastTime = 0;
private double m_drivingHeading = -1.0;
@@ -53,7 +55,7 @@ public class LocationService implements LocationListener, SensorEventListener, W
/// To calculate true north for compass
private GeomagneticField m_magneticField = null;
- /// true when GPS is on
+ /// true when LocationService is on
private boolean m_isActive = false;
private MWMApplication m_application = null;
@@ -74,12 +76,14 @@ public class LocationService implements LocationListener, SensorEventListener, W
public Location getLastKnown() { return m_lastLocation; }
+ /*
private void notifyOnError(int errorCode)
{
Iterator<Listener> it = m_observers.iterator();
while (it.hasNext())
it.next().onLocationError(errorCode);
}
+ */
private void notifyLocationUpdated(long time, double lat, double lon, float accuracy)
{
@@ -129,8 +133,8 @@ public class LocationService implements LocationListener, SensorEventListener, W
{
// Use WiFi BSSIDS and Google Internet location service if no other options are available
// But only if connection is available
- if (ConnectionState.isConnected(m_application)
- && ((WifiManager) m_application.getSystemService(Context.WIFI_SERVICE)).isWifiEnabled())
+ if (ConnectionState.isConnected(m_application) &&
+ ((WifiManager)m_application.getSystemService(Context.WIFI_SERVICE)).isWifiEnabled())
{
if (m_wifiScanner == null)
m_wifiScanner = new WifiLocation();
diff --git a/platform/location.hpp b/platform/location.hpp
index 87261f68c1..bd742e333a 100644
--- a/platform/location.hpp
+++ b/platform/location.hpp
@@ -6,13 +6,11 @@
namespace location
{
- /// after this period we cont position as "too old"
- static double const POSITION_TIMEOUT_SECONDS = 300.0;
-
enum TLocationError
{
- EDenied,
- ENotSupported
+ ENoError = 0,
+ EDenied = 1,
+ EGPSIsOff = 2
};
enum TLocationSource
diff --git a/platform/location_service.cpp b/platform/location_service.cpp
index 1159599b1b..a24c8c8acd 100644
--- a/platform/location_service.cpp
+++ b/platform/location_service.cpp
@@ -21,10 +21,11 @@ class PositionFilter
public:
PositionFilter() : m_prevLocation(NULL) {}
~PositionFilter() { delete m_prevLocation; }
+
/// @return true if location should be sent to observers
bool Passes(location::GpsInfo const & newLocation)
{
- if (time(NULL) - newLocation.m_timestamp > location::POSITION_TIMEOUT_SECONDS)
+ if (time(NULL) - newLocation.m_timestamp > 300.0)
return false;
bool passes = true;