qtmobility/src/sensors/qmagnetometer.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 8 71781823f776
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    75      /    O    /  /
    75      /    O    /  /
    76     /         /  /
    76     /         /  /
    77     ----------  /
    77     ----------  /
    78     |_________!/
    78     |_________!/
    79 \endcode
    79 \endcode
    80 */
    80 
    81 
    81     The magnetometer can report on either raw magnetic flux values or geomagnetic flux values.
    82 /*!
    82     By default it returns raw magnetic flux values. The QMagnetometer::returnGeoValues property
    83     \enum QMagnetometerReading::CalibrationLevel
    83     must be set to return geomagnetic flux values.
    84 
    84 
    85     \value Undefined The calibration level is not defined or is too low.
    85     The primary difference between raw and geomagnetic values is that extra processing
    86     \value Low       The calibrated values may be inaccurate by up to 3 micro Teslas.
    86     is done to eliminate local magnetic interference from the geomagnetic values so they
    87     \value Middle    The calibrated values may be inaccurate by up to 2 micro Teslas.
    87     represent only the effect of the Earth's magnetic field. This process is not perfect
    88     \value High      The calibrated values may be inaccurate by up to 1 micro Tesla.
    88     and the accuracy of each reading may change.
       
    89 
       
    90     The accuracy of each reading is measured as a number from 0 to 1.
       
    91     A value of 1 is the highest level that the device can support and 0 is
       
    92     the worst.
    89 */
    93 */
    90 
    94 
    91 /*!
    95 /*!
    92     \property QMagnetometerReading::x
    96     \property QMagnetometerReading::x
    93     \brief the raw flux density on the X axis.
    97     \brief the raw magnetic flux density on the X axis.
    94 
    98 
    95     Measured as telsas.
    99     Measured as telsas.
    96     \sa {QMagnetometerReading Units}
   100     \sa {QMagnetometerReading Units}
    97 */
   101 */
    98 
   102 
   100 {
   104 {
   101     return d->x;
   105     return d->x;
   102 }
   106 }
   103 
   107 
   104 /*!
   108 /*!
   105     Sets the raw flux density on the X axis to \a x.
   109     Sets the raw magnetic flux density on the X axis to \a x.
   106 */
   110 */
   107 void QMagnetometerReading::setX(qreal x)
   111 void QMagnetometerReading::setX(qreal x)
   108 {
   112 {
   109     d->x = x;
   113     d->x = x;
   110 }
   114 }
   111 
   115 
   112 /*!
   116 /*!
   113     \property QMagnetometerReading::y
   117     \property QMagnetometerReading::y
   114     \brief the raw flux density on the Y axis.
   118     \brief the raw magnetic flux density on the Y axis.
   115 
   119 
   116     Measured as telsas.
   120     Measured as telsas.
   117     \sa {QMagnetometerReading Units}
   121     \sa {QMagnetometerReading Units}
   118 */
   122 */
   119 
   123 
   121 {
   125 {
   122     return d->y;
   126     return d->y;
   123 }
   127 }
   124 
   128 
   125 /*!
   129 /*!
   126     Sets the raw flux density on the Y axis to \a y.
   130     Sets the raw magnetic flux density on the Y axis to \a y.
   127 */
   131 */
   128 void QMagnetometerReading::setY(qreal y)
   132 void QMagnetometerReading::setY(qreal y)
   129 {
   133 {
   130     d->y = y;
   134     d->y = y;
   131 }
   135 }
   132 
   136 
   133 /*!
   137 /*!
   134     \property QMagnetometerReading::z
   138     \property QMagnetometerReading::z
   135     \brief the raw flux density on the Z axis.
   139     \brief the raw magnetic flux density on the Z axis.
   136 
   140 
   137     Measured as telsas.
   141     Measured as telsas.
   138     \sa {QMagnetometerReading Units}
   142     \sa {QMagnetometerReading Units}
   139 */
   143 */
   140 
   144 
   142 {
   146 {
   143     return d->z;
   147     return d->z;
   144 }
   148 }
   145 
   149 
   146 /*!
   150 /*!
   147     Sets the raw flux density on the Z axis to \a z.
   151     Sets the raw magnetic flux density on the Z axis to \a z.
   148 */
   152 */
   149 void QMagnetometerReading::setZ(qreal z)
   153 void QMagnetometerReading::setZ(qreal z)
   150 {
   154 {
   151     d->z = z;
   155     d->z = z;
   152 }
   156 }
   153 
   157 
   154 /*!
   158 /*!
   155     \property QMagnetometerReading::calibrated_x
       
   156     \brief the calibrated flux density on the X axis.
       
   157 
       
   158     Measured as telsas.
       
   159     \sa {QMagnetometerReading Units}
       
   160 */
       
   161 
       
   162 qreal QMagnetometerReading::calibrated_x() const
       
   163 {
       
   164     return d->calibrated_x;
       
   165 }
       
   166 
       
   167 /*!
       
   168     Sets the calibrated flux density on the X axis to \a calibrated_x.
       
   169 */
       
   170 void QMagnetometerReading::setCalibrated_x(qreal calibrated_x)
       
   171 {
       
   172     d->calibrated_x = calibrated_x;
       
   173 }
       
   174 
       
   175 /*!
       
   176     \property QMagnetometerReading::calibrated_y
       
   177     \brief the calibrated flux density on the Y axis.
       
   178 
       
   179     Measured as telsas.
       
   180     \sa {QMagnetometerReading Units}
       
   181 */
       
   182 
       
   183 qreal QMagnetometerReading::calibrated_y() const
       
   184 {
       
   185     return d->calibrated_y;
       
   186 }
       
   187 
       
   188 /*!
       
   189     Sets the calibrated flux density on the Y axis to \a calibrated_y.
       
   190 */
       
   191 void QMagnetometerReading::setCalibrated_y(qreal calibrated_y)
       
   192 {
       
   193     d->calibrated_y = calibrated_y;
       
   194 }
       
   195 
       
   196 /*!
       
   197     \property QMagnetometerReading::calibrated_z
       
   198     \brief the calibrated flux density on the Z axis.
       
   199 
       
   200     Measured as telsas.
       
   201     \sa {QMagnetometerReading Units}
       
   202 */
       
   203 
       
   204 qreal QMagnetometerReading::calibrated_z() const
       
   205 {
       
   206     return d->calibrated_z;
       
   207 }
       
   208 
       
   209 /*!
       
   210     Sets the calibrated flux density on the Z axis to \a calibrated_z.
       
   211 */
       
   212 void QMagnetometerReading::setCalibrated_z(qreal calibrated_z)
       
   213 {
       
   214     d->calibrated_z = calibrated_z;
       
   215 }
       
   216 
       
   217 /*!
       
   218     \property QMagnetometerReading::calibrationLevel
   159     \property QMagnetometerReading::calibrationLevel
   219     \brief the calibration level of the reading.
   160     \brief the accuracy of the reading.
   220 
   161 
   221     The higher the calibration, the more accurate the measurement is.
   162     Measured as a value from 0 to 1 with higher values being better.
   222     \sa {QMagnetometerReading Units}
   163 
   223 */
   164     Note that this only changes when measuring geomagnetic flux density.
   224 
   165     Raw magnetic flux readings will always have a value of 1.
   225 QMagnetometerReading::CalibrationLevel QMagnetometerReading::calibrationLevel() const
   166     \sa {QMagnetometerReading Units}
   226 {
   167 */
   227     return static_cast<QMagnetometerReading::CalibrationLevel>(d->calibrationLevel);
   168 
   228 }
   169 qreal QMagnetometerReading::calibrationLevel() const
   229 
   170 {
   230 /*!
   171     return d->calibrationLevel;
   231     Sets the calibration level of the reading to \a calibrationLevel.
   172 }
   232 */
   173 
   233 void QMagnetometerReading::setCalibrationLevel(QMagnetometerReading::CalibrationLevel calibrationLevel)
   174 /*!
       
   175     Sets the accuracy of the reading to \a calibrationLevel.
       
   176 */
       
   177 void QMagnetometerReading::setCalibrationLevel(qreal calibrationLevel)
   234 {
   178 {
   235     d->calibrationLevel = calibrationLevel;
   179     d->calibrationLevel = calibrationLevel;
   236 }
   180 }
   237 
   181 
   238 // =====================================================================
   182 // =====================================================================
   239 
       
   240 // begin generated code
       
   241 
   183 
   242 /*!
   184 /*!
   243     \class QMagnetometerFilter
   185     \class QMagnetometerFilter
   244     \ingroup sensors_filter
   186     \ingroup sensors_filter
   245 
   187 
   293 
   235 
   294     Returns the reading class for this sensor.
   236     Returns the reading class for this sensor.
   295 
   237 
   296     \sa QSensor::reading()
   238     \sa QSensor::reading()
   297 */
   239 */
   298 // end generated code
   240 
       
   241 /*!
       
   242     \property QMagnetometer::returnGeoValues
       
   243     \brief a value indicating if geomagnetic values should be returned.
       
   244 
       
   245     Set to true to return geomagnetic flux density.
       
   246     Set to false (the default) to return raw magnetic flux density.
       
   247 
       
   248     Note that you must access this property via QObject::property() and QObject::setProperty().
       
   249     The property must be set before calling start().
       
   250 */
   299 
   251 
   300 #include "moc_qmagnetometer.cpp"
   252 #include "moc_qmagnetometer.cpp"
   301 QTM_END_NAMESPACE
   253 QTM_END_NAMESPACE
   302 
   254