CompassReading CompassReading CompassReading CompassReading Class

Represents a compass reading.

Syntax

Declaration

public sealed class CompassReadingpublic sealed class CompassReadingPublic NotInheritable Class CompassReadingpublic sealed class CompassReading

Remarks

This object is accessed when you invoke the GetCurrentReading() method; and, it is accessed when you retrieve the Reading property of the CompassReadingChangedEventArgs object in the event callback method.

Properties summary

Gets the compass's heading accuracy.

Gets the heading in degrees relative to magnetic-north.

Gets the heading in degrees relative to geographic true-north.

Gets the time at which the sensor reported the reading.

Properties

  • HeadingAccuracy
    HeadingAccuracy
    HeadingAccuracy
    HeadingAccuracy

    Gets the compass's heading accuracy.

    public MagnetometerAccuracy HeadingAccuracy { get; }public MagnetometerAccuracy HeadingAccuracy { get; }Public ReadOnly Property HeadingAccuracy As MagnetometerAccuracypublic MagnetometerAccuracy HeadingAccuracy { get; }

    Property Value

  • HeadingMagneticNorth
    HeadingMagneticNorth
    HeadingMagneticNorth
    HeadingMagneticNorth

    Gets the heading in degrees relative to magnetic-north.

    public double HeadingMagneticNorth { get; }public double HeadingMagneticNorth { get; }Public ReadOnly Property HeadingMagneticNorth As doublepublic double HeadingMagneticNorth { get; }

    Property Value

    • double
      double
      double
      double

      The magnetic-north heading.

  • HeadingTrueNorth
    HeadingTrueNorth
    HeadingTrueNorth
    HeadingTrueNorth

    Gets the heading in degrees relative to geographic true-north.

    public IReference<double> HeadingTrueNorth { get; }public IReference<double> HeadingTrueNorth { get; }Public ReadOnly Property HeadingTrueNorth As IReference<double>public IReference<double> HeadingTrueNorth { get; }

    Property Value

    • The true-north heading.

    Remarks

    Before retrieving this property, your code should first check to verify that the value is not null. (If the value is null and you attempt to retrieve it, Windows will generate an exception.)

    In order to retrieve the declination, your app needs to have access to the device's current location. If the location is not available, the declination defaults to 0 degrees. In this scenario, HeadingTrueNorth equals HeadingMagneticNorth.

  • Timestamp
    Timestamp
    Timestamp
    Timestamp

    Gets the time at which the sensor reported the reading.

    public DateTime Timestamp { get; }public DateTimeOffset Timestamp { get; }Public ReadOnly Property Timestamp As DateTimeOffsetpublic DateTime Timestamp { get; }

    Property Value

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Devices.Sensors.dll