Dela via


OrientationSensor.GetDefault Method

Definition

Overloads

GetDefault()

Returns the default orientation sensor for absolute readings.

GetDefault(SensorReadingType)

Returns the default orientation sensor, taking into account accuracy preferences.

GetDefault(SensorReadingType, SensorOptimizationGoal)

Returns the default orientation sensor, taking into account power and accuracy preferences.

GetDefault()

Returns the default orientation sensor for absolute readings.

public:
 static OrientationSensor ^ GetDefault();
 static OrientationSensor GetDefault();
/// [Windows.Foundation.Metadata.Overload("GetDefault")]
 static OrientationSensor GetDefault();
public static OrientationSensor GetDefault();
[Windows.Foundation.Metadata.Overload("GetDefault")]
public static OrientationSensor GetDefault();
function getDefault()
Public Shared Function GetDefault () As OrientationSensor

Returns

The default orientation sensor or null if no orientation sensors are found.

Attributes

Examples

The following example demonstrates how a UWP app built with XAML and C# used this method to establish a connection to the orientation sensor.

_sensor = OrientationSensor.GetDefault();

Remarks

This method returns the same result as GetDefault(SensorReadingType.Absolute)

This method only returns values for hardware that has been integrated into the computer by the manufacturer. (The orientation-sensor readings are derived from multiple sensors.) A null value will be returned if the specified sensor is not available in the system.

When a system is in Connected Standby, a call to the GetDefault method will return immediately with a null result.

See also

Applies to

GetDefault(SensorReadingType)

Returns the default orientation sensor, taking into account accuracy preferences.

public:
 static OrientationSensor ^ GetDefault(SensorReadingType sensorReadingtype);
/// [Windows.Foundation.Metadata.Overload("GetDefaultWithSensorReadingType")]
 static OrientationSensor GetDefault(SensorReadingType const& sensorReadingtype);
[Windows.Foundation.Metadata.Overload("GetDefaultWithSensorReadingType")]
public static OrientationSensor GetDefault(SensorReadingType sensorReadingtype);
function getDefault(sensorReadingtype)
Public Shared Function GetDefault (sensorReadingtype As SensorReadingType) As OrientationSensor

Parameters

sensorReadingtype
SensorReadingType

The type of sensor to retrieve. An Absolute SensorReadingType returns an OrientationSensor using an accelerometer, a gyromoter, and magnetometer to determine the orientation with respect to magnetic North. A Relative SensorReadingType returns an OrientationSensor using an accelerometer and gyrometer only (no magnetometer), measuring relative to where the sensor was first instantiated.”

Returns

The default orientation sensor or null if no orientation sensors are found.

Attributes

Windows requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

Remarks

This method only returns values for hardware that has been integrated into the computer by the manufacturer. (The orientation-sensor readings are derived from multiple sensors.) A null value will be returned if the specified sensor is not available in the system.

When a system is in Connected Standby, a call to the GetDefault method will return immediately with a null result.

See also

Applies to

GetDefault(SensorReadingType, SensorOptimizationGoal)

Returns the default orientation sensor, taking into account power and accuracy preferences.

public:
 static OrientationSensor ^ GetDefault(SensorReadingType sensorReadingType, SensorOptimizationGoal optimizationGoal);
/// [Windows.Foundation.Metadata.Overload("GetDefaultWithSensorReadingTypeAndSensorOptimizationGoal")]
 static OrientationSensor GetDefault(SensorReadingType const& sensorReadingType, SensorOptimizationGoal const& optimizationGoal);
[Windows.Foundation.Metadata.Overload("GetDefaultWithSensorReadingTypeAndSensorOptimizationGoal")]
public static OrientationSensor GetDefault(SensorReadingType sensorReadingType, SensorOptimizationGoal optimizationGoal);
function getDefault(sensorReadingType, optimizationGoal)
Public Shared Function GetDefault (sensorReadingType As SensorReadingType, optimizationGoal As SensorOptimizationGoal) As OrientationSensor

Parameters

sensorReadingType
SensorReadingType

The type of sensor to retrieve. An Absolute SensorReadingType returns an OrientationSensor using an accelerometer, a gyromoter, and magnetometer to determine the orientation with respect to magnetic North. A Relative SensorReadingType returns an OrientationSensor using an accelerometer and gyrometer only (no magnetometer), measuring relative to where the sensor was first instantiated.

optimizationGoal
SensorOptimizationGoal

Indicates the preferences of optimization for the sensor. This field is only used if an Absolute SensorReadingType is specified. An optimizationGoal of Precision will return an OrientationSensor using an accelereometer, a gyrometer, and a magnetometer to determine orientation with respect to magnetic North. This has the potential to use a lot of power due to it’s use of a gyrometer. In contrast, specifying an optimizationGoal of PowerEfficiency will return an OrientationSensor using an accelerometer and magnetometer only (no gyrometer) to save power at the a cost of some accuracy (readings will still be relatively accurate in most circumstances).

Returns

The default orientation sensor or null if no orientation sensors are found.

Attributes

Windows requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

Remarks

This method only returns values for hardware that has been integrated into the computer by the manufacturer. (The orientation-sensor readings are derived from multiple sensors.) A null value will be returned if the specified sensor is not available in the system.

When a system is in Connected Standby, a call to the GetDefault method will return immediately with a null result.

The optimizationGoal parameter is dependent on the hardware available. It will attempt to choose the best sensor available based on your provided preference for optimization. It only has an effect if the sensorReadingType is Absolute.

See also

Applies to