Ubuntu Platform API
1.0.0
A library helping with tight integration into the Ubuntu platform
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
ubuntu_application_sensors.h
Go to the documentation of this file.
1
/*
2
* Copyright © 2012 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: Thomas Voß <thomas.voss@canonical.com>
17
*/
18
#ifndef UBUNTU_APPLICATION_SENSORS_C_API_H_
19
#define UBUNTU_APPLICATION_SENSORS_C_API_H_
20
21
#include <
ubuntu/visibility.h
>
22
23
#include <stdint.h>
24
25
#ifdef __cplusplus
26
extern
"C"
{
27
#endif
28
34
typedef
struct
35
{
36
int64_t
timestamp
;
37
38
float
acceleration_x
;
39
float
acceleration_y
;
40
float
acceleration_z
;
41
}
ubuntu_sensor_accelerometer_reading
;
42
46
typedef
struct
47
{
48
int64_t
timestamp
;
49
50
float
distance
;
51
}
ubuntu_sensor_proximity_reading
;
52
56
typedef
struct
57
{
58
int64_t
timestamp
;
59
60
float
light
;
61
}
ubuntu_sensor_ambient_light_reading
;
62
66
enum
ubuntu_sensor_type
67
{
68
first_defined_sensor_type
= 0,
69
ubuntu_sensor_type_accelerometer
=
first_defined_sensor_type
,
70
ubuntu_sensor_type_magnetic_field
,
71
ubuntu_sensor_type_gyroscope
,
72
ubuntu_sensor_type_light
,
73
ubuntu_sensor_type_proximity
,
74
ubuntu_sensor_type_orientation
,
75
ubuntu_sensor_type_linear_acceleration
,
76
ubuntu_sensor_type_rotation_vector
,
77
undefined_sensor_type
78
};
79
85
typedef
void (*
on_new_accelerometer_reading
)(
ubuntu_sensor_accelerometer_reading
* reading,
void
* context);
86
92
typedef
void (*
on_new_proximity_reading
)(
ubuntu_sensor_proximity_reading
* reading,
void
* context);
93
99
typedef
void (*
on_new_ambient_light_reading
)(
ubuntu_sensor_ambient_light_reading
* reading,
void
* context);
100
104
typedef
struct
105
{
107
on_new_accelerometer_reading
on_new_accelerometer_reading_cb
;
109
on_new_proximity_reading
on_new_proximity_reading_cb
;
111
on_new_ambient_light_reading
on_new_ambient_light_reading_cb
;
112
114
void
*
context
;
115
}
ubuntu_sensor_observer
;
116
117
UBUNTU_DLL_PUBLIC
void
ubuntu_sensor_initialize_observer
(
ubuntu_sensor_observer
* observer);
121
UBUNTU_DLL_PUBLIC
void
ubuntu_sensor_install_observer
(
ubuntu_sensor_observer
* observer);
125
UBUNTU_DLL_PUBLIC
void
ubuntu_sensor_uninstall_observer
(
ubuntu_sensor_observer
* observer);
126
130
UBUNTU_DLL_PUBLIC
void
ubuntu_sensor_enable_sensor
(
ubuntu_sensor_type
sensor_type);
134
UBUNTU_DLL_PUBLIC
void
ubuntu_sensor_disable_sensor
(
ubuntu_sensor_type
sensor_type);
138
UBUNTU_DLL_PUBLIC
int32_t
ubuntu_sensor_get_sensor_min_delay
(
ubuntu_sensor_type
sensor_type);
142
UBUNTU_DLL_PUBLIC
float
ubuntu_sensor_get_sensor_min_value
(
ubuntu_sensor_type
sensor_type);
146
UBUNTU_DLL_PUBLIC
float
ubuntu_sensor_get_sensor_max_value
(
ubuntu_sensor_type
sensor_type);
150
UBUNTU_DLL_PUBLIC
float
ubuntu_sensor_get_sensor_resolution
(
ubuntu_sensor_type
sensor_type);
151
153
#ifdef __cplusplus
154
}
155
#endif
156
157
#endif // UBUNTU_APPLICATION_SENSORS_C_API_H_
include
ubuntu
application
sensors
ubuntu_application_sensors.h
Generated on Tue Oct 15 2013 02:50:25 for Ubuntu Platform API by
1.8.4