diff options
author | Bernd Weimer <bweimer@blackberry.com> | 2013-10-23 11:16:07 +0200 |
---|---|---|
committer | Bernd Weimer <bweimer@blackberry.com> | 2013-10-31 15:03:16 +0100 |
commit | 23a410b9ce252e966ac2775e34f3cb1887d74614 (patch) | |
tree | f6b47cb3f4a02bf4f84b98c13c09e7971c7741cb | |
parent | 25e6b27e04aac6fd3d671f2f97aac66f3e975068 (diff) |
BlackBerry: Disabled "returnGeoValues" feature
Elimination of interference is not supported on BlackBerry, so
returnGeoValues property will be ignored.
This is a backport of QtSensors commit 6348938.
Change-Id: I77718fbe9a100f9f16007095f52c73e9e7db62ac
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
-rw-r--r-- | plugins/sensors/blackberry/bbmagnetometer.cpp | 43 | ||||
-rw-r--r-- | src/sensors/qmagnetometer.cpp | 3 |
2 files changed, 16 insertions, 30 deletions
diff --git a/plugins/sensors/blackberry/bbmagnetometer.cpp b/plugins/sensors/blackberry/bbmagnetometer.cpp index f05dc5c729..32ee8f8c72 100644 --- a/plugins/sensors/blackberry/bbmagnetometer.cpp +++ b/plugins/sensors/blackberry/bbmagnetometer.cpp @@ -55,39 +55,22 @@ bool BbMagnetometer::updateReadingFromEvent(const sensor_event_t &event, QMagnet { float x, y, z; - QMagnetometer * const magnetometer = qobject_cast<QMagnetometer *>(sensor()); - if (magnetometer && magnetometer->returnGeoValues()) { - switch (event.accuracy) { - case SENSOR_ACCURACY_UNRELIABLE: reading->setCalibrationLevel(0.0f); break; - case SENSOR_ACCURACY_LOW: reading->setCalibrationLevel(0.1f); break; + switch (event.accuracy) { + case SENSOR_ACCURACY_UNRELIABLE: reading->setCalibrationLevel(0.0f); break; + case SENSOR_ACCURACY_LOW: reading->setCalibrationLevel(0.1f); break; - // We determined that MEDIUM should map to 1.0, because existing code samples - // show users should pop a calibration screen when seeing < 1.0. The MEDIUM accuracy - // is actually good enough not to require calibration, so we don't want to make it seem - // like it is required artificially. - case SENSOR_ACCURACY_MEDIUM: reading->setCalibrationLevel(1.0f); break; - case SENSOR_ACCURACY_HIGH: reading->setCalibrationLevel(1.0f); break; - } - - x = convertValue(event.motion.dsp.x); - y = convertValue(event.motion.dsp.y); - z = convertValue(event.motion.dsp.z); - - } else { - reading->setCalibrationLevel(1.0f); - -#ifndef Q_OS_BLACKBERRY_TABLET - x = convertValue(event.motion.raw.x); - y = convertValue(event.motion.raw.y); - z = convertValue(event.motion.raw.z); -#else - // Blackberry Tablet OS does not support raw reading values - x = convertValue(event.motion.dsp.x); - y = convertValue(event.motion.dsp.y); - z = convertValue(event.motion.dsp.z); -#endif + // We determined that MEDIUM should map to 1.0, because existing code samples + // show users should pop a calibration screen when seeing < 1.0. The MEDIUM accuracy + // is actually good enough not to require calibration, so we don't want to make it seem + // like it is required artificially. + case SENSOR_ACCURACY_MEDIUM: reading->setCalibrationLevel(1.0f); break; + case SENSOR_ACCURACY_HIGH: reading->setCalibrationLevel(1.0f); break; } + x = convertValue(event.motion.dsp.x); + y = convertValue(event.motion.dsp.y); + z = convertValue(event.motion.dsp.z); + remapAxes(&x, &y, &z); reading->setX(x); reading->setY(y); diff --git a/src/sensors/qmagnetometer.cpp b/src/sensors/qmagnetometer.cpp index 58e6c7b91d..702627d38f 100644 --- a/src/sensors/qmagnetometer.cpp +++ b/src/sensors/qmagnetometer.cpp @@ -75,6 +75,9 @@ IMPLEMENT_READING(QMagnetometerReading) \image sensors-geo-vs-raw-magnetism.jpg + On BlackBerry interference elimination is not supported and hence the + QMagnetometer::returnGeoValues property has no effect. + The accuracy of each reading is measured as a number from 0 to 1. A value of 1 is the highest level that the device can support and 0 is the worst. |