Table of Contents

Class Gyroscope

命名空间
easyar

Gyroscope调用了系统提供的陀螺仪,输出 GyroscopeResult 。 当不再需要该设备时,可以调用close对其进行关闭。close之后不应继续使用。 不建议同时打开多次,可能会无法使用或精度下降。

Gyroscope

构造函数

Gyroscope

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

方法

isAvailable

检查是否可用。只在Android或iOS上且硬件支持时返回true。其他操作系统暂不支持。

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()

返回

类型 描述
Boolean

output

输出端口。

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()

返回

类型 描述
GyroscopeResultSource

open

打开设备。采样周期由内部实现所确定。如果打开失败,返回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()

返回

类型 描述
Boolean

openWithSamplingPeriod

以特定采样周期打开设备。采样周期会受到硬件限制而可能无法达到指定值。如果打开失败,返回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)

参数

名称 类型 描述
samplingPeriodMilliseconds Int32

返回

类型 描述
Boolean

close

关闭设备。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()

返回

类型 描述
Void

getCurrentResult

获取当前的最新结果。如果结果尚未获取到,返回空。

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()

返回

类型 描述
Optional<GyroscopeResult>