Atlas - SDL_syssensor.h

Home / ext / SDL2 / src / sensor Lines: 1 | Size: 3676 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2018 Sam Lantinga <[email protected]> 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#include "SDL_config.h" 22 23/* This is the system specific header for the SDL sensor API */ 24 25#include "SDL_sensor.h" 26#include "SDL_sensor_c.h" 27 28/* The SDL sensor structure */ 29struct _SDL_Sensor 30{ 31 SDL_SensorID instance_id; /* Device instance, monotonically increasing from 0 */ 32 char *name; /* Sensor name - system dependent */ 33 SDL_SensorType type; /* Type of the sensor */ 34 int non_portable_type; /* Platform dependent type of the sensor */ 35 36 float data[16]; /* The current state of the sensor */ 37 38 struct _SDL_SensorDriver *driver; 39 40 struct sensor_hwdata *hwdata; /* Driver dependent information */ 41 42 int ref_count; /* Reference count for multiple opens */ 43 44 struct _SDL_Sensor *next; /* pointer to next sensor we have allocated */ 45}; 46 47typedef struct _SDL_SensorDriver 48{ 49 /* Function to scan the system for sensors. 50 * sensor 0 should be the system default sensor. 51 * This function should return 0, or -1 on an unrecoverable fatal error. 52 */ 53 int (*Init)(void); 54 55 /* Function to return the number of sensors available right now */ 56 int (*GetCount)(void); 57 58 /* Function to check to see if the available sensors have changed */ 59 void (*Detect)(void); 60 61 /* Function to get the device-dependent name of a sensor */ 62 const char *(*GetDeviceName)(int device_index); 63 64 /* Function to get the type of a sensor */ 65 SDL_SensorType (*GetDeviceType)(int device_index); 66 67 /* Function to get the platform dependent type of a sensor */ 68 int (*GetDeviceNonPortableType)(int device_index); 69 70 /* Function to get the current instance id of the sensor located at device_index */ 71 SDL_SensorID (*GetDeviceInstanceID)(int device_index); 72 73 /* Function to open a sensor for use. 74 The sensor to open is specified by the device index. 75 It returns 0, or -1 if there is an error. 76 */ 77 int (*Open)(SDL_Sensor * sensor, int device_index); 78 79 /* Function to update the state of a sensor - called as a device poll. 80 * This function shouldn't update the sensor structure directly, 81 * but instead should call SDL_PrivateSensorUpdate() to deliver events 82 * and update sensor device state. 83 */ 84 void (*Update)(SDL_Sensor * sensor); 85 86 /* Function to close a sensor after use */ 87 void (*Close)(SDL_Sensor * sensor); 88 89 /* Function to perform any system-specific sensor related cleanup */ 90 void (*Quit)(void); 91 92} SDL_SensorDriver; 93 94/* The available sensor drivers */ 95extern SDL_SensorDriver SDL_ANDROID_SensorDriver; 96extern SDL_SensorDriver SDL_COREMOTION_SensorDriver; 97extern SDL_SensorDriver SDL_DUMMY_SensorDriver; 98 99/* vi: set ts=4 sw=4 expandtab: */ 100
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.