QMagnetometerReading

#include <QtSensors/QMagnetometerReading>

QtSensors

Since:

1.0

The QMagnetometerReading class represents one reading from the magnetometer.

Inheritance

QSensorReading
QMagnetometerReading

Properties Index

qrealx [read-only]
qrealy [read-only]
qrealz [read-only]
qrealcalibrationLevel [read-only]
QtMobility::qtimestamptimestamp [read-only]Inherited

Public Functions Index

QMagnetometerReading (QObject *parent=0)
virtual ~QMagnetometerReading ()
virtual voidcopyValuesFrom (QSensorReading *other)
qrealx () const
voidsetX (qreal x)
qrealy () const
voidsetY (qreal y)
qrealz () const
voidsetZ (qreal z)
qrealcalibrationLevel () const
voidsetCalibrationLevel (qreal calibrationLevel)
voidsetTimestamp (qtimestamp timestamp)Inherited
qtimestamptimestamp () const Inherited
QVariantvalue (int index) const Inherited
intvalueCount () const Inherited

Protected Functions Index

Only has inherited protected functions

QScopedPointer< QSensorReadingPrivate > *d_ptr ()Inherited
QSensorReading (QObject *parent, QSensorReadingPrivate *d)Inherited

Properties

qreal x[read-only]

the raw magnetic flux density on the X axis.

Measured as telsas.
See:

{QMagnetometerReading Units}

Since:

1.0

qreal y[read-only]

the raw magnetic flux density on the Y axis.

Measured as telsas.
See:

{QMagnetometerReading Units}

Since:

1.0

qreal z[read-only]

the raw magnetic flux density on the Z axis.

Measured as telsas.
See:

{QMagnetometerReading Units}

Since:

1.0

qreal calibrationLevel[read-only]

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.
See:

{QMagnetometerReading Units}, {http://wiki.forum.nokia.com/index.php/CS001671_-_Calibrating_the_magnetometer_sensor}{CS001671 - Calibrating the magnetometer sensor}

Since:

1.0

QtMobility::qtimestamp timestampInherited[read-only]

the timestamp of the reading.

Returns the timestamp of the reading.

Since:

1.0

,

1.0

Public Functions

QMagnetometerReading (

virtual~QMagnetometerReading ()

Destructor.

virtual void copyValuesFrom (

qreal x ()

void setX (
  • qrealx)

Sets the raw magnetic flux density on the X axis to x.

Since:

1.0

qreal y ()

void setY (
  • qrealy)

Sets the raw magnetic flux density on the Y axis to y.

Since:

1.0

qreal z ()

void setZ (
  • qrealz)

Sets the raw magnetic flux density on the Z axis to z.

Since:

1.0

qreal calibrationLevel ()

void setCalibrationLevel (
  • qrealcalibrationLevel)

Sets the accuracy of the reading to calibrationLevel.

Since:

1.0

void setTimestamp (Inherited

Sets the timestamp of the reading.

Since:

1.0

qtimestamp timestamp ()Inherited

QVariant value (
  • intindex)
Inherited

Returns the value of the property at index.

Note that this function is slower than calling the data function directly.

Here is an example of getting a property via the different mechanisms available.

Accessing directly provides the best performance but requires compile-time knowledge of the data you are accessing.

QAccelerometerReading *reading = ...;
qreal x = reading->x();

You can also access a property by name. To do this you must call QObject::property().

qreal x = reading->property("x").value<qreal>();

Finally, you can access values via numeric index.

qreal x = reading->value(0).value<qreal>();

Note that value() can only access properties declared with Q_PROPERTY() in sub-classes of QSensorReading.

See:

valueCount(), QObject::property()

Since:

1.0

int valueCount ()Inherited

Returns the number of extra properties that the reading has.

Note that this does not count properties declared in QSensorReading.

As an example, this returns 3 for QAccelerometerReading because there are 3 properties defined in that class.
Since:

1.0

Protected Functions

(Only has inherited protected functions)

QScopedPointer< QSensorReadingPrivate > * d_ptr ()Inherited

QSensorReading (
  • QObject *parent,
  • QSensorReadingPrivate *d )
Inherited