Table of Contents

Class Gyroscope

Namespace
easyar

Gyroscope calls the system-provided gyroscope and outputs GyroscopeResult. When the device is no longer needed, call close to close it. It should not be used after close. Opening it multiple times at the same time is not recommended, as it may become unavailable or lose accuracy.

Gyroscope

Constructors

Gyroscope

void easyar_Gyroscope__ctor(easyar_Gyroscope * * Return)
Gyroscope()
public Gyroscope()
constructor()
+ (easyar_Gyroscope *) create
public convenience init()
public Gyroscope()

Methods

isAvailable

Checks whether it is available. Returns true only on Android or iOS when the hardware supports it. Other operating systems are not supported yet.

bool easyar_Gyroscope_isAvailable(easyar_Gyroscope * This)
bool isAvailable()
public boolean isAvailable()
fun isAvailable(): Boolean
- (bool)isAvailable
public func isAvailable() -> Bool
public virtual bool isAvailable()

Returns

Type Description
Boolean

output

Output port.

void easyar_Gyroscope_output(easyar_Gyroscope * This, easyar_GyroscopeResultSource * * Return)
std::shared_ptr<GyroscopeResultSource> output()
public @Nonnull GyroscopeResultSource output()
fun output(): GyroscopeResultSource
- (easyar_GyroscopeResultSource *)output
public func output() -> GyroscopeResultSource
public virtual GyroscopeResultSource output()

Returns

Type Description
GyroscopeResultSource

open

Opens the device. The sampling period is determined by the internal implementation. If opening fails, returns false.

bool easyar_Gyroscope_open(easyar_Gyroscope * This)
bool open()
public boolean open()
fun open(): Boolean
- (bool)open
public func `open`() -> Bool
public virtual bool open()

Returns

Type Description
Boolean

openWithSamplingPeriod

Opens the device with a specific sampling period. The sampling period may be limited by hardware and may not reach the specified value. If opening fails, returns false.

bool easyar_Gyroscope_openWithSamplingPeriod(easyar_Gyroscope * This, int samplingPeriodMilliseconds)
bool openWithSamplingPeriod(int samplingPeriodMilliseconds)
public boolean openWithSamplingPeriod(int samplingPeriodMilliseconds)
fun openWithSamplingPeriod(samplingPeriodMilliseconds: Int): Boolean
- (bool)openWithSamplingPeriod:(int)samplingPeriodMilliseconds
public func openWithSamplingPeriod(_ samplingPeriodMilliseconds: Int32) -> Bool
public virtual bool openWithSamplingPeriod(int samplingPeriodMilliseconds)

Parameters

Name Type Description
samplingPeriodMilliseconds Int32

Returns

Type Description
Boolean

close

Closes the device. It should not be used after close.

void easyar_Gyroscope_close(easyar_Gyroscope * This)
void close()
public void close()
fun close(): Unit
- (void)close
public func close() -> Void
public virtual void close()

Returns

Type Description
Void

getCurrentResult

Gets the current latest result. If no result has been obtained yet, returns empty.

easyar_OptionalOfGyroscopeResult easyar_Gyroscope_getCurrentResult(easyar_Gyroscope * This)
std::optional<GyroscopeResult> getCurrentResult()
public @Nullable GyroscopeResult getCurrentResult()
fun getCurrentResult(): GyroscopeResult?
- (easyar_GyroscopeResult *)getCurrentResult
public func getCurrentResult() -> GyroscopeResult?
public virtual Optional<GyroscopeResult> getCurrentResult()

Returns

Type Description
Optional<GyroscopeResult>