Class Magnetometer
- Namespace
- easyar
Magnetometer calls the system-provided magnetometer and outputs MagnetometerResult. 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.
Constructors
Magnetometer
void easyar_Magnetometer__ctor(easyar_Magnetometer * * Return)
Magnetometer()
public Magnetometer()
constructor()
+ (easyar_Magnetometer *) create
public convenience init()
public Magnetometer()
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_Magnetometer_isAvailable(easyar_Magnetometer * 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_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
| Type | Description |
|---|---|
| MagnetometerResultSource |
open
Opens 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
| 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_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
| Name | Type | Description |
|---|---|---|
| samplingPeriodMilliseconds | Int32 |
Returns
| Type | Description |
|---|---|
| Boolean |
close
Closes the device. It should not be used after close.
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
| Type | Description |
|---|---|
| Void |
getCurrentResult
Gets the current latest result. If no result has been obtained yet, returns empty.
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
| Type | Description |
|---|---|
| Optional<MagnetometerResult> |