sensorGet()
Get reading data from a sensor.
Synopsis
int sensorGet(int sensor, string valueName, <any> &value);
Parameters
Parameter | Description |
---|---|
sensor | Index of the sensor. |
valueName | Name of the value that will be retrieved, it depends on the respective sensor. For possible Values, see the table below. All sensors know the options "description" (string) and "busy" (bool). |
value | Anytype vector, in which the reading is saved. |
Sensor Type (valueName) | Data type | Description |
All sensors | ||
description | string | Description of the sensor. |
busy | bool | Indicator if a sensor is free or already in use. |
Accelerometer | ||
x, y, z | float | Contains the acceleration on the X, Y or Z axis. |
Altimeter | ||
altitude | float | Altitude in meters relative to mean sea level. |
AmbientLightSensor | ||
lightLevel | string |
Contains one of the following:
|
AmbientTemperatureSensor | ||
temperature | float | Contains the ambient temperature in degree Celsius. |
Compass | ||
azimuth | float | Contains the azimuth of the device. The value is measured in degrees from magnetic north in a clockwise direction based on the top of the device. |
calibrationLevel | float | Contains the calibration level of the reading. Measured as a value from 0 to 1 with higher values being better. |
Gyroscope | ||
x, y, z | float | Contains the current angular velocity measured in degrees per second. This defines the movement of the device around the X, Y and Z axis. |
HolsterSensor | ||
holstered | bool | Indicates whether the device is holstered. |
LightSensor | ||
fieldOfView | float | The angle that represents the field of view of the sensor. Not all light sensors support retrieving their field of view. For sensors that do not support this property, the value will be 0. |
lux | float | Contains the light level in lux. |
Magnetometer | ||
x, y, z | float | Contains the raw magnetic flux density on the axis. |
calibrationLevel | float |
Contains 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. |
OrientationSensor | ||
orientation | string |
The orientation fo the device:
The orientation sensor reports the orientation of the device, not the UI. The orientation of the device will not change just because the UI is rotated. This means that the sensor cannot be used to detect if a device is in portrait or landscape mode. |
PressureSensor | ||
pressure | float | Contains the measured atmospheric pressure in Pascal. |
temperature | float | Contains the pressure sensor's temperature in degree Celsius. The temperature is usually different thatn the rempterature reported from AmbientTemperatureSensor. |
ProximitySensor | ||
close | bool | Indicates if something is close. |
RotationSensor | ||
x, y, z | float | Three angles that indicate the orientation of the device in three-dimensional space. Refer to the Qt Help for further information. |
TapSensor | ||
isDoubleTap | bool | Indicates whether the display was single or double tapped. |
tapDirection | string |
Contains a combination of the following flags (separated by "|"):
|
TiltSensor | ||
xRotation, yRotation | float | Contains the angle of tilt in degrees of the device along the X and Y plane. |
Return Value
If no reading is available yet, the function returns -1.
Description
Depending on the given sensor type and available measurements, this function retrieves the sensor data and saves it for further use.
Assignment
Mobile UI control functions
Availability
UI
See also
sensorTypes(), sensorOpen(), sensorStart()