1 /* dstep -I/path/to/ndk-r9d/platforms/android-9/arch-x86/usr/include -I/path/to/ndk-r9d/toolchains/llvm-3.4/prebuilt/linux-x86/lib/clang/3.4/include /path/to/ndk-r9d/platforms/android-9/arch-x86/usr/include/android/sensor.h -o sensor.d*/
2 
3 module android.sensor;
4 
5 import core.sys.posix.sys.types;
6 import android.looper;
7 
8 version (Android):
9 extern (C):
10 @system:
11 nothrow:
12 @nogc:
13 
14 enum
15 {
16     ASENSOR_TYPE_ACCELEROMETER = 1,
17     ASENSOR_TYPE_MAGNETIC_FIELD = 2,
18     ASENSOR_TYPE_GYROSCOPE = 4,
19     ASENSOR_TYPE_LIGHT = 5,
20     ASENSOR_TYPE_PROXIMITY = 8
21 }
22 
23 enum
24 {
25     ASENSOR_STATUS_UNRELIABLE = 0,
26     ASENSOR_STATUS_ACCURACY_LOW = 1,
27     ASENSOR_STATUS_ACCURACY_MEDIUM = 2,
28     ASENSOR_STATUS_ACCURACY_HIGH = 3
29 }
30 
31 enum ASENSOR_STANDARD_GRAVITY = 9.80665f;
32 enum ASENSOR_MAGNETIC_FIELD_EARTH_MAX = 60.0f;
33 enum ASENSOR_MAGNETIC_FIELD_EARTH_MIN = 30.0f;
34 
35 struct ASensorVector
36 {
37     union
38     {
39         float[3] v;
40         struct
41         {
42             float x;
43             float y;
44             float z;
45         }
46         struct
47         {
48             float azimuth;
49             float pitch;
50             float roll;
51         }
52     }
53     byte status;
54     ubyte[3] reserved;
55 }
56 
57 struct ASensorEvent
58 {
59     int version_;
60     int sensor;
61     int type;
62     int reserved0;
63     long timestamp;
64     union
65     {
66         float[16] data;
67         ASensorVector vector;
68         ASensorVector acceleration;
69         ASensorVector magnetic;
70         float temperature;
71         float distance;
72         float light;
73         float pressure;
74     }
75     int[4] reserved1;
76 }
77 
78 struct ASensorManager;
79 struct ASensorEventQueue;
80 struct ASensor;
81 alias const(ASensor)* ASensorRef;
82 alias const(ASensorRef)* ASensorList;
83 
84 ASensorManager* ASensorManager_getInstance();
85 int ASensorManager_getSensorList(ASensorManager* manager, ASensorList* list);
86 const(ASensor)* ASensorManager_getDefaultSensor(ASensorManager* manager, int type);
87 ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager, ALooper* looper, int ident, ALooper_callbackFunc callback, void* data);
88 int ASensorManager_destroyEventQueue(ASensorManager* manager, ASensorEventQueue* queue);
89 int ASensorEventQueue_enableSensor(ASensorEventQueue* queue, const(ASensor)* sensor);
90 int ASensorEventQueue_disableSensor(ASensorEventQueue* queue, const(ASensor)* sensor);
91 int ASensorEventQueue_setEventRate(ASensorEventQueue* queue, const(ASensor)* sensor, int usec);
92 int ASensorEventQueue_hasEvents(ASensorEventQueue* queue);
93 ssize_t ASensorEventQueue_getEvents(ASensorEventQueue* queue, ASensorEvent* events, size_t count);
94 const(char)* ASensor_getName(const(ASensor)* sensor);
95 const(char)* ASensor_getVendor(const(ASensor)* sensor);
96 int ASensor_getType(const(ASensor)* sensor);
97 float ASensor_getResolution(const(ASensor)* sensor);
98 int ASensor_getMinDelay(const(ASensor)* sensor);