summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@digia.com>2014-08-07 13:42:03 +0200
committerMaurice Kalinowski <maurice.kalinowski@digia.com>2014-08-08 09:48:24 +0200
commit4383fa5df7a220670e0ae6567e56b8a5809d0704 (patch)
tree9838681cb2378b91f17cf967e32f9f8a39d092d3
parenteaf4698cf26b436180d7f5896375f6fe3d20f424 (diff)
downloadqtsensors-4383fa5df7a220670e0ae6567e56b8a5809d0704.tar.gz
qtsensors-4383fa5df7a220670e0ae6567e56b8a5809d0704.tar.bz2
qtsensors-4383fa5df7a220670e0ae6567e56b8a5809d0704.zip
Add Windows Phone 8.1 supported sensors
AmbientLight as well as Orientation sensors have been added to the Windows Phone 8.1 API. Furthermore accuracy for QCompass is now available on all WinRT related platforms. [ChangeLog][Windows Phone] Add support for QAmbientLightSensor and QOrientationSensor with Windows Phone 8.1 Task-number: QTBUG-39627 Change-Id: I6b2674c0d9935b874f35e6453f1e51d811133264 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
-rw-r--r--src/plugins/sensors/winrt/main.cpp10
-rw-r--r--src/plugins/sensors/winrt/winrt.pro13
-rw-r--r--src/plugins/sensors/winrt/winrtcompass.cpp3
3 files changed, 7 insertions, 19 deletions
diff --git a/src/plugins/sensors/winrt/main.cpp b/src/plugins/sensors/winrt/main.cpp
index 13b8712..25251fd 100644
--- a/src/plugins/sensors/winrt/main.cpp
+++ b/src/plugins/sensors/winrt/main.cpp
@@ -43,10 +43,8 @@
#include "winrtcompass.h"
#include "winrtgyroscope.h"
#include "winrtrotationsensor.h"
-#ifndef Q_OS_WINPHONE
-# include "winrtambientlightsensor.h"
-# include "winrtorientationsensor.h"
-#endif
+#include "winrtambientlightsensor.h"
+#include "winrtorientationsensor.h"
#include <QtSensors/QAccelerometer>
#include <QtSensors/QAmbientLightSensor>
#include <QtSensors/QCompass>
@@ -69,10 +67,8 @@ public:
QSensorManager::registerBackend(QCompass::type, QByteArrayLiteral("WinRtCompass"), this);
QSensorManager::registerBackend(QGyroscope::type, QByteArrayLiteral("WinRtGyroscope"), this);
QSensorManager::registerBackend(QRotationSensor::type, QByteArrayLiteral("WinRtRotationSensor"), this);
-#ifndef Q_OS_WINPHONE
QSensorManager::registerBackend(QAmbientLightSensor::type, QByteArrayLiteral("WinRtAmbientLightSensor"), this);
QSensorManager::registerBackend(QOrientationSensor::type, QByteArrayLiteral("WinRtOrientationSensor"), this);
-#endif
}
QSensorBackend *createBackend(QSensor *sensor)
@@ -89,13 +85,11 @@ public:
if (sensor->identifier() == QByteArrayLiteral("WinRtRotationSensor"))
return new WinRtRotationSensor(sensor);
-#ifndef Q_OS_WINPHONE
if (sensor->identifier() == QByteArrayLiteral("WinRtAmbientLightSensor"))
return new WinRtAmbientLightSensor(sensor);
if (sensor->identifier() == QByteArrayLiteral("WinRtOrientationSensor"))
return new WinRtOrientationSensor(sensor);
-#endif // !Q_OS_WINPHONE
return 0;
}
diff --git a/src/plugins/sensors/winrt/winrt.pro b/src/plugins/sensors/winrt/winrt.pro
index e9f3274..4a03bf2 100644
--- a/src/plugins/sensors/winrt/winrt.pro
+++ b/src/plugins/sensors/winrt/winrt.pro
@@ -7,26 +7,21 @@ load(qt_plugin)
HEADERS += \
winrtaccelerometer.h \
+ winrtambientlightsensor.h \
winrtcommon.h \
winrtcompass.h \
+ winrtorientationsensor.h \
winrtrotationsensor.h \
winrtgyroscope.h
SOURCES += \
main.cpp \
winrtaccelerometer.cpp \
+ winrtambientlightsensor.cpp \
winrtcommon.cpp \
winrtcompass.cpp \
+ winrtorientationsensor.cpp \
winrtrotationsensor.cpp \
winrtgyroscope.cpp
-!winphone {
- HEADERS += \
- winrtambientlightsensor.h \
- winrtorientationsensor.h
- SOURCES += \
- winrtambientlightsensor.cpp \
- winrtorientationsensor.cpp
-}
-
OTHER_FILES = plugin.json
diff --git a/src/plugins/sensors/winrt/winrtcompass.cpp b/src/plugins/sensors/winrt/winrtcompass.cpp
index 6a678e2..c2b7240 100644
--- a/src/plugins/sensors/winrt/winrtcompass.cpp
+++ b/src/plugins/sensors/winrt/winrtcompass.cpp
@@ -94,7 +94,6 @@ public:
qCWarning(lcWinRtSensors) << "Failed to get compass reading timestamp." << qt_error_string(hr);
return hr;
}
-#ifndef Q_OS_WINPHONE // Windows Phone doesn't implement the accuracy interface
ComPtr<ICompassReadingHeadingAccuracy> accuracyReading;
hr = value.As(&accuracyReading);
if (FAILED(hr)) {
@@ -124,7 +123,7 @@ public:
reading.setCalibrationLevel(1.00);
break;
}
-#endif
+
reading.setAzimuth(heading);
reading.setTimestamp(dateTimeToMsSinceEpoch(dateTime));
q->newReadingAvailable();