AttitudeSensor Class

Description

AttitudeSensor calls the attitude sensor provided by the operating system, and outputs AttitudeSensorResult .

When it is not needed anymore, call close function to close it. It shall not be used after calling close.

It is not recommended to open multiple times simultaneously, which may cause failure on open or cause precision downgrade.

Constructor

C

void easyar_AttitudeSensor__ctor(easyar_AttitudeSensor * * Return)

C++

AttitudeSensor()

Java

public AttitudeSensor()

Kotlin

constructor()

Objective-C

+ (easyar_AttitudeSensor *) create

Swift

public convenience init()

C#

public AttitudeSensor()

isAvailable

Checks if the component is available. It returns true only on Android or iOS with supported hardware. On other operating systems, it is not supported.

C

bool easyar_AttitudeSensor_isAvailable(easyar_AttitudeSensor * This)

C++

bool isAvailable()

Java

public boolean isAvailable()

Kotlin

fun isAvailable(): Boolean

Objective-C

- (bool)isAvailable

Swift

public func isAvailable() -> Bool

C#

public virtual bool isAvailable()

output

Output port.

C

void easyar_AttitudeSensor_output(easyar_AttitudeSensor * This, easyar_AttitudeSensorResultSource * * Return)

C++

std::shared_ptr<AttitudeSensorResultSource> output()

Java

public @Nonnull AttitudeSensorResultSource output()

Kotlin

fun output(): AttitudeSensorResultSource

Objective-C

- (easyar_AttitudeSensorResultSource *)output

Swift

public func output() -> AttitudeSensorResultSource

C#

public virtual AttitudeSensorResultSource output()

open

Opens the device. Sampling period is defined by implementation. If failed, it will return false.

C

bool easyar_AttitudeSensor_open(easyar_AttitudeSensor * This)

C++

bool open()

Java

public boolean open()

Kotlin

fun open(): Boolean

Objective-C

- (bool)open

Swift

public func `open`() -> Bool

C#

public virtual bool open()

openWithSamplingPeriod

Opens the device with a specific sampling period. Sampling period is limited by hardware and may not reach the specified value. If failed, it will return false.

C

bool easyar_AttitudeSensor_openWithSamplingPeriod(easyar_AttitudeSensor * This, int samplingPeriodMilliseconds)

C++

bool openWithSamplingPeriod(int samplingPeriodMilliseconds)

Java

public boolean openWithSamplingPeriod(int samplingPeriodMilliseconds)

Kotlin

fun openWithSamplingPeriod(samplingPeriodMilliseconds: Int): Boolean

Objective-C

- (bool)openWithSamplingPeriod:(int)samplingPeriodMilliseconds

Swift

public func openWithSamplingPeriod(_ samplingPeriodMilliseconds: Int32) -> Bool

C#

public virtual bool openWithSamplingPeriod(int samplingPeriodMilliseconds)

close

Closes. It shall not be used after calling close.

C

void easyar_AttitudeSensor_close(easyar_AttitudeSensor * This)

C++

void close()

Java

public void close()

Kotlin

fun close(): Unit

Objective-C

- (void)close

Swift

public func close() -> Void

C#

public virtual void close()

getCurrentResult

Gets the most recent result. If there is no result, it returns empty.

C

easyar_OptionalOfAttitudeSensorResult easyar_AttitudeSensor_getCurrentResult(easyar_AttitudeSensor * This)

C++

std::optional<AttitudeSensorResult> getCurrentResult()

Java

public @Nullable AttitudeSensorResult getCurrentResult()

Kotlin

fun getCurrentResult(): AttitudeSensorResult?

Objective-C

- (easyar_AttitudeSensorResult *)getCurrentResult

Swift

public func getCurrentResult() -> AttitudeSensorResult?

C#

public virtual Optional<AttitudeSensorResult> getCurrentResult()