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
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/status.h>
22 #include <ubuntu/visibility.h>
23 
24 #include <stdint.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
35  typedef struct
36  {
37  int64_t timestamp;
38 
43 
47  typedef struct
48  {
49  int64_t timestamp;
50 
51  float distance;
53 
57  typedef struct
58  {
59  int64_t timestamp;
60 
61  float light;
63 
68  {
79  };
80 
86  typedef void (*on_new_accelerometer_reading)(ubuntu_sensor_accelerometer_reading* reading, void* context);
87 
93  typedef void (*on_new_proximity_reading)(ubuntu_sensor_proximity_reading* reading, void* context);
94 
100  typedef void (*on_new_ambient_light_reading)(ubuntu_sensor_ambient_light_reading* reading, void* context);
101 
105  typedef struct
106  {
113 
115  void* context;
117 
127 
144 
149 
154 
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 #endif // UBUNTU_APPLICATION_SENSORS_C_API_H_
UBUNTU_DLL_PUBLIC void ubuntu_sensor_disable_sensor(ubuntu_sensor_type sensor_type)
void(* on_new_accelerometer_reading)(ubuntu_sensor_accelerometer_reading *reading, void *context)
UBUNTU_DLL_PUBLIC int32_t ubuntu_sensor_get_sensor_min_delay(ubuntu_sensor_type sensor_type)
UBUNTU_DLL_PUBLIC UStatus ubuntu_sensor_get_sensor_max_value(ubuntu_sensor_type sensor_type, float *value)
void(* on_new_ambient_light_reading)(ubuntu_sensor_ambient_light_reading *reading, void *context)
UbuntuStatus
Indicates the status of an operation.
Definition: status.h:26
UBUNTU_DLL_PUBLIC void ubuntu_sensor_initialize_observer(ubuntu_sensor_observer *observer)
UBUNTU_DLL_PUBLIC void ubuntu_sensor_install_observer(ubuntu_sensor_observer *observer)
on_new_ambient_light_reading on_new_ambient_light_reading_cb
UBUNTU_DLL_PUBLIC UStatus ubuntu_sensor_get_sensor_min_value(ubuntu_sensor_type sensor_type, float *value)
#define UBUNTU_DLL_PUBLIC
Definition: visibility.h:25
UBUNTU_DLL_PUBLIC UStatus ubuntu_sensor_get_sensor_resolution(ubuntu_sensor_type sensor_type, float *value)
on_new_proximity_reading on_new_proximity_reading_cb
UBUNTU_DLL_PUBLIC void ubuntu_sensor_enable_sensor(ubuntu_sensor_type sensor_type)
void(* on_new_proximity_reading)(ubuntu_sensor_proximity_reading *reading, void *context)
on_new_accelerometer_reading on_new_accelerometer_reading_cb
UBUNTU_DLL_PUBLIC void ubuntu_sensor_uninstall_observer(ubuntu_sensor_observer *observer)