qtmobility/src/sensors/qmagnetometer.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 8 71781823f776
--- a/qtmobility/src/sensors/qmagnetometer.cpp	Fri Apr 16 15:51:22 2010 +0300
+++ b/qtmobility/src/sensors/qmagnetometer.cpp	Mon May 03 13:18:40 2010 +0300
@@ -77,20 +77,24 @@
     ----------  /
     |_________!/
 \endcode
-*/
 
-/*!
-    \enum QMagnetometerReading::CalibrationLevel
+    The magnetometer can report on either raw magnetic flux values or geomagnetic flux values.
+    By default it returns raw magnetic flux values. The QMagnetometer::returnGeoValues property
+    must be set to return geomagnetic flux values.
 
-    \value Undefined The calibration level is not defined or is too low.
-    \value Low       The calibrated values may be inaccurate by up to 3 micro Teslas.
-    \value Middle    The calibrated values may be inaccurate by up to 2 micro Teslas.
-    \value High      The calibrated values may be inaccurate by up to 1 micro Tesla.
+    The primary difference between raw and geomagnetic values is that extra processing
+    is done to eliminate local magnetic interference from the geomagnetic values so they
+    represent only the effect of the Earth's magnetic field. This process is not perfect
+    and the accuracy of each reading may change.
+
+    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.
 */
 
 /*!
     \property QMagnetometerReading::x
-    \brief the raw flux density on the X axis.
+    \brief the raw magnetic flux density on the X axis.
 
     Measured as telsas.
     \sa {QMagnetometerReading Units}
@@ -102,7 +106,7 @@
 }
 
 /*!
-    Sets the raw flux density on the X axis to \a x.
+    Sets the raw magnetic flux density on the X axis to \a x.
 */
 void QMagnetometerReading::setX(qreal x)
 {
@@ -111,7 +115,7 @@
 
 /*!
     \property QMagnetometerReading::y
-    \brief the raw flux density on the Y axis.
+    \brief the raw magnetic flux density on the Y axis.
 
     Measured as telsas.
     \sa {QMagnetometerReading Units}
@@ -123,7 +127,7 @@
 }
 
 /*!
-    Sets the raw flux density on the Y axis to \a y.
+    Sets the raw magnetic flux density on the Y axis to \a y.
 */
 void QMagnetometerReading::setY(qreal y)
 {
@@ -132,7 +136,7 @@
 
 /*!
     \property QMagnetometerReading::z
-    \brief the raw flux density on the Z axis.
+    \brief the raw magnetic flux density on the Z axis.
 
     Measured as telsas.
     \sa {QMagnetometerReading Units}
@@ -144,7 +148,7 @@
 }
 
 /*!
-    Sets the raw flux density on the Z axis to \a z.
+    Sets the raw magnetic flux density on the Z axis to \a z.
 */
 void QMagnetometerReading::setZ(qreal z)
 {
@@ -152,93 +156,31 @@
 }
 
 /*!
-    \property QMagnetometerReading::calibrated_x
-    \brief the calibrated flux density on the X axis.
+    \property QMagnetometerReading::calibrationLevel
+    \brief the accuracy of the reading.
 
-    Measured as telsas.
+    Measured as a value from 0 to 1 with higher values being better.
+
+    Note that this only changes when measuring geomagnetic flux density.
+    Raw magnetic flux readings will always have a value of 1.
     \sa {QMagnetometerReading Units}
 */
 
-qreal QMagnetometerReading::calibrated_x() const
-{
-    return d->calibrated_x;
-}
-
-/*!
-    Sets the calibrated flux density on the X axis to \a calibrated_x.
-*/
-void QMagnetometerReading::setCalibrated_x(qreal calibrated_x)
+qreal QMagnetometerReading::calibrationLevel() const
 {
-    d->calibrated_x = calibrated_x;
-}
-
-/*!
-    \property QMagnetometerReading::calibrated_y
-    \brief the calibrated flux density on the Y axis.
-
-    Measured as telsas.
-    \sa {QMagnetometerReading Units}
-*/
-
-qreal QMagnetometerReading::calibrated_y() const
-{
-    return d->calibrated_y;
+    return d->calibrationLevel;
 }
 
 /*!
-    Sets the calibrated flux density on the Y axis to \a calibrated_y.
-*/
-void QMagnetometerReading::setCalibrated_y(qreal calibrated_y)
-{
-    d->calibrated_y = calibrated_y;
-}
-
-/*!
-    \property QMagnetometerReading::calibrated_z
-    \brief the calibrated flux density on the Z axis.
-
-    Measured as telsas.
-    \sa {QMagnetometerReading Units}
-*/
-
-qreal QMagnetometerReading::calibrated_z() const
-{
-    return d->calibrated_z;
-}
-
-/*!
-    Sets the calibrated flux density on the Z axis to \a calibrated_z.
+    Sets the accuracy of the reading to \a calibrationLevel.
 */
-void QMagnetometerReading::setCalibrated_z(qreal calibrated_z)
-{
-    d->calibrated_z = calibrated_z;
-}
-
-/*!
-    \property QMagnetometerReading::calibrationLevel
-    \brief the calibration level of the reading.
-
-    The higher the calibration, the more accurate the measurement is.
-    \sa {QMagnetometerReading Units}
-*/
-
-QMagnetometerReading::CalibrationLevel QMagnetometerReading::calibrationLevel() const
-{
-    return static_cast<QMagnetometerReading::CalibrationLevel>(d->calibrationLevel);
-}
-
-/*!
-    Sets the calibration level of the reading to \a calibrationLevel.
-*/
-void QMagnetometerReading::setCalibrationLevel(QMagnetometerReading::CalibrationLevel calibrationLevel)
+void QMagnetometerReading::setCalibrationLevel(qreal calibrationLevel)
 {
     d->calibrationLevel = calibrationLevel;
 }
 
 // =====================================================================
 
-// begin generated code
-
 /*!
     \class QMagnetometerFilter
     \ingroup sensors_filter
@@ -295,7 +237,17 @@
 
     \sa QSensor::reading()
 */
-// end generated code
+
+/*!
+    \property QMagnetometer::returnGeoValues
+    \brief a value indicating if geomagnetic values should be returned.
+
+    Set to true to return geomagnetic flux density.
+    Set to false (the default) to return raw magnetic flux density.
+
+    Note that you must access this property via QObject::property() and QObject::setProperty().
+    The property must be set before calling start().
+*/
 
 #include "moc_qmagnetometer.cpp"
 QTM_END_NAMESPACE