My Project
Loading...
Searching...
No Matches
SDL_sensor.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
29#ifndef SDL_sensor_h_
30#define SDL_sensor_h_
31
32#include "SDL_stdinc.h"
33#include "SDL_error.h"
34
35#include "begin_code.h"
36/* Set up for C function definitions, even when using C++ */
37#ifdef __cplusplus
38/* *INDENT-OFF* */
39extern "C" {
40/* *INDENT-ON* */
41#endif
42
51struct _SDL_Sensor;
52typedef struct _SDL_Sensor SDL_Sensor;
53
60typedef Sint32 SDL_SensorID;
61
62/* The different sensors defined by SDL
63 *
64 * Additional sensors may be available, using platform dependent semantics.
65 *
66 * Hare are the additional Android sensors:
67 * https://developer.android.com/reference/android/hardware/SensorEvent.html#values
68 */
69typedef enum
70{
80
103#define SDL_STANDARD_GRAVITY 9.80665f
104
129/* Function prototypes */
130
143extern DECLSPEC void SDLCALL SDL_LockSensors(void);
144extern DECLSPEC void SDLCALL SDL_UnlockSensors(void);
145
153extern DECLSPEC int SDLCALL SDL_NumSensors(void);
154
163extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
164
174extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index);
175
185extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index);
186
195extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index);
196
205extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
206
215extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id);
216
225extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
226
236extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
237
246extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
247
256extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor);
257
270extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, int num_values);
271
287extern DECLSPEC int SDLCALL SDL_SensorGetDataWithTimestamp(SDL_Sensor *sensor, Uint64 *timestamp, float *data, int num_values);
288
296extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor *sensor);
297
309extern DECLSPEC void SDLCALL SDL_SensorUpdate(void);
310
311
312/* Ends C function definitions when using C++ */
313#ifdef __cplusplus
314/* *INDENT-OFF* */
315}
316/* *INDENT-ON* */
317#endif
318#include "close_code.h"
319
320#endif /* SDL_sensor_h_ */
321
322/* vi: set ts=4 sw=4 expandtab: */
DECLSPEC void SDLCALL SDL_LockSensors(void)
Sint32 SDL_SensorID
Definition: SDL_sensor.h:60
DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index)
DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, int num_values)
DECLSPEC void SDLCALL SDL_SensorUpdate(void)
DECLSPEC int SDLCALL SDL_NumSensors(void)
DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor)
DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index)
DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor *sensor)
DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index)
DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index)
DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor)
SDL_SensorType
Definition: SDL_sensor.h:70
@ SDL_SENSOR_GYRO_L
Definition: SDL_sensor.h:76
@ SDL_SENSOR_INVALID
Definition: SDL_sensor.h:71
@ SDL_SENSOR_GYRO
Definition: SDL_sensor.h:74
@ SDL_SENSOR_ACCEL_R
Definition: SDL_sensor.h:77
@ SDL_SENSOR_UNKNOWN
Definition: SDL_sensor.h:72
@ SDL_SENSOR_ACCEL
Definition: SDL_sensor.h:73
@ SDL_SENSOR_ACCEL_L
Definition: SDL_sensor.h:75
@ SDL_SENSOR_GYRO_R
Definition: SDL_sensor.h:78
DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor)
DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor)
DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id)
DECLSPEC int SDLCALL SDL_SensorGetDataWithTimestamp(SDL_Sensor *sensor, Uint64 *timestamp, float *data, int num_values)
DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index)