Class Magnetometer
- Namespace
- easyar
Magnetometer calls the system-provided magnetometer and outputs MagnetometerResult. When the device is no longer needed, you can call close to shut it down. After close, it should not be used again. It is not recommended to open it multiple times at the same time, as it may become unusable or the accuracy may decrease.
Constructors
Magnetometer
void easyar_Magnetometer__ctor(easyar_Magnetometer * * Return)
Magnetometer()
public Magnetometer()
constructor()
+ (easyar_Magnetometer *) create
public convenience init()
public Magnetometer()
Methods
isAvailable
Check if available. Returns true only when on Android or iOS and the hardware supports it. Other operating systems are not supported for the time being.
bool easyar_Magnetometer_isAvailable(easyar_Magnetometer * This)
bool isAvailable()
public boolean isAvailable()
fun isAvailable(): Boolean
- (bool)isAvailable
public func isAvailable() -> Bool
public virtual bool isAvailable()
Returns
- Boolean
output
Output port.
void easyar_Magnetometer_output(easyar_Magnetometer * This, easyar_MagnetometerResultSource * * Return)
std::shared_ptr<MagnetometerResultSource> output()
public @Nonnull MagnetometerResultSource output()
fun output(): MagnetometerResultSource
- (easyar_MagnetometerResultSource *)output
public func output() -> MagnetometerResultSource
public virtual MagnetometerResultSource output()
Returns
open
Open the device. The sampling period is determined by the internal implementation. If opening fails, returns false.
bool easyar_Magnetometer_open(easyar_Magnetometer * This)
bool open()
public boolean open()
fun open(): Boolean
- (bool)open
public func `open`() -> Bool
public virtual bool open()
Returns
- Boolean
openWithSamplingPeriod
Open the device with a specific sampling period. The sampling period may not reach the specified value due to hardware limitations. If opening fails, returns false.
bool easyar_Magnetometer_openWithSamplingPeriod(easyar_Magnetometer * 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
samplingPeriodMillisecondsInt32
Returns
- Boolean
close
Close the device. After close, it should not be used again.
void easyar_Magnetometer_close(easyar_Magnetometer * This)
void close()
public void close()
fun close(): Unit
- (void)close
public func close() -> Void
public virtual void close()
Returns
- Void
getCurrentResult
Get the current latest result. If the result has not been obtained yet, returns null.
easyar_OptionalOfMagnetometerResult easyar_Magnetometer_getCurrentResult(easyar_Magnetometer * This)
std::optional<MagnetometerResult> getCurrentResult()
public @Nullable MagnetometerResult getCurrentResult()
fun getCurrentResult(): MagnetometerResult?
- (easyar_MagnetometerResult *)getCurrentResult
public func getCurrentResult() -> MagnetometerResult?
public virtual Optional<MagnetometerResult> getCurrentResult()
Returns
- Optional<MagnetometerResult>