summaryrefslogtreecommitdiffstats
path: root/qt-mobile/gpslocation.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-11 10:54:36 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-11-11 12:37:57 -0800
commit9195f247c4b05a0cb849cf998355dc3ec3b65641 (patch)
treed8b5b4da0928f1f969931fc94cb25371c7518608 /qt-mobile/gpslocation.cpp
parent12a6a8f2b3afe4c6376b874f609be933ed5dbe5c (diff)
downloadsubsurface-9195f247c4b05a0cb849cf998355dc3ec3b65641.tar.gz
Location service: move files around to fit new directory layout
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/gpslocation.cpp')
-rw-r--r--qt-mobile/gpslocation.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/qt-mobile/gpslocation.cpp b/qt-mobile/gpslocation.cpp
new file mode 100644
index 000000000..3f47396c1
--- /dev/null
+++ b/qt-mobile/gpslocation.cpp
@@ -0,0 +1,32 @@
+#include "qt-mobile/gpslocation.h"
+#include <QDebug>
+
+
+GpsLocation::GpsLocation(QObject *parent)
+{
+ QGeoPositionInfoSource *gpsSource = QGeoPositionInfoSource::createDefaultSource(parent);
+ if (gpsSource != 0) {
+ qDebug() << "have position source" << gpsSource->sourceName();
+ connect(gpsSource, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(newPosition(QGeoPositionInfo)));
+ connect(gpsSource, SIGNAL(updateTimeout()), this, SLOT(updateTimeout()));
+ lastPos = gpsSource->lastKnownPosition();
+ gpsSource->requestUpdate(1000);
+ QGeoCoordinate lastCoord = lastPos.coordinate();
+ if (lastCoord.isValid()) {
+ qDebug() << lastCoord.toString();
+ } else {
+ qDebug() << "invalid last position";
+ }
+ } else {
+ qDebug() << "don't have GPS source";
+ }
+}
+void GpsLocation::newPosition(QGeoPositionInfo pos)
+{
+ qDebug() << "received new position" << pos.coordinate().toString();
+}
+
+void GpsLocation::updateTimeout()
+{
+ qDebug() << "request to get new position timed out";
+}