Ubuntu Platform API  2.0.0
A library helping with tight integration into the Ubuntu platform
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
accelerometer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU 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  * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com>
17  */
18 
19 #ifndef UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_H_
20 #define UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_H_
21 
22 #include <ubuntu/status.h>
23 #include <ubuntu/visibility.h>
24 
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
35  typedef void UASensorsAccelerometer;
36 
42  void* context);
43 
49  UBUNTU_DLL_PUBLIC UASensorsAccelerometer*
51 
60  UASensorsAccelerometer* sensor);
61 
70  UASensorsAccelerometer* sensor);
71 
78  UBUNTU_DLL_PUBLIC uint32_t
80  UASensorsAccelerometer* sensor);
81 
90  UASensorsAccelerometer* sensor,
91  float* value);
92 
101  UASensorsAccelerometer* sensor,
102  float* value);
103 
112  UASensorsAccelerometer* sensor,
113  float* value);
114 
122  UBUNTU_DLL_PUBLIC void
124  UASensorsAccelerometer* sensor,
126  void *ctx);
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif /* UBUNTU_APPLICATION_SENSORS_ACCELEROMETER_H_ */
UBUNTU_DLL_PUBLIC void ua_sensors_accelerometer_set_reading_cb(UASensorsAccelerometer *sensor, on_accelerometer_event_cb cb, void *ctx)
Set the callback to be invoked whenever a new sensor reading is available.
void(* on_accelerometer_event_cb)(UASAccelerometerEvent *event, void *context)
Callback type used by applications to subscribe to accelerometer events.
Definition: accelerometer.h:41
void UASensorsAccelerometer
Opaque type that models the accelerometer.
Definition: accelerometer.h:35
UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_disable(UASensorsAccelerometer *sensor)
Disables the supplied accelerometer.
UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_get_max_value(UASensorsAccelerometer *sensor, float *value)
Queries the maximum value that can be reported by the sensor.
UbuntuStatus
Indicates the status of an operation.
Definition: status.h:26
UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_enable(UASensorsAccelerometer *sensor)
Enables the supplied accelerometer.
UBUNTU_DLL_PUBLIC uint32_t ua_sensors_accelerometer_get_min_delay(UASensorsAccelerometer *sensor)
Queries the minimum delay between two readings for the supplied sensor.
UBUNTU_DLL_PUBLIC UASensorsAccelerometer * ua_sensors_accelerometer_new()
Create a new object for accessing the accelerometer.
void UASAccelerometerEvent
Opaque type describing an accelerometer reading.
Definition: accelerometer.h:34
UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_get_min_value(UASensorsAccelerometer *sensor, float *value)
Queries the minimum value that can be reported by the sensor.
#define UBUNTU_DLL_PUBLIC
Definition: visibility.h:25
UBUNTU_DLL_PUBLIC UStatus ua_sensors_accelerometer_get_resolution(UASensorsAccelerometer *sensor, float *value)
Queries the numeric resolution supported by the sensor.