Class Magnetometer

Definition

Namespace:
Tizen.Sensor
Assembly:
Tizen.Sensor.dll

The Magnetometer class is used for registering callbacks for the magnetometer and getting the magnetometer data.

C#
Copy
public sealed class Magnetometer : Sensor, IDisposable
Inheritance
object
Magnetometer
Implements
System.IDisposable

Constructors

View Source

Magnetometer(uint)

Initialize a new instance of the Magnetometer class.

Declaration
C#
Copy
public Magnetometer(uint index = 0)
Parameters
Type Name Description
uint index

Index refers to a particular magnetometer in case of multiple sensors. Default value is 0.

Exceptions
Type Condition
System.ArgumentException

Thrown when an invalid argument is used.

System.NotSupportedException

Thrown when the sensor is not supported.

System.InvalidOperationException

Thrown when the operation is invalid for the current state.

Properties

View Source

Count

Return the number of magnetometers available on the system.

Declaration
C#
Copy
public static int Count { get; }
Property Value
Type Description
int

The count of magnetometers.

View Source

IsSupported

Return true or false based on whether magnetometer is supported by the system.

Declaration
C#
Copy
public static bool IsSupported { get; }
Property Value
Type Description
bool

true if supported; otherwise false.

View Source

X

Get the X component value of the magnetometer as float type.

Declaration
C#
Copy
public float X { get; }
Property Value
Type Description
float

X

View Source

Y

Get the Y component value of the magnetometer as float type.

Declaration
C#
Copy
public float Y { get; }
Property Value
Type Description
float

Y

View Source

Z

Get the Z component value of the magnetometer as float type.

Declaration
C#
Copy
public float Z { get; }
Property Value
Type Description
float

Z

Events

View Source

AccuracyChanged

An event handler for accuracy changed events. If an event is added, a new accuracy change callback is registered for this sensor. If an event is removed, accuracy change callback is unregistered for this sensor.

Declaration
C#
Copy
public event EventHandler<SensorAccuracyChangedEventArgs> AccuracyChanged
Event Type
Type Description
System.EventHandler<TEventArgs><SensorAccuracyChangedEventArgs>
View Source

DataUpdated

An event handler for storing the callback functions for the event corresponding to the change in the magnetometer data.

Declaration
C#
Copy
public event EventHandler<MagnetometerDataUpdatedEventArgs> DataUpdated
Event Type
Type Description
System.EventHandler<TEventArgs><MagnetometerDataUpdatedEventArgs>

Implements

System.IDisposable