summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2015-12-30 14:21:18 +0000
committerMike Krus <mike.krus@kdab.com>2015-12-31 10:20:34 +0000
commita756c0a88b43c4b7251d6b2b95acddbe3af26932 (patch)
tree1fd6ee5ade04a2fd94aae147078ceaf6b71262ae
parent99a1ba7c488939f606628593e7d21e42aa583502 (diff)
downloadqtlocation-a756c0a88b43c4b7251d6b2b95acddbe3af26932.tar.gz
tvOS support
Builds but untested, only support single ping location updates Change-Id: I96f6df9d5b26ed17e10cf14d33066dbad9945818 Reviewed-by: Jake Petroules <jake.petroules@theqtcompany.com>
-rw-r--r--src/plugins/position/corelocation/corelocation.pro2
-rw-r--r--src/plugins/position/corelocation/qgeopositioninfosource_cl.mm11
-rw-r--r--src/plugins/position/position.pro2
3 files changed, 13 insertions, 2 deletions
diff --git a/src/plugins/position/corelocation/corelocation.pro b/src/plugins/position/corelocation/corelocation.pro
index 25748008..1415643b 100644
--- a/src/plugins/position/corelocation/corelocation.pro
+++ b/src/plugins/position/corelocation/corelocation.pro
@@ -17,5 +17,5 @@ OTHER_FILES += \
plugin.json
osx: LIBS += -framework Foundation
-else: ios: LIBS += -framework CoreFoundation
+else: ios|tvos: LIBS += -framework CoreFoundation
LIBS += -framework CoreLocation
diff --git a/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm b/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm
index 0e5e261b..231f8726 100644
--- a/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm
+++ b/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm
@@ -33,6 +33,7 @@
#include <QTimerEvent>
#include <QDebug>
+#include <QtCore/qglobal.h>
#include "qgeopositioninfosource_cl_p.h"
@@ -74,10 +75,12 @@
location.setAttribute(QGeoPositionInfo::HorizontalAccuracy, newLocation.horizontalAccuracy);
if (newLocation.verticalAccuracy >= 0)
location.setAttribute(QGeoPositionInfo::VerticalAccuracy, newLocation.verticalAccuracy);
+#ifndef Q_OS_TVOS
if (newLocation.course >= 0)
location.setAttribute(QGeoPositionInfo::Direction, newLocation.course);
if (newLocation.speed >= 0)
location.setAttribute(QGeoPositionInfo::GroundSpeed, newLocation.speed);
+#endif
m_positionInfoSource->locationDataAvailable(location);
}
@@ -157,7 +160,11 @@ void QGeoPositionInfoSourceCL::setTimeoutInterval(int msec)
void QGeoPositionInfoSourceCL::startUpdates()
{
if (enableLocationManager()) {
+#ifdef Q_OS_TVOS
+ [m_locationManager requestLocation]; // service will run long enough for one location update
+#else
[m_locationManager startUpdatingLocation];
+#endif
m_started = true;
setTimeoutInterval(m_updateTimeout);
@@ -183,7 +190,11 @@ void QGeoPositionInfoSourceCL::requestUpdate(int timeout)
else if (enableLocationManager()) {
// This will force LM to generate a new update
[m_locationManager stopUpdatingLocation];
+#ifdef Q_OS_TVOS
+ [m_locationManager requestLocation]; // service will run long enough for one location update
+#else
[m_locationManager startUpdatingLocation];
+#endif
setTimeoutInterval(timeout);
} else setError(QGeoPositionInfoSource::AccessError);
diff --git a/src/plugins/position/position.pro b/src/plugins/position/position.pro
index f9492a79..4569810a 100644
--- a/src/plugins/position/position.pro
+++ b/src/plugins/position/position.pro
@@ -3,7 +3,7 @@ TEMPLATE = subdirs
qtHaveModule(dbus):SUBDIRS += geoclue
config_gypsy:SUBDIRS += gypsy
qtHaveModule(simulator):SUBDIRS += simulator
-osx|ios:SUBDIRS += corelocation
+osx|ios|tvos:SUBDIRS += corelocation
android:!android-no-sdk:SUBDIRS += android
winrt:SUBDIRS += winrt
win32:qtHaveModule(serialport):SUBDIRS += serialnmea