Loading...
Searching...
No Matches
Sensor.h File Reference

Go to the source code of this file.

Enumerations

enum  sfSensorType {
  sfSensorAccelerometer , sfSensorGyroscope , sfSensorMagnetometer , sfSensorGravity ,
  sfSensorUserAcceleration , sfSensorOrientation , sfSensorCount
}
 Sensor Types. More...
 

Functions

sfBool sfSensor_isAvailable (sfSensorType sensor)
 Check if a sensor is available on the underlying platform.
 
void sfSensor_setEnabled (sfSensorType sensor, sfBool enabled)
 Enable or disable a sensor.
 
sfVector3f sfSensor_getValue (sfSensorType sensor)
 Get the current sensor value.
 

Enumeration Type Documentation

◆ sfSensorType

Sensor Types.

Enumerator
sfSensorAccelerometer 

Measures the raw acceleration (m/s^2)

sfSensorGyroscope 

Measures the raw rotation rates (degrees/s)

sfSensorMagnetometer 

Measures the ambient magnetic field (micro-teslas)

sfSensorGravity 

Measures the direction and intensity of gravity, independent of device acceleration (m/s^2)

sfSensorUserAcceleration 

Measures the direction and intensity of device acceleration, independent of the gravity (m/s^2)

sfSensorOrientation 

Measures the absolute 3D orientation (degrees)

sfSensorCount 

Keep last – the total number of sensor types.

Definition at line 40 of file Sensor.h.

Function Documentation

◆ sfSensor_getValue()

sfVector3f sfSensor_getValue ( sfSensorType  sensor)

Get the current sensor value.

Parameters
sensorSensor to read
Returns
The current sensor value

◆ sfSensor_isAvailable()

sfBool sfSensor_isAvailable ( sfSensorType  sensor)

Check if a sensor is available on the underlying platform.

Parameters
sensorSensor to check
Returns
sfTrue if the sensor is available, sfFalse otherwise

◆ sfSensor_setEnabled()

void sfSensor_setEnabled ( sfSensorType  sensor,
sfBool  enabled 
)

Enable or disable a sensor.

All sensors are disabled by default, to avoid consuming too much battery power. Once a sensor is enabled, it starts sending events of the corresponding type.

This function does nothing if the sensor is unavailable.

Parameters
sensorSensor to enable
enabledsfTrue to enable, sfFalse to disable