![]() |
Home · All Classes · All Functions · | ![]() |
Warning: This API should be considered in a technology preview state. It is under development and subject to change.
The Sensors API provides access to hardware sensors.
This covers both high-level sensors such as screen orientation (portrait, landscape) and low-level, real-time sensors such as accelerometer data.
There are 2 ways to use a sensor. If you just want the default sensor for a particular type, instantiate that class.
// On the heap (deleted when this object is deleted) QAccelerationSensor *sensor = new QAccelerationSensor(this); // On the stack (eg. to check the orientation on startup) QOrientationSensor orient_sensor;
The QSensorFactory class can also create a sensor for you as well as listing the available sensors on the device.
The API supports sensors that poll for their data and sensors that push data to the app as it arrives. Each sensor will support certain update policies that determine how your application can receive the data from the sensor.
The client API is designed around sub-classes of QSensor. These classes are instantiated in the client application and connect to a QSensorBackend instance that either talks directly to hardware or via a system API. Typically the application will use sub-classes of QSensor from the QtSensors API but third party sub-classes may be used as well.
QSensor instances talk to a backend object. Backends are usually supplied with the QtSensors library for a specific device although third party backends may be used as well. A backend may talk directly to hardware or it may talk to a system service. In some instances it may even talk to another backend or to another device. An example of this is the rotation sensor backend for devices that lack a rotation sensor but have a linear acceleration sensor. This backend talks directly to an acceleration sensor backend.
If you want to use the sensors on a device, these are the classes to use.
QAccelerometerReading | Reports on linear acceleration along the X, Y and Z axes |
---|---|
QAmbientLightReading | Represents one reading from the ambient light sensor |
QCompassReading | Represents one reading from a compass |
QMagnetometerReading | Represents one reading from the magnetometer |
QOrientationReading | Represents one reading from the orientation sensor |
QProximityReading | Represents one reading from the proximity sensor |
QRotationReading | Represents one reading from the rotation sensor |
QSensor | Represents a single hardware sensor |
QSensorFactory | Returns the sensors on a device |
QSensorFilter | Efficient callback facility for asynchronous notifications of sensor changes |
QSensorReading | Holds the readings from the sensor |
QTapReading | Represents one reading from the tap sensor |
These classes provide convenience wrappers that reduce the need for casting.
QAccelerometer | Convenience wrapper around QSensor |
---|---|
QAccelerometerFilter | Convenience wrapper around QSensorFilter |
QAmbientLightFilter | Convenience wrapper around QSensorFilter |
QAmbientLightSensor | Convenience wrapper around QSensor |
QCompass | Convenience wrapper around QSensor |
QCompassFilter | Convenience wrapper around QSensorFilter |
QMagnetometer | Convenience wrapper around QSensor |
QMagnetometerFilter | Convenience wrapper around QSensorFilter |
QOrientationFilter | Convenience wrapper around QSensorFilter |
QOrientationSensor | Convenience wrapper around QSensor |
QProximityFilter | Convenience wrapper around QSensorFilter |
QProximitySensor | Convenience wrapper around QSensor |
QRotationFilter | Convenience wrapper around QSensorFilter |
QRotationSensor | Convenience wrapper around QSensor |
QTapFilter | Convenience wrapper around QSensorFilter |
QTapSensor | Convenience wrapper around QSensor |
If you are making sensors available through the Sensors API, these are the classes to use.
QSensorBackend | Sensor implementation |
---|---|
QSensorBackendFactory | Instantiates instances of QSensorBackend |
QSensorManager | Returns the sensors on a device |
QSensorPluginInterface | The pure virtual interface to sensor plugins |
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) | Trademarks | Qt Mobility Project 1.0.0 |