QMagnetometerReading Class
The QMagnetometerReading class represents one reading from the magnetometer. 更多...
头文件: | #include <QMagnetometerReading> |
qmake: | QT += sensors |
开始支持版本: | Qt 5.1 |
基类: | QSensorReading |
属性
- calibrationLevel : const qreal
- x : const qreal
- y : const qreal
- z : const qreal
- 1 个属性继承自 QSensorReading
- 1 个属性继承自 QObject
公有函数
qreal | calibrationLevel() const |
void | setCalibrationLevel(qreal calibrationLevel) |
void | setX(qreal x) |
void | setY(qreal y) |
void | setZ(qreal z) |
qreal | x() const |
qreal | y() const |
qreal | z() const |
- 4 个公有函数继承自 QSensorReading
- 32 个公有函数继承自 QObject
其他继承的成员
- 1 个公有槽函数继承自 QObject
- 2 个信号继承自 QObject
- 1 个公有变量继承自 QObject
- 10 个静态公有成员继承自 QObject
- 9 个受保护的函数继承自 QObject
- 2 个受保护的变量继承自 QObject
详细描述
The QMagnetometerReading class represents one reading from the magnetometer.
QMagnetometerReading Units
The magnetometer returns magnetic flux density values along 3 axes. The scale of the values is teslas. The axes are arranged as follows.
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.
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 image below shows the difference between geomagnetic (on the left) and raw (on the right) readings for a phone that is being subjected to magnetic interference.
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.
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.
属性
calibrationLevel : const qreal
This property holds the accuracy of the reading.
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.
访问函数:
qreal | calibrationLevel() const |
参见 QMagnetometerReading Units and Calibration.
x : const qreal
This property holds the raw magnetic flux density on the X axis.
Measured as teslas.
访问函数:
qreal | x() const |
参见 QMagnetometerReading Units.
y : const qreal
This property holds the raw magnetic flux density on the Y axis.
Measured as teslas.
访问函数:
qreal | y() const |
参见 QMagnetometerReading Units.
z : const qreal
This property holds the raw magnetic flux density on the Z axis.
Measured as teslas.
访问函数:
qreal | z() const |
成员函数
void QMagnetometerReading::setCalibrationLevel(qreal calibrationLevel)
Sets the accuracy of the reading to calibrationLevel.
参见 calibrationLevel().
void QMagnetometerReading::setX(qreal x)
Sets the raw magnetic flux density on the X axis to x.
参见 x().
void QMagnetometerReading::setY(qreal y)
Sets the raw magnetic flux density on the Y axis to y.
参见 y().
void QMagnetometerReading::setZ(qreal z)
Sets the raw magnetic flux density on the Z axis to z.
参见 z().