![]() |
Home · All Classes · All Functions · | ![]() |
The QSensorBackend class is a sensor implementation. More...
#include <QSensorBackend>
This class is under development and is subject to change.
Inherits QObject.
void | newReadingAvailable () |
virtual void | poll () = 0 |
QSensorReading * | reading () const |
T * | setReading ( T * reading ) |
void | setSupportedUpdatePolicies ( QSensor::UpdatePolicies policies ) |
virtual void | start () = 0 |
virtual void | stop () = 0 |
The QSensorBackend class is a sensor implementation.
Sensors on a device will be represented by sub-classes of QSensorBackend.
Notify the QSensor class that a new reading is available.
Poll the sensor for a reading.
If the backend has lost its reference to the reading it can call this method to get the address.
Note that you will need to down-cast to the appropriate type.
See also setReading().
This function is called to initialize the reading classes used for a sensor.
If your backend has already allocated a reading you should pass the address of this to the function. Otherwise you should pass 0 and the function will return the address of the reading your backend should use when it wants to notify the sensor API of new readings.
Note that this is a template function so it should be called with the appropriate type.
class MyBackend : public QSensorBackend { QAccelerometerReading m_reading; public: MyBackend(QSensor *sensor) : QSensorBackend(sensor) { setReading<QAccelerometerReading>(&m_reading); } ...
Note that this function must be called or you will not be able to send readings to the front end.
If you do not wish to store the address of the reading you may use the reading() method to get it again later.
class MyBackend : public QSensorBackend { public: MyBackend(QSensor *sensor) : QSensorBackend(sensor) { setReading<QAccelerometerReading>(0); } void poll() { qtimestamp timestamp; qreal x, y, z; ... QAccelerometerReading *reading = static_cast<QAccelerometerReading*>(reading()); reading->setTimestamp(timestamp); reading->setX(x); reading->setY(y); reading->setZ(z); } ...
See also reading().
Set the supported policies for this sensor. If this isn't called the sensor will not report any supported policies to the user.
Start reporting values.
Stop reporting values.
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt Mobility Project 1.0.0 |