Ubuntu Platform API  3.0.0
A library helping with tight integration into the Ubuntu platform
magnetic.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Canonical, Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 3, as published by
6  * the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10  * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef UBUNTU_APPLICATION_SENSORS_MAGNETIC_H_
18 #define UBUNTU_APPLICATION_SENSORS_MAGNETIC_H_
19 
20 #include <ubuntu/status.h>
21 #include <ubuntu/visibility.h>
22 
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
33  typedef void UASensorsMagnetic;
34 
39  typedef void (*on_magnetic_event_cb)(UASMagneticEvent* event,
40  void* context);
41 
47  UBUNTU_DLL_PUBLIC UASensorsMagnetic*
49 
58  UASensorsMagnetic* sensor);
59 
68  UASensorsMagnetic* sensor);
69 
76  UBUNTU_DLL_PUBLIC uint32_t
78  UASensorsMagnetic* sensor);
79 
88  UASensorsMagnetic* sensor,
89  float* value);
90 
99  UASensorsMagnetic* sensor,
100  float* value);
101 
110  UASensorsMagnetic* sensor,
111  float* value);
112 
120  UBUNTU_DLL_PUBLIC void
122  UASensorsMagnetic* sensor,
124  void *ctx);
125 
135  UASensorsMagnetic* sensor,
136  uint32_t rate);
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif /* UBUNTU_APPLICATION_SENSORS_MAGNETIC_H_ */
void UASMagneticEvent
Opaque type describing a magnetic field reading.
Definition: magnetic.h:32
UBUNTU_DLL_PUBLIC uint32_t ua_sensors_magnetic_get_min_delay(UASensorsMagnetic *sensor)
Queries the minimum delay between two readings for the supplied sensor.
UbuntuStatus
Indicates the status of an operation.
Definition: status.h:26
void(* on_magnetic_event_cb)(UASMagneticEvent *event, void *context)
Callback type used by applications to subscribe to magnetic sensor events.
Definition: magnetic.h:39
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.
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.
void UASensorsMagnetic
Opaque type that models the Magnetic field.
Definition: magnetic.h:33
UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_set_event_rate(UASensorsMagnetic *sensor, uint32_t rate)
Set the sensor event delivery rate in nanoseconds..
UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_get_resolution(UASensorsMagnetic *sensor, float *value)
Queries the numeric resolution supported by the sensor.
UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_enable(UASensorsMagnetic *sensor)
Enables the supplied magnetic field sensor.
#define UBUNTU_DLL_PUBLIC
Definition: visibility.h:26
UBUNTU_DLL_PUBLIC UASensorsMagnetic * ua_sensors_magnetic_new()
Create a new object for accessing the magnetic field sensor.
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.
UBUNTU_DLL_PUBLIC UStatus ua_sensors_magnetic_disable(UASensorsMagnetic *sensor)
Disables the supplied magnetic field sensor.