summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-08-14 13:04:42 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-08-14 13:04:58 +0200
commitd34d3e421bb998777c11265ec9db1f239bd9bdb1 (patch)
tree6e5156243d048c9a7a31982b1a562d1a87bc7123 /src
parentf55ae20fa3216e0fcaa7973b047ac5688e2c50bc (diff)
parenta36d9e67e3b8168cb4d1eb76eda96ebb8242fd20 (diff)
downloadqtlocation-d34d3e421bb998777c11265ec9db1f239bd9bdb1.tar.gz
Merge branch '5.3' into 5.4
Change-Id: I02ab19530354f656823e59bb43a6fc4786b2f189
Diffstat (limited to 'src')
-rw-r--r--src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp31
-rw-r--r--src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster_p.h3
2 files changed, 26 insertions, 8 deletions
diff --git a/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp
index 0b4c1414..8e6e1b61 100644
--- a/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp
+++ b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp
@@ -115,7 +115,7 @@ QGeoPositionInfoSourceGeoclueMaster::QGeoPositionInfoSourceGeoclueMaster(QObject
: QGeoPositionInfoSource(parent), QGeoclueMaster(this), m_pos(0), m_vel(0),
m_lastVelocityIsFresh(false), m_regularUpdateTimedOut(false), m_lastVelocity(qQNaN()),
m_lastDirection(qQNaN()), m_lastClimb(qQNaN()), m_lastPositionFromSatellite(false),
- m_methods(AllPositioningMethods), m_running(false)
+ m_methods(AllPositioningMethods), m_running(false), m_error(NoError)
{
#ifndef QT_NO_DATASTREAM
// Load the last known location
@@ -497,25 +497,42 @@ void QGeoPositionInfoSourceGeoclueMaster::positionProviderChanged(const QByteArr
}
}
-bool QGeoPositionInfoSourceGeoclueMaster::configurePositionSource()
+void QGeoPositionInfoSourceGeoclueMaster::configurePositionSource()
{
+ GeoclueAccuracyLevel accuracy;
+ GeoclueResourceFlags resourceFlags;
+
switch (preferredPositioningMethods()) {
case SatellitePositioningMethods:
- return createMasterClient(GEOCLUE_ACCURACY_LEVEL_DETAILED, GEOCLUE_RESOURCE_GPS);
+ accuracy = GEOCLUE_ACCURACY_LEVEL_DETAILED;
+ resourceFlags = GEOCLUE_RESOURCE_GPS;
+ break;
case NonSatellitePositioningMethods:
- return createMasterClient(GEOCLUE_ACCURACY_LEVEL_NONE, GeoclueResourceFlags(GEOCLUE_RESOURCE_CELL | GEOCLUE_RESOURCE_NETWORK));
+ accuracy = GEOCLUE_ACCURACY_LEVEL_NONE;
+ resourceFlags = GeoclueResourceFlags(GEOCLUE_RESOURCE_CELL | GEOCLUE_RESOURCE_NETWORK);
+ break;
case AllPositioningMethods:
- return createMasterClient(GEOCLUE_ACCURACY_LEVEL_NONE, GEOCLUE_RESOURCE_ALL);
+ accuracy = GEOCLUE_ACCURACY_LEVEL_NONE;
+ resourceFlags = GEOCLUE_RESOURCE_ALL;
+ break;
default:
qWarning("GeoPositionInfoSourceGeoClueMaster unknown preferred method.");
+ m_error = UnknownSourceError;
+ emit QGeoPositionInfoSource::error(m_error);
+ return;
}
- return false;
+ if (createMasterClient(accuracy, resourceFlags)) {
+ m_error = NoError;
+ } else {
+ m_error = UnknownSourceError;
+ emit QGeoPositionInfoSource::error(m_error);
+ }
}
QGeoPositionInfoSource::Error QGeoPositionInfoSourceGeoclueMaster::error() const
{
- return NoError;
+ return m_error;
}
#include "moc_qgeopositioninfosource_geocluemaster_p.cpp"
diff --git a/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster_p.h b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster_p.h
index 3f88334a..193c9765 100644
--- a/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster_p.h
+++ b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster_p.h
@@ -101,7 +101,7 @@ private slots:
void positionProviderChanged(const QByteArray &service, const QByteArray &path);
private:
- bool configurePositionSource();
+ void configurePositionSource();
void cleanupPositionSource();
void setOptions();
@@ -118,6 +118,7 @@ private:
QGeoPositionInfo m_lastPosition;
PositioningMethods m_methods;
bool m_running;
+ QGeoPositionInfoSource::Error m_error;
};
QT_END_NAMESPACE