summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/sensors/android/src/androidmagnetometer.cpp16
-rw-r--r--src/sensors/qmagnetometer.cpp10
-rw-r--r--sync.profile5
3 files changed, 23 insertions, 8 deletions
diff --git a/src/plugins/sensors/android/src/androidmagnetometer.cpp b/src/plugins/sensors/android/src/androidmagnetometer.cpp
index a729dddf..fcde4cf5 100644
--- a/src/plugins/sensors/android/src/androidmagnetometer.cpp
+++ b/src/plugins/sensors/android/src/androidmagnetometer.cpp
@@ -39,13 +39,27 @@
#include "androidmagnetometer.h"
+enum AndroidSensorStatus
+{
+ SENSOR_STATUS_UNRELIABLE = 0,
+ SENSOR_STATUS_ACCURACY_LOW = 1,
+ SENSOR_STATUS_ACCURACY_MEDIUM = 2,
+ SENSOR_STATUS_ACCURACY_HIGH = 3,
+};
+
AndroidMagnetometer::AndroidMagnetometer(AndroidSensors::AndroidSensorType type, QSensor *sensor)
:AndroidCommonSensor<QMagnetometerReading>(type, sensor)
{}
void AndroidMagnetometer::onAccuracyChanged(jint accuracy)
{
- m_reader.setCalibrationLevel(accuracy);
+ // Expected range is [0, 3]
+ if (accuracy < SENSOR_STATUS_UNRELIABLE || accuracy > SENSOR_STATUS_ACCURACY_HIGH) {
+ qWarning("Unable to get sensor accuracy. Unexpected value: %d", accuracy);
+ return;
+ }
+
+ m_reader.setCalibrationLevel(accuracy / qreal(3.0));
}
void AndroidMagnetometer::onSensorChanged(jlong timestamp, const jfloat *values, uint size)
diff --git a/src/sensors/qmagnetometer.cpp b/src/sensors/qmagnetometer.cpp
index 1ddc217b..0e28b5aa 100644
--- a/src/sensors/qmagnetometer.cpp
+++ b/src/sensors/qmagnetometer.cpp
@@ -76,7 +76,13 @@ IMPLEMENT_READING(QMagnetometerReading)
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.
- \sa {http://wiki.forum.nokia.com/index.php/CS001671_-_Calibrating_the_magnetometer_sensor}{CS001671 - Calibrating the magnetometer sensor}
+
+ \section2 Calibration
+ If the device is reporting low accuracy, then calibration might be needed before acceptable measurements
+ can be provided.
+ Basic calibration can usually be done by either rotating your device in a figure of eight, or by
+ rotating the device along each of its three axes. For more information, check your device's
+ documentation on how to calibrate the magnetic sensor.
*/
/*!
@@ -150,7 +156,7 @@ void QMagnetometerReading::setZ(qreal z)
Note that this only changes when measuring geomagnetic flux density.
Raw magnetic flux readings will always have a value of 1.
- \sa {QMagnetometerReading Units}, {http://wiki.forum.nokia.com/index.php/CS001671_-_Calibrating_the_magnetometer_sensor}{CS001671 - Calibrating the magnetometer sensor}
+ \sa {QMagnetometerReading Units}, {Calibration}
*/
qreal QMagnetometerReading::calibrationLevel() const
diff --git a/sync.profile b/sync.profile
index ce08463a..1e7fd14c 100644
--- a/sync.profile
+++ b/sync.profile
@@ -3,8 +3,3 @@
);
%moduleheaders = ( # restrict the module headers to those found in relative path
);
-%dependencies = (
- "qtbase" => "",
- "qtxmlpatterns" => "",
- "qtdeclarative" => "",
-);