Ubuntu Platform API  3.0.0
A library helping with tight integration into the Ubuntu platform
magnetic.h File Reference
+ Include dependency graph for magnetic.h:

Go to the source code of this file.

Typedefs

typedef void UASensorsMagnetic
 Opaque type that models the Magnetic field. More...
 
typedef void(* on_magnetic_event_cb) (UASMagneticEvent *event, void *context)
 Callback type used by applications to subscribe to magnetic sensor events. More...
 

Functions

UBUNTU_DLL_PUBLIC UASensorsMagneticua_sensors_magnetic_new ()
 Create a new object for accessing the magnetic field sensor. More...
 
UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_enable (UASensorsMagnetic *sensor)
 Enables the supplied magnetic field sensor. More...
 
UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_disable (UASensorsMagnetic *sensor)
 Disables the supplied magnetic field sensor. More...
 
UBUNTU_DLL_PUBLIC uint32_t ua_sensors_magnetic_get_min_delay (UASensorsMagnetic *sensor)
 Queries the minimum delay between two readings for the supplied sensor. More...
 
UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_get_min_value (UASensorsMagnetic *sensor, float *value)
 Queries the minimum value that can be reported by the sensor. More...
 
UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_get_max_value (UASensorsMagnetic *sensor, float *value)
 Queries the maximum value that can be reported by the sensor. More...
 
UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_get_resolution (UASensorsMagnetic *sensor, float *value)
 Queries the numeric resolution supported by the sensor. More...
 
UBUNTU_DLL_PUBLIC void ua_sensors_magnetic_set_reading_cb (UASensorsMagnetic *sensor, on_magnetic_event_cb cb, void *ctx)
 Set the callback to be invoked whenever a new sensor reading is available. More...
 
UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_set_event_rate (UASensorsMagnetic *sensor, uint32_t rate)
 Set the sensor event delivery rate in nanoseconds.. More...
 

Typedef Documentation

◆ on_magnetic_event_cb

typedef void(* on_magnetic_event_cb) (UASMagneticEvent *event, void *context)

Callback type used by applications to subscribe to magnetic sensor events.

Definition at line 39 of file magnetic.h.

◆ UASensorsMagnetic

typedef void UASensorsMagnetic

Opaque type that models the Magnetic field.

Definition at line 33 of file magnetic.h.

Function Documentation

◆ ua_sensors_magnetic_disable()

UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_disable ( UASensorsMagnetic sensor)

Disables the supplied magnetic field sensor.

Returns
U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured.
Parameters
[in]sensorThe sensor instance to be disabled.

◆ ua_sensors_magnetic_enable()

UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_enable ( UASensorsMagnetic sensor)

Enables the supplied magnetic field sensor.

Returns
U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured.
Parameters
[in]sensorThe sensor instance to be enabled.

◆ ua_sensors_magnetic_get_max_value()

UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_get_max_value ( UASensorsMagnetic sensor,
float *  value 
)

Queries the maximum value that can be reported by the sensor.

Returns
The maximum value that can be reported by the sensor.
Parameters
[in]sensorThe sensor instance to be queried.

◆ ua_sensors_magnetic_get_min_delay()

UBUNTU_DLL_PUBLIC uint32_t ua_sensors_magnetic_get_min_delay ( UASensorsMagnetic sensor)

Queries the minimum delay between two readings for the supplied sensor.

Returns
The minimum delay between two readings in [ms].
Parameters
[in]sensorThe sensor instance to be queried.

◆ ua_sensors_magnetic_get_min_value()

UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_get_min_value ( UASensorsMagnetic sensor,
float *  value 
)

Queries the minimum value that can be reported by the sensor.

Returns
The minimum value that can be reported by the sensor.
Parameters
[in]sensorThe sensor instance to be queried.

◆ ua_sensors_magnetic_get_resolution()

UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_get_resolution ( UASensorsMagnetic sensor,
float *  value 
)

Queries the numeric resolution supported by the sensor.

Returns
The numeric resolution supported by the sensor.
Parameters
[in]sensorThe sensor instance to be queried.

◆ ua_sensors_magnetic_new()

UBUNTU_DLL_PUBLIC UASensorsMagnetic* ua_sensors_magnetic_new ( )

Create a new object for accessing the magnetic field sensor.

Returns
A new instance or NULL in case of errors.

◆ ua_sensors_magnetic_set_event_rate()

UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_set_event_rate ( UASensorsMagnetic sensor,
uint32_t  rate 
)

Set the sensor event delivery rate in nanoseconds..

Returns
U_STATUS_SUCCESS if successful or U_STATUS_ERROR if an error occured.
Parameters
[in]sensorThe sensor instance to be modified.
[in]rateThe new event delivery rate.

◆ ua_sensors_magnetic_set_reading_cb()

UBUNTU_DLL_PUBLIC void ua_sensors_magnetic_set_reading_cb ( UASensorsMagnetic sensor,
on_magnetic_event_cb  cb,
void *  ctx 
)

Set the callback to be invoked whenever a new sensor reading is available.

Parameters
[in]sensorThe sensor instance to associate the callback with.
[in]cbThe callback to be invoked.
[in]ctxThe context supplied to the callback invocation.