CtrlMobile New functions to be able to get data from built in sensors or GPS receiver in a device (as of Qt 5.4.1 sensor functions only work on Android and iOS) http://doc.qt.io/qt-5/qtsensors-index.html ############### dyn_string sensorTypes() .. delivers a list of detected sensors on this device ############### int sensorOpen(string type) ... opens the given sensor (one of sensorTypes()): "Accelerometer" "Altimeter" "AmbientLightSensor" "AmbientTemperatureSensor" "Compass" "Gyroscope" "HolsterSensor" "IRProximitySensor" "LightSensor" "Magnetometer" "OrientationSensor" "PressureSensor" "ProximitySensor" "RotationSensor" "TapSensor" "TiltSensor" returns an id (>= 0) you need to use later on when reading or closing the sensor or -1 on error ############### int sensorClose(int sensor) ... closes a previously opened sensor return 0 on success or -1 on error ############### int sensorStart(int sensor) Start retrieving values from the sensor. The sensor may fail to start for several reasons. If the sensor is currently busy (used by another application), it can not be started. In this the return value is 1 If the start failed for some other reason, the return value is 2 If it could be started, the return value is 0 If an illegal sensor id is given, it returns -1 ############### int sensorStop(int sensor) Stop retrieving values from the sensor. This releases the sensor so that other processes can use it. The return value is 0 If an illegal sensor id is given, it returns -1 ############### int sensorGet(int sensor, string valueName, &value) Get reading data from a sensor. valueName is different per sensor. value will contain the reading All sensors know: "description" (string) "busy" (bool) If no reading is available yet, the function returns 1 Also note that readings are not immediately available after start() is called. Type "Accelerometer" knows: x, y, z (float) Note: for details please check Qt doc on QAccelerometerReading -------------- Type "Altimeter" knows: (see QAltimeterReading) altitude (float) The altitude is reported in meters relative to mean sea level. -------------- "AmbientLightSensor" knows: (see QAmbientLightReading) lightLevel (string) returns one of: "Undefined" The light level is unknown. "Dark" It is dark. "Twilight" It is moderately dark. "Light" It is light (eg. internal lights). "Bright" It is bright (eg. shade). "Sunny" It is very bright (eg. direct sunlight). -------------- "AmbientTemperatureSensor" knows: (see QAmbientTemperatureReading) temperature (float) This property holds the ambient temperature. Measured in degree Celsius. -------------- "Compass" knows: (see QCompassReading) azimuth (float) This property holds the azimuth of the device. Measured in degrees from magnetic north in a clockwise direction based on the top of the device, calibrationLevel (float) This property holds the calibration level of the reading. Measured as a value from 0 to 1 with higher values being better. -------------- "Gyroscope" knows: (see QGyroscopeReading) x, y, z (float) The reading contains 3 values, measured in degrees per second that define the movement of the device around the x, y and z axes. The values represent the current angular velocity rather than a fixed rotation. -------------- "QHolsterSensor" knows: (see QHolsterReading) holstered (bool) indicating whether the device is holstered. -------------- "IRProximitySensor" knows: (see QIRProximityReading) reflectance (float) The reflectance is a decimal fraction (from 0 to 1) indicating how much of the transmitted infra-red light was returned. -------------- "LightSensor" knows: (see QLightSensorQt, QLightReading) fieldOfView (float) This is an angle that represents the field of view of the sensor. Not all light sensor support retrieving their field of view. For sensors that don't support this property, the value will be 0. lux (float) This property holds the light level. Measured as lux. -------------- "Magnetometer" knows: (see QMagnetometerReading) x, y, z (float) This property holds the raw magnetic flux density on the axis. Measured as teslas. calibrationLevel (float) 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. -------------- "OrientationSensor" knows: (see QOrientationReading images!) orientation (string) "Undefined" The orientation is unknown. "TopUp" The Top edge of the device is pointing up. "TopDown" The Top edge of the device is pointing down. "LeftUp" The Left edge of the device is pointing up. "RightUp" The Right edge of the device is pointing up. "FaceUp" The Face of the device is pointing up. "FaceDown" The Face of the device is pointing down. It should be noted that the orientation sensor reports the orientation of the device and not the UI. The orientation of the device will not change just because the UI is rotated. This means this sensor cannot be used to detect if a device is in portrait or landscape mode. -------------- "PressureSensor" knows: (see QPressureReading) pressure (float) This property holds the measured atmospheric pressure. Returned as Pascals. temperature (float) This property holds the pressure sensor's temperature. The temperature is returned in degree Celsius. This property, if supported, provides the pressure sensor die temperature. Note that this temperature may be (and usually is) different than the temperature reported from AmbientTemperatureSensor. -------------- "ProximitySensor" knows: (see QProximityReading) close (bool) This property holds a value indicating if something is close. -------------- "RotationSensor" knows: (see QRotationReading) x, y, z (float) @Doku: please see detailed description and images in Qt doc -------------- "TapSensor" knows: (see QTapReading) isDoubleTap (bool) This property holds a value indicating if there was a single or double tap. tapDirection (string) The string holds a combination of the following flags ('|' separated): "Undefined This value means that the direction is unknown. "X" This flag is set if the tap was along the X axis. "Y" This flag is set if the tap was along the Y axis. "Z" This flag is set if the tap was along the Z axis. "X_Pos" This flag is set if the tap was towards the positive X direction. "Y_Pos" This flag is set if the tap was towards the positive Y direction. "Z_Pos" This flag is set if the tap was towards the positive Z direction. "X_Neg" This flag is set if the tap was towards the negative X direction. "Y_Neg" This flag is set if the tap was towards the negative Y direction. "Z_Neg" This flag is set if the tap was towards the negative Z direction. "X_Both" Equivalent to X_Pos|X_Neg. Returned by devices that cannot detect the direction of a tap. "Y_Both" Equivalent to Y_Pos|Y_Neg. Returned by devices that cannot detect the direction of a tap. "Z_Both" Equivalent to Z_Pos|Z_Neg. Returned by devices that cannot detect the direction of a tap. -------------- "TiltSensor" knows: (see QTiltReading) The tilt sensor reports the angle of tilt in degrees of the device along the X and Y plane. xRotation, yRotation (float) This property holds this property holds the amount of tilt on the axis. ############### int sensorSet(int sensor, string valueName, value) set some property of the sensor valueName can be one of: alwaysOn (bool) This property holds a value to indicate if the sensor should remain running when the screen is off. Some platforms have a policy of suspending sensors when the screen turns off. Setting this property to true will ensure the sensor continues to run. ------------- When the sensor is a "Magnetometer", you can set: returnGeoValues (bool) This property holds a value indicating if geomagnetic values should be returned. Set to true to return geomagnetic flux density. Set to false (the default) to return raw magnetic flux density. The property must be set before calling start(). -------------- When the sensor is a "TiltSensor", you can set: calibrate (void) Calibrates the tilt sensor. Uses the current tilt angles as 0. ############### ############### ############### http://doc.qt.io/qt-5/qtpositioning-index.html Currently available on Android, iOS, Linux Positioning includes all the functionality necessary to find and work with geographic coordinates. It can use a variety of external sources of information, including GPS. This provides us with a coordinate and altitude for the device with additional features such as speed and direction. This provides the fundamental location information used in the API. ############### dyn_string geoSources() Returns a list of available source plugins. This includes any default backend plugin for the current platform. ############### int geoOpen(string source = "") If given an empty string or no argument, it opens a position source that reads from the system's default sources of location data, or the plugin with the highest available priority. If a source name is given, it opens this one (one of geoSources()). An opened source will start to request updates. Returns 0 when a source could be opened, else -1 Note that only one source can be open at a given time. ############### int geoClose() Closes the opened source. Always returns 0, even if the source is not open ############### string geoSourceName() Returns the name of the currently open geo source or an empty string if there is none open The name is one of the entries of geoSources() ############### mapping geoPosition() If a source is currently open and a last known position is available, the mapping contains information with the following string keys: time (time) Returns the date and time at which this position was reported. latitude (float) Returns the latitude, in decimal degrees. A positive latitude indicates the Northern Hemisphere, and a negative latitude indicates the Southern Hemisphere. longitude (float) Returns the longitude, in decimal degrees. A positive longitude indicates the Eastern Hemisphere, and a negative longitude indicates the Western Hemisphere. ----- The following keys are optional, depending on the device's capabilities: altitude (float) Returns the altitude (meters above sea level). direction (float) The bearing measured in degrees clockwise from true north to the direction of travel. groundSpeed (float) The ground speed, in meters/sec. verticalSpeed (float) The vertical speed, in meters/sec. magneticVariation (float) The angle between the horizontal component of the magnetic field and true north, in degrees. Also known as magnetic declination. A positive value indicates a clockwise direction from true north and a negative value indicates a counter-clockwise direction. horizontalAccuracy (float) The accuracy of the provided latitude-longitude value, in meters. verticalAccuracy (float) The accuracy of the provided altitude value, in meters. ----- If an error occured in the last reading, the key "error" exists and the mapping contains one of the strings: AccessError The connection setup to the remote positioning backend failed because the application lacked the required privileges. ClosedError The remote positioning backend closed the connection, which happens for example in case the user is switching location services to off. As soon as the location service is re-enabled regular updates will resume. NoError No error has occurred. UnknownSourceError An unidentified error occurred. ###############